Examples of version detection scripts

Now we will briefly cover a few examples of different NSE version scripts to familiarize ourselves with the structure and required components.

NSE script – modbus-discover

The modbus-discover script was written by Alexander Rudakov to retrieve device information through the modbus protocol. Modbus is very popular among Supervisory Control And Data Acquisition (SCADA) systems. The script attempts to discover valid Slave IDs (SIDs) and retrieve additional device information:

action = function(host, port) -- If false, stop after first sid. local aggressive = stdnse.get_script_args('modbus-discover.aggressive') local opts = {timeout=2000} local results = {} for sid = 1, 246 do stdnse.print_debug(3, "Sending command ...

Get Mastering the Nmap Scripting Engine now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.