Nmap Development mailing list archives

Measuring nmap script runtimes


From: fabmap via dev <dev () nmap org>
Date: Mon, 14 May 2018 12:08:46 -0400

Dear all,

to further optimize the runtime of nmap invocations I choose to run only a list of selected scripts (by doing a 
superficial review and skipping any script having a too generic portrule or performing a surpising amount of requests).
However, this method is more intuition than data-driven and I would like to gain more insights into the actual runtime 
of scripts to evaluate their cost-benefit ratio and easily spot scripts that could use some optimization.

I was thinking about two approaches to accomplish this:
- Profiling: Periodically get the status of running scripts (which can also be gathered when pressing any key in -d2). 
Store how often each script has appeared.
- Tracing: Easiest option might be to augment the "NSE: Finished X against Y" output with timestamps and do 
post-processing, alternatively store start and end times for each script invocation.

It would also be great to gather information about other metrics than runtime such as bytes sent/received (or how much 
of the runtime was spent processing/waiting). I see some traffic data in higher debug levels. Is this data already 
associated with specific scripts?

Has something like this been done/tried before or is it maybe already possible? Can anyone with more knowledge of the 
codebase comment on how difficult this task seems and which of the approaches makes more sense?

Thanks a lot,
- fab
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: