Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
XMLStarlet command to convert Nmap's XML output to JSON. (Works on portrule scripts)
xmlstarlet sel -t -m "//host/ports/port/script" -o "{ip:'" -v "ancestor::host/address[@addrtype='ipv4']/@addr" -o "', hostname:'" -v "concat(ancestor::host/hostnames/hostname/@name,'')" -o "', proto:'" -v "../@protocol" -o "', port:" -v "../@portid" -o ", service:'" -v "../service/@name" -o "', script:'" -v "@id" -o "', script-output:'" -v "@output" -o "'}" -n <XML INPUT FILE>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.