Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from xml.dom import minidom
- xmldoc = minidom.parse("aula.xml")
- hosts = xmldoc.getElementsByTagName("host")
- for host in hosts:
- address = host.getElementByTag("address")
- ip = address.attributes["addr"]
- IP = ip.value
- print("IP:%s"%(IP))
- Traceback (most recent call last):
- File "simple.py", line 8, in <module>
- address = host.getElementByTag("address")
- AttributeError: Element instance has no attribute 'getElementByTag'
- <?xml version="1.0"?>
- <!DOCTYPE nmaprun>
- <?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
- <!-- Nmap 6.47 scan initiated Thu Feb 26 11:38:24 2015 as: nmap -oX aula.xml x.x.x.x/26 -->
- <nmaprun scanner="nmap" args="nmap -oX aula.xml x.x.x.x/26" start="1424947104" startstr="Thu Feb 26 11:38:24 2015" version="6.47" xmloutputversion="1.04">
- <scaninfo type="connect" protocol="tcp" numservices="1000" services="a lot of numbers"/>
- <verbose level="0"/>
- <debugging level="0"/>
- <host starttime="1424947104" endtime="1424947111"><status state="up" reason="conn-refused" reason_ttl="0"/>
- <address addr="x.x.x.x" addrtype="ipv4"/>
- <hostnames>
- </hostnames>
- <ports>
- <extraports state="closed" count="998">
- <extrareasons reason="conn-refused" count="998"/>
- </extraports>
- <port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="ssh" method="table" conf="3"/></port>
- <port protocol="tcp" portid="111"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="rpcbind" method="table" conf="3"/></port>
- </ports>
- <times srtt="1280" rttvar="264" to="100000"/>
- </host>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement