I'm finishing an Nmap script that needs to create a file as part of the output (an image) which doesn't make sense to print or embed in the standard Nmap output. Currently I'm naming the output image.jpg, but I'd like use the input of the -oA/-oN/-oX/-oS/-oG flag to make the name of the output file less likely to conflict with anything in the current directory.

I've done some digging but I haven't found any way to access the flags passed to Nmap.

Is it possible to access these flags from inside an NSE, and if so, how?


There is not a way in the current NSE API to access that information. Most of the scripts that save output to files take a filename or target directory as a script-arg. I've just opened a new issue on Github to address this idea, so we'll see if we can improve this in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.