Benign powershell Download

install.ps1

Invokes PowerShell HTTP request cmdletInvokes PowerShell REST request cmdlet
SHA-256bc7f3a8cb072924b2c29db15f072467786a7cd744b515f4866f7ed323597dd88

Evidence

PowerShell script sets stop-on-error behavior lines 1–25
1# PowerShell Installer for Steward
2$ErrorActionPreference = 'Stop'
3$ProgressPreference = 'SilentlyContinue'
4
5$APP = "steward"
6$REPO = "sapirrior/steward"
7
8# ANSI Colors matching install.sh
9$e = [char]27
10$MUTED = "$e[0;2m"
⋯7 lines
18Steward Installer
19
20Usage: install.ps1 [options]
21
22Options:
23 -h, --help Display this help message
24 -v, --version <version> Install a specific version (e.g., 0.1.0)
25 -b, --bin …
IRM fetches a remote HTTPS script lines 25–36
25:36… from a local binary instead of downloading
26 --no-modify-path Don't modify shell environment PATH
27
28Examples:
29 irm https://raw.githubusercontent.com/$REPO/main/installer/install.ps1 | iex
30 irm https://raw.githubusercontent.com/$REPO/main/installer/install.ps1 | iex -args "-v 0.1.0"
31 .\install.ps1 -b C:\path\to\steward.exe
32"@
33}
34
35$RequestedVersion = if ($env:VERSION) { $env:VERSION } else { "" }
36$NoModifyPath = $false …
PowerShell creates a directory with New-Item lines 76–85
76:59… _INSTALL_DIR } else { Join-Path $HOME ".steward\bin" }
77$ShareDir = Join-Path $HOME ".steward\share"
78
79if (-not (Test-Path $InstallDir)) {
80 New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
81}
82
83function Print-Message([string]$Level, [string]$Message) {
84 $Color = ""
85 switch ($ …
PowerShell HTTP/HTTPS URL literal lines 104–125
104:9… e-Host "steward ${MUTED}# Run command${NC}"
105 Write-Host ""
106 Write-Host "${MUTED}For more information visit ${NC}https://github.com/$REPO"
107 Write-Host ""
108 Write-Host ""
109}
110
111function Check-ExistingVersion([string]$TargetVersion) {
112 $BinTarget = Join-Path $InstallDir "$APP.exe"
113 $InstalledVersion = ""
114
115 if (Test-Path $BinTarget) {
116 try {
117 $InstalledVersion = (& $BinTarget --version 2>$null)
118 } catch {}
119 } elseif (Get-Command $APP -ErrorAction SilentlyContinue) {
120 try {
121 $InstalledVersion = (& $APP --version 2>$null)
⋯4 lines
References HTTP response-stream accessor lines 148–174
148:26… f)
149
150 $PercentStr = ("{0,3}" -f $Percent)
151 [Console]::Write("`r${ORANGE}${Filled}${Empty} ${PercentStr}%${NC}")
152}
153
154function Download-WithProgress([string]$Url, [string]$Output) {
155 try {
156 $Request = [System.Net.HttpWebRequest]::Create($Url)
157 $Request.Method = "GET"
158 $Request.Timeout = 120000
159 $Request.UserAgent = "steward-installer"
160 $Response = $Request.GetResponse()
161 $TotalBytes = $Response.ContentLength
162 $Stream = $Response.GetResponseStream()
163 $FileStream = [System.IO.File]::Create($Output)
164 $Buffer = New-Object byte[] 65536
165 $TotalRead = 0
166
167 # Hide cursor if supported
168 try { [Console]::CursorVisible = $false } catch {}
169
170 while (($Read = $Stream.Read($Buffer, 0, $Buffer.Length)) -gt 0) {
171 $FileStream.Write($Buffer, 0, $Read)
172 $TotalRead += $Read
173 if ($TotalBytes -gt 0) {
174 Print-Progress $TotalRead $T …

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.