Debugging messages can be included in NSE scripts using the
debug() function from the
stdnse library. These messages are shown only when the debugging level has been set to a value higher than
Debug(level, fmt, …) where level: Debugging level. fmt: Format string. …: Format arguments.
To print a debug message when the debugging level is
1 or higher, we use the following code:
stdnse.debug(1, "Task #%d completed.", id)
The idea behind supporting this function is that we can do things such as printing different levels of information without having to write nested code:
stdnse.debug(1, "Response #%d received.", i) stdnse.debug(2, "Response status code: %d", req.status) stdnse.debug(3, "Response body:", req.body)
It is ...