-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering the Nmap Scripting Engine
By :
When writing our own NSE scripts, we will use the API provided by Nmap to interact with the host and port database. To write a version script, we simply need to do the following:
Add your script to the category version.
Write the corresponding portrule.
Set the port version in our script after successful detection.
The first step is very straightforward. In your NSE script, add the category field as follows:
category = {"version"}The category field is actually a regular Lua table, so feel free to add more categories to your script if necessary.
The next important thing is to have a portrule matching the desired service. Keep in mind that we have function aliases that will help define these portrules, such as:
shortport.portnumber(port, protos, states)
shortport.version_port_or_service(ports, services, protos, states)
shortport.port_or_service(ports, services...
Change the font size
Change margin width
Change background colour