Benign powershell Download

install.ps1

Embedded PowerShell fetch-and-evaluateIRM fetches a remote HTTPS script
SHA-256d23b1a511685dc63bdeaa60daf55e80dbbd9ae4b43b5ed0989f82a4539602982

Evidence

Block comment documents IRM piped to IEX lines 1–10
1#Requires -Version 5.1
2<#
3 YAGNI Code CLI installer for Windows
4
5 irm https://yagni.app/install.ps1 | iex
6
7 Installs @yagni-app/code globally with npm and makes sure the `yagni`
8 command is on PATH. This is the Windows counterpart of install.sh: the
9 same checks, the same "never sudo" rule (npm's global prefix on Windows is
10 per-user already, so no elevated prompt is …
PowerShell script sets stop-on-error behavior lines 16–24
16:78…
17 policy and says what to do when it would refuse to load.
18#>
19
20$ErrorActionPreference = 'Stop'
21
22$Package = '@yagni-app/code'
23$MinNode = [version]'22.19'
24# Where the prefix moves when the configured one is not writable. npm …
LOCALAPPDATA env-var path reference lines 26–42
26:20… env:YAGNI_NPM_PREFIX) { $env:YAGNI_NPM_PREFIX } else { Join-Path $env:LOCALAPPDATA 'yagni\npm' }
27
28function Write-Note([string] $Message) { Write-Host $Message }
29function Write-Fail([string] $Message) { Write-Host "yagni install: $Message" -ForegroundColor Red }
30
31# `npm` on PATH resolves to npm.ps1 first, which a Restricted execution policy
32# refuses to run even though this installer itself is fine (iex runs in
33# memory). npm.cmd is what the Node installer puts on PATH and is policy-free.
34function Find-Npm {
35 foreach ($name in 'npm.cmd', 'npm') {
36 $cmd = Get-Command $name -ErrorAction SilentlyContinue
37 if ($cmd) { return $cmd.Source }
38 }
⋯4 lines
PowerShell probes command availability lines 43–48
43:57… either Version or Error.
44function Get-NodeVersion {
45 $node = Get-Command node -ErrorAction SilentlyContinue
46 if (-not $node) { return @{ Found = $false } }
47 $previous = $ErrorActionPreference
48 $ErrorActionPreference = 'Continu …
PowerShell reads a named environment variable lines 91–96
91:47… k it up when reopened.
92function Add-ToUserPath([string] $Dir) {
93 $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
94 $present = $false
95 foreach ($entry in ($userPath -split ';')) {
96 if ($entry -and ($entry.TrimEnd( …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.