Nmap NSE Scripts: Categories, Useful Scripts and How to Run Them

PRACTICAL LEARNING4 min read

NSE scripts are small Lua programs that extend Nmap from a port scanner into a tool that can grab web page titles, read TLS certificates, enumerate SMB shares, check for known vulnerabilities and much more. Nmap ships with hundreds of them. You run the default set with nmap -sC target and a specific script with nmap --script http-title -p 80,443 target.

This guide explains the script categories, how to select and run scripts safely, and the scripts that are worth knowing first. Only scan systems you own or have written permission to test.

How to run NSE scripts

CommandWhat it does
nmap -sC targetRun the default scripts (same as --script=default)
nmap -sV -sC targetDetect versions first, then run the default scripts. The most common combination
nmap --script http-title -p 80,443 targetRun one script against the ports you choose
nmap --script "http-*" -p 80 targetRun every script whose name starts with http- (use with care)
nmap --script "default and safe" targetCombine categories with and, or and not
nmap --script "not intrusive" targetEverything except intrusive scripts
nmap --script dns-brute --script-args dns-brute.threads=5 example.comPass arguments to a script
nmap --script-help ssl-enum-ciphersRead what a script does before you run it
nmap --script-updatedbRebuild the script database after adding scripts

Scripts live in /usr/share/nmap/scripts/ on Linux. To find scripts for a service, search that folder: ls /usr/share/nmap/scripts | grep smb.

The 14 NSE script categories

CategoryWhat its scripts doRisk
defaultFast, useful, low-noise scripts run by -sCLow
safeDesigned not to crash services or use lots of bandwidthLow
discoveryLearn more about the network: titles, shares, DNS, SNMPLow to medium
versionExtend -sV version detection (run automatically)Low
authCheck authentication, such as anonymous FTP loginsLow to medium
broadcastDiscover hosts by broadcasting on the local networkLow
externalSend data to third-party services, such as vulnerability databasesPrivacy
vulnCheck for specific known vulnerabilitiesMedium
intrusiveNoisy or risky: may crash services or be seen as an attackHigh
bruteGuess credentials. Can lock out accountsHigh
fuzzerSend unexpected input to find bugsHigh
malwareLook for signs of backdoors or infectionsMedium
exploitActively exploit vulnerabilitiesHigh
dosMay cause a denial of serviceHigh

A script can belong to several categories. On real engagements, stay with default, safe, discovery and version unless your written scope explicitly allows brute force, exploitation or denial-of-service testing.

Nmap port states: a SYN answered by SYN/ACK is open, by RST is closed, and silence is filtered
Free for readers
Get the free Nmap Recon Starter Pack
Every scan type, port state, timing flag and the NSE commands on 2 pages, plus a 7-day practice plan, sent to your inbox.

Useful NSE scripts to learn first

ScriptWhat it tells you
http-titleThe title of each web page. Quickly shows what a web server is
http-headersHTTP response headers such as Server and security headers
ssl-certTLS certificate details: names, issuer and expiry date
ssl-enum-ciphersSupported TLS versions and ciphers, with a grade
ssh-hostkeySSH host key fingerprints, useful to spot reused keys
ssh2-enum-algosSSH key exchange, encryption and MAC algorithms
ftp-anonWhether anonymous FTP login is allowed and what is visible
smb-os-discoveryWindows version, computer name and domain over SMB
smb-protocolsWhich SMB versions are enabled (SMBv1 is a red flag)
dns-bruteCommon subdomains of a domain (in scope only)
vulnersKnown CVEs for detected versions. Needs -sV and sends data to vulners.com

A typical, low-risk combination for one web server looks like this:

sudo nmap -sV -p 80,443 --script "http-title,http-headers,ssl-cert,ssl-enum-ciphers" target

Reading NSE output

Script results appear under the port they ran against, indented with a pipe character. Host-level scripts appear in a separate Host script results section at the end:

PORT    STATE SERVICE
443/tcp open  https
| ssl-cert: Subject: commonName=www.example.com
| Issuer: commonName=R11/organizationName=Let's Encrypt
| Not valid before: 2026-10-01T08:12:44
|_Not valid after:  2026-12-30T08:12:43
| http-title: Example Domain
|_Requested resource was https://www.example.com/

Save results with -oA so you can search them later. The XML output keeps script results structured, which makes it easy to import into reports. For the scan types and port states behind these results, see the Nmap cheat sheet with interactive lab.

Frequently asked questions

What does nmap -sC do?

It runs the default NSE scripts against every open port Nmap finds. It is the same as --script=default. The default scripts are chosen to be fast, useful and unlikely to harm services, which is why -sC is often combined with -sV.

Where are Nmap scripts stored?

On Linux they are usually in /usr/share/nmap/scripts/, as files ending in .nse. On Windows they are in the scripts folder of the Nmap installation directory. Run nmap --script-updatedb after adding new scripts.

Are NSE scripts safe to run?

Scripts in the default and safe categories are designed to be low risk. Scripts in the intrusive, brute, exploit, fuzzer and dos categories can lock accounts, crash services or be treated as attacks. Only run them on systems you are authorised to test.

How do I find vulnerabilities with Nmap?

Run version detection and the vuln category or the vulners script, for example nmap -sV --script vulners target. Treat results as leads to verify, not proof: version-based checks can report issues that are already patched.

Can I write my own NSE script?

Yes. NSE scripts are written in Lua and follow a simple structure with a rule that decides when the script runs and an action that does the work. Studying existing scripts in the scripts folder is the best way to start.

Where to go next

Using NSE well, reading scan traffic, mapping firewalls and recon on web servers are covered lesson by lesson in Network Reconnaissance Architecture: Advanced Nmap Scans.