Debugging NSE scripts

To debug NSE scripts, use --script-trace. This enables a stack trace of the executed script to help you debug the script execution. Remember that sometimes you may need to increase the debugging level with the -d[1-9] flag to get to the bottom of the problem:

$ nmap -sC --script-trace <target>$ nmap --script http-headers --script-trace scanme.nmap.org    NSOCK INFO [18.7370s] nsock_trace_handler_callback(): Callback:      CONNECT SUCCESS for EID 8 [45.33.32.156:80]    NSE: TCP 192.168.0.5:47478 > 45.33.32.156:80 | CONNECT    NSE: TCP 192.168.0.5:47478 > 45.33.32.156:80 | 00000000:    48 45 41 44 20 2f 20 48 54 54 50 2f 31 2e 31 0d HEAD / HTTP/1.1     00000010: 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 63 6c 6f        Connection: clo  00000020: ...

Get Nmap: Network Exploration and Security Auditing Cookbook - Second Edition 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.