Nmap unusual-port NSE Script


This page contains detailed information about how to use the unusual-port NSE script. For list of all NSE scripts, visit the Nmap NSE Library.

Select:
Overview
Error Messages

Script Overview


Script source code: https://github.com/nmap/nmap/tree/master/scripts/unusual-port.nse
Script categories: safe
Target service / protocol: -
Target network port(s): any
List of CVEs: -

Script Description


The unusual-port.nse script compares the detected service on a port against the expected service for that port number (e.g. ssh on 22, http on 80) and reports deviations. The script requires that a version scan has been run in order to be able to discover what service is actually running on each port.

Unusual-port NSE Script Arguments


The unusual-port.nse script does not have any arguments.

Unusual-port NSE Script Example Usage


Here's an example of how to use the unusual-port.nse script:

nmap --script unusual-port <ip>

Unusual-port NSE Script Example Output


Here's a sample output from the unusual-port.nse script:

23/tcp open   ssh     OpenSSH 5.8p1 Debian 7ubuntu1 (protocol 2.0)
|_unusual-port: ssh unexpected on port tcp/23
25/tcp open   smtp    Postfix smtpd

Unusual-port NSE Script Example XML Output


There is no sample XML output for this module. However, by providing the -oX <file> option, Nmap will produce a XML output and save it in the file.xml file.

Author


  • Patrik Karlsson

References


See Also


Visit Nmap NSE Library for more scripts.

The unusual-port.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.

t check if we don


Here is a relevant code snippet related to the "t check if we don" error message:

29:	
30:	portrule = function()
31:	  local status
32:	  status, svc_table = datafiles.parse_services()
33:	  if not status then
34:	    return false --Can't check if we don't have a table!
35:	  end
36:	  return true
37:	end
38:	
39:	hostrule = function() return true end

WARNING: this script depends on Nmap's service/version detection (-sV)


Here is a relevant code snippet related to the "WARNING: this script depends on Nmap's service/version detection (-sV)" error message:

56:	  end
57:	
58:	  -- if no version scan has been run, warn the user as the script requires a
59:	  -- version scan in order to work.
60:	  if ( not(is_version_scan) ) then
61:	    return stdnse.format_output(true, "WARNING: this script depends on Nmap's service/version detection (-sV)")
62:	  end
63:	
64:	end
65:	
66:	portchecks = {

Version


This page has been created based on Nmap version 7.92.

Go back to menu.