Let's briefly review some of the most common libraries that you will likely need during the development of your own scripts. There are 107 available libraries at the moment, but the following libraries must be remembered at all times when developing your own scripts in order to improve their quality.
This library contains miscellaneous functions useful for NSE development. It has functions related to timing, parallelism, output formatting, and string handling.
The functions that you will most likely need in a script are as follows:
stdnse.get_script_args
: This gets script arguments passed via the--script-args
option:local threads = stdnse.get_script_args(SCRIPT_NAME..".threads") or 3
stdnse.debug
: This prints a debug message:stdnse.debug2("This is a debug message shown for debugging level 2 or higher")
stdnse.verbose
: This prints a formatted verbosity message:stdnse.verbose1("not running for lack of privileges.")