Benign powershell Download

install.ps1

Invokes PowerShell HTTP request cmdletPowerShell OS query and version references
SHA-256213481551e78211d0000dd11b06202528a1bfe0b8ced3b46005d0e6e81aaa39f

Evidence

Comment line documents piped eval lines 1–14
1# drive9 installer
2# Usage: irm https://drive9.ai/install.ps1 | iex
3
4$ErrorActionPreference = "Stop"
5
6function Write-Info($Message) {
7 Write-Host " $Message" -ForegroundColor DarkGray
8}
9
⋯5 lines
Defines Pass/Fail/Bad helper functions lines 14–45
14:30… essage) {
15 Write-Host " $Message" -ForegroundColor Yellow
16}
17
18function Fail($Message) {
19 Write-Host " error: $Message" -ForegroundColor Red
20 exit 1
21}
22
23if ($PSVersionTable.PSVersion.Major -lt 6) {
24 try {
25 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
26 } catch {
27 }
28}
29
30$BaseUrl = "https://releases.drive9.ai/latest"
31$ApiUrl = "https://api.drive9.ai"
32$localAppData = [Environment]::GetFolderPath("LocalApplicationData")
33if ([string]::IsNullOrWhiteSpace($localAppData)) {
34 if ($env:LOCALAPPDATA) {
35 $localAppData = $env:LOCALAPPDATA
36 } elseif ($env:USERPROFILE) {
37 $localAppData = Join-Path $env:USERPROFILE "AppData\Local"
38 } elseif ($HOME) {
39 $localAppData = Join-Path $HOME "AppData\Local"
40 } else {
41 Fail "Could not determine the LocalApplicationData directory"
42 }
43}
44
45$DefaultInstallDir = Join-Path $localAppData "drive9"
Get-CimInstance cmdlet reference lines 46–53
46:19… l
47
48function Get-Architecture() {
49 try {
50 $archCode = (Get-CimInstance Win32_Processor | Select-Object -First 1 -ExpandProperty Architecture)
51 switch ($archCode) {
52 9 { return "amd64" }
53 …
Invokes PowerShell HTTP request cmdlet lines 73–76
73:2… if ($PSVersionTable.PSVersion.Major -lt 6) {
74 Invoke-WebRequest -Uri $Url -OutFile $OutputPath -UseBasicParsing -ErrorAction Stop | Out-Null
75 } else {
76 Invoke-WebRequest -Uri $Url -OutFile $OutputPath -ErrorAction Stop | …
Content member after closing parenthesis lines 90–95
90:26… e-WebRequest -Uri $versionUrl -UseBasicParsing -ErrorAction Stop).Content.Trim()
91 }
92
93 return (Invoke-WebRequest -Uri $versionUrl -ErrorAction Stop).Content.Trim()
94 } catch {
95 re …

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.