Initially, Nmap was just a port scanner, but on 10th December 2006, Nmap launched the NSE (Nmap scripting engine) which changed the entire thing about how people looked at Nmap, now it was not just a port scanner but a port scanner with so much more.
Nmap contains a total number of 589 scripts (Version 7.70), there are a lot of scripts that are useful but not all of them works perfectly, it’s like other tools a better for that particular task, so we’ll look at how we can use the powerful NSE and what scripts to use.
To see all the scripts, navigate to
According to Nmap manual
-sC performs a script scan using the default set of scripts. It is equivalent to
--script=default. Some of the scripts in this category are considered intrusive and should not be run against a target network without permission.
So, kindly take permission before running this type of scan against a target .
nmap -sC nmap.scanme.org
For manually specifying script we use
Using this option we specify a script, and use other options like help to understand what the script is used for.
The best way to find out a script according to your need is to use the locate command, so let’s suppose if we want to search for all SSH scripts, we’ll write
We can see that we have total seven script for SSH, to understand what does a script do, we can write:
nmap --script-help script_name.nse
nmap --script-help ssh-brute.nse
So let’s see it in action
Scanning the target for SSH
nmap -sS nmap.scanme.org -p 22
From the result we can conclude that port 22 is open, now let’s find what version of SSH the target host is running.
nmap -sS -sV nmap.scanme.org -p 22
So the target system is running OpenSSH 6.6.1p1 we can look out for exploits for this version of SSH on the internet, but for now we’ll only use the script.
Brute forcing SSH login using NSE:
nmap --script ssh-brute.nse nmap.scanme.org -vv -p 22
Nmap will try every possible username-password combination present in it’s word list to brute force the target.
- Scan the target and find out the services running
- Look for exploits for the running service on the internet.
- Try to exploit the target ( using any tool from plethora of different tools )
- If the exploit fails, try another exploit
- If it fails again , try again, until you successfully exploit the target.
“The master has failed more times than the beginner has even tried.”
― STEPHEN MCCRANIE
Few more script:
--script banner #grab banner
--script broadcast #reveals broadcast information--script vuln #will use default scripts to report vulnerabilities if any.##Looking for specific scripts#Basic syntax:
locate *service name*.nseexamples:
locate *smb*.nse #will list all SMB related scripts
locate *http*.nse #list all web related scripts
That’s it for this blog, try to play around the NSE scripts, you can even install new scripts from the internet using wget and don’t forget to update the NSE engine using
In next blog we’ll cover how to work upon the timing and performance of Nmap scans, till then keep practicing !