File banner
Download: http://nmap.org/svn/scripts/banner.nse
User Summary
A simple banner grabber which connects to an open TCP port and prints out anything sent by the listening service within five seconds.
The banner will be truncated to fit into a single line, but an extra line may be printed for every increase in the level of verbosity requested on the command line.
Script Output
21/tcp open ftp |_ banner: 220 FTP version 1.0\x0D\x0A
Requires
author jah <jah at zadkiel.plus.com>
copyright © See Nmap License: http://nmap.org/book/man-legal.html
Action
Portrule
Functions
| extra_output () | Returns a number for each level of verbosity specified on the command line. |
| get_timeout () | Returns a number of milliseconds for use as a socket timeout value (defaults to 5 seconds). |
| grab_banner (host, port) | Connects to the target on the given port and returns any data issued by a listening service. |
| output (out) | Formats the banner for printing to the port script result. |
| replace_nonprint (s, len) | Replaces characters with ASCII values outside of the range of standard printable characters (decimal 32 to 126 inclusive) with hex encoded equivalents. |
Functions
- extra_output ()
-
Returns a number for each level of verbosity specified on the command line.
Ignores level increases resulting from debugging level.
Return value:
Number - get_timeout ()
-
Returns a number of milliseconds for use as a socket timeout value (defaults to 5 seconds).
Return value:
Number of milliseconds. - grab_banner (host, port)
-
Connects to the target on the given port and returns any data issued by a listening service.
Parameters
- host: Host Table.
- port: Port Table.
Return value:
String or nil if data was not received. - output (out)
-
Formats the banner for printing to the port script result.
Non-printable characters are hex encoded and the banner is then truncated to fit into the number of lines of output desired.
Parameters
- out: String banner issued by a listening service.
Return value:
String formatted for output. - replace_nonprint (s, len)
-
Replaces characters with ASCII values outside of the range of standard printable characters (decimal 32 to 126 inclusive) with hex encoded equivalents.
The second parameter dictates the number of characters to return, however, if the last character before the number is reached is one that needs replacing then up to three characters more than this number may be returned. If the second parameter is nil, no limit is applied to the number of characters that may be returned.
Parameters
- s: String on which to perform substitutions.
- len: Number of characters to return.
Return value:
String.




