Nmap: how to install nse scrips

Introduction

In this tutorial we are going to add new scripts to nmap, this will allow to do an Advanced vulnerability scanning with Nmap NSE scrips. Follow this simple steps to download new nse scripts and to enable them.

Requirement: have nmap installed

To install nmap execute:

sudo apt install nmap

Step 1: Locate the scripts directory

Usually the nmap nse scripts are located at /usr/share/nmap/scripts, if you don't have this directory try to locate the nse scripts with:

locate *.nse

Other common directories for scripts

  • Linux - /usr/share/nmap/scripts/ or /usr/local/share/nmap/scripts/
  • OSX - /opt/local/share/nmap/scripts/

You can also speficy a directory or filename with the --script parameter of nmap.

Step 2: Download useful NSE scripts

we are going to download scripts from github using wget, execute:

cd /usr/share/nmap/scripts
wget https://raw.githubusercontent.com/scipag/vulscan/master/vulscan.nse
wget https://raw.githubusercontent.com/vulnersCom/nmap-vulners/master/vulners.nse

Step 3: Example usages

We downloaded two cool nse scripts vulnscan and vulners. Here is how to execute vulners nse script with nmap:

nmap -sV --script=vulners 192.168.1.0/24

Here is an example on how to use vulscan script:

 nmap -sV --script=vulnscan 192.168.1.0/24