How-to: install an Nmap script

Hey all,

I often find myself explaining to people how to install a script that isn't included in Nmap. Rather than write it over and over, this is a quick tutorial.

Step 1: Figure out where your scripts are stored

First, you have to find out where your scripts are installed. The easiest way to do that is to search your harddrive for *.nse files.

Windows:

Windows Key + F, *.nse

Linux:

find / -name '*.nse'
locate *.nse

The common places are:

c:\Program Files\Nmap\Scripts
/usr/share/nmap/scripts
/usr/local/share/nmap/scripts

While you're at it, in the same folder as 'scripts', there should be another folder called 'nselib', which contains files named *.lua. That's where libraries go.

Step 2: Get the script + libraries

Usually, I'll provide you with a link to the .nse file. All you have to do is download it and copy it into one of the directories above. If there are libraries to go with it (.lua files), copy them into the nselib folder.

Alternatively, you might be able to download them from the Nmap site itself, typically in the scripts folder.

Step 3: Update script database (optional)

If you want to run the script using a wildcard or category, you have to run Nmap's script update command:
$ nmap --script-updatedb

Note: if you're ok with giving the full name of the script, this isn't necessary.

Step 4: Run it!

The last step is to run the script. Whether you are on the commandline or using Zenmap, the argument is the same: --script <scriptname>

Conclusion

So basically, you find the path where the scripts are stored, copy the script there, and run it. Simple!

Now I can link back to this post whenever I write a new script. :)

Ron

6 thoughts on “How-to: install an Nmap script

  1. Reply

    alanm64

    Exactly what I've been looking for the last 48 hours

  2. Reply

    alanm64

    Btw, love the spam protection. Every step you list here I already knew. My challenge has been at the update step. It errors out. tried to install vnv-info. Err msg 'vnc module' not found. Thoughts if you have time.

    1. Reply

      Ron Bowes Post author

      Thanks @ the spam protection. It's customized just enough that I don't get TOO much spam.

      Can you email error messages (and Nmap version, etc) to me (ron at skullsecurity.net) or the Nmap-dev list (nmap-dev@insecure.org)?

      It's possible that the error is due to having an old version of Nmap, although I'm not sure any version of Nmap has a vnc module.

  3. Reply

    alanm64

    doh! missing vnc.lua

  4. Reply

    alanm64

    Spoke to fast. Sent you an email from lotusebhat@gmail.com. On nmap version 5.35DC1

  5. Reply

    Steve

    Same here, missing vnc.lua

Leave a Reply

Your email address will not be published.