Skip to content

Instantly share code, notes, and snippets.

@wsummerhill
Created February 16, 2022 19:05
Show Gist options
  • Save wsummerhill/475425cc722946afc629cc6e7ead9fa9 to your computer and use it in GitHub Desktop.
Save wsummerhill/475425cc722946afc629cc6e7ead9fa9 to your computer and use it in GitHub Desktop.
Quick masscan parser to print output in format HOST:IP
#!/usr/bin/python3
import sys
from xml.dom import minidom
file = sys.argv[1]
xml = minidom.parse(file)
ips = xml.getElementsByTagName('address')
ports = xml.getElementsByTagName('port')
i = 0
for x in ips:
print(ips[i].attributes['addr'].value + ':' + ports[i].attributes['portid'].value)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment