Discover the comprehensive Penetration Testing Cheat Sheet, your go-to guide for quick references, commands, and techniques in the world of penetration testing.
Whether you’re a novice or an experienced pentester, this cheat sheet has everything you need to navigate the world of security assessments. Explore tools, methodologies, and insights for effective reconnaissance, enumeration, privilege escalation, password cracking, exploit research, and more. Elevate your penetration testing skills with this valuable resource!
Recon and Enumeration
NMAP Commands
Nmap (“Network Mapper”) is a free and open-source utility for network discovery and security auditing. It’s a versatile tool used by both systems and network administrators for tasks like network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X.
Command
Description
nmap -v -sS -A -T4 target
Nmap verbose scan, runs syn stealth, T4 timing, OS and service version info, traceroute and scripts against services.
ping sweep sudo nmap -pn target
Does a ping sweep over the target’s network to see all the available IPs.
nmap -v -sS -p–A -T4 target
As above but scans all TCP ports (takes a lot longer).
nmap -v -sU -sS -p- -A -T4 target
As above but scans all TCP ports and UDP scan (takes even longer).
In computer networking, Server Message Block (SMB) operates as an application-layer network protocol mainly used for providing shared access to files, printers, and serial ports.
Command
Description
nbtscan 192.168.1.0/24
Discover Windows / Samba servers on subnet, finds Windows MAC addresses, netbios name and discover client workgroup / domain.
enum4linux -a target-ip
Do Everything, runs all options (find windows client domain / workgroup) apart from dictionary based share name guessing.
smbclient -L target-ip
Lists all SMB shares available on the target machine.
smbget -R smb://target-ip/share
Recursively downloads files from an SMB share.
rpcclient -U "" target-ip
Connects to an SMB server using an empty username and lists available commands.
showmount -e target-ip
Shows the available shares on the target machine, useful for NFS.
smbmap -H target-ip
Shows share permissions of the target.
smbstatus
Lists current Samba connections. Useful when run on the target machine.
Other Host Discovery Methods
Other methods of host discovery that don’t use Nmap.
Command
Description
netdiscover -r 192.168.1.0/24
Discovers IP, MAC Address and MAC vendor on the subnet from ARP.
arp-scan --interface=eth0 192.168.1.0/24
ARP scan to discover hosts on the local network.
fping -g 192.168.1.0/24
Sends ICMP echo requests to multiple hosts to check if they are alive.
Scans all ports at a high rate, useful for initial discovery.
Python Local Web Server
Python local web server command, handy for serving up shells and exploits on an attacking machine.
Command
Description
python -m SimpleHTTPServer 80
Run a basic HTTP server, great for serving up shells etc.
python3 -m http.server 80
Run a basic HTTP server using Python 3.
python -m SimpleHTTPServer 80 --bind 192.168.1.2
Bind the server to a specific IP address.
Mounting File Shares
How to mount NFS / CIFS, Windows and Linux file shares.
Command
Description
mount 192.168.1.1:/vol/share /mnt/nfs
Mount NFS share to /mnt/nfs.
mount -t cifs -o username=user,password=pass,domain=blah //192.168.1.X/share-name /mnt/cifs
Mount Windows CIFS / SMB share on Linux at /mnt/cifs.
net use Z: \\win-server\share password /user:domain\janedoe /savecred /p:no
Mount a Windows share on Windows from the command line.
apt-get install smb4k -y
Install smb4k on Kali, useful Linux GUI for browsing SMB shares.
smbclient -L //192.168.1.X -U username
List SMB shares available on a Windows machine.
Basic FingerPrinting
A device fingerprint or machine fingerprint or browser fingerprint is information collected about a remote computing device for the purpose of identification.
Command
Description
nc -v 192.168.1.1 25
Basic versioning / fingerprinting via displayed banner.
telnet 192.168.1.1 25
Another method for basic versioning / fingerprinting.
curl -I http://192.168.1.1
Fetch HTTP headers for fingerprinting the web server.
nmap -O 192.168.1.1
Perform OS detection using Nmap.
whatweb 192.168.1.1
Identify web technologies in use on the target.
SNMP Enumeration
SNMP enumeration is the process of using SNMP to enumerate user accounts on a target system.
Command
Description
snmpcheck -t 192.168.1.X -c public
SNMP enumeration
snmpwalk -c public -v1 192.168.1.X 1
SNMP enumeration
snmpenum -t 192.168.1.X
SNMP enumeration
onesixtyone -c names -i hosts
SNMP enumeration
snmpbulkwalk -v2c -c public -Cn0 -Cr10 192.168.1.X
Bulk SNMP enumeration
DNS Zone Transfers
Command
Description
nslookup -> set type=any -> ls -d blah.com
Windows DNS zone transfer
dig axfr blah.com @ns1.blah.com
Linux DNS zone transfer
host -l blah.com ns1.blah.com
Another Linux DNS zone transfer method
DNSRecon
DNSRecon provides the ability to perform various DNS enumeration tasks.