-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparse.py
26 lines (18 loc) · 884 Bytes
/
parse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#Author:Ciaran Strutt
#Date:09/02/2015
#Description:Reads masscan .xml file and outputs the host, port and banner. I wrote
#this at 5am so it was just a quick script to make masscans output easier to look at
from lxml import etree as elementTree
fileName = ""
fileName = raw_input("Enter filename: ")
treeData = elementTree.parse(fileName)
root = treeData.getroot();
for singleElement in root.iter("address","service","port","state"):
if singleElement.get("addr") != None:
print "IP: %s" % singleElement.get("addr")
if singleElement.get("portid") != None:
print "Port: %s" % singleElement.get("portid")
if singleElement.get("state") != None:
print "State: %s" % singleElement.get("state")
if singleElement.get("banner") != None:
print "Banner: %s" % singleElement.get("banner")