Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. from xml.dom import minidom
  2.  
  3. xmldoc = minidom.parse("aula.xml")
  4.  
  5. hosts = xmldoc.getElementsByTagName("host")
  6.  
  7. for host in hosts:
  8. address = host.getElementByTag("address")
  9. ip = address.attributes["addr"]
  10. IP = ip.value
  11. print("IP:%s"%(IP))
  12.  
  13. Traceback (most recent call last):
  14. File "simple.py", line 8, in <module>
  15. address = host.getElementByTag("address")
  16. AttributeError: Element instance has no attribute 'getElementByTag'
  17.  
  18. <?xml version="1.0"?>
  19. <!DOCTYPE nmaprun>
  20. <?xml-stylesheet href="file:///usr/local/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
  21. <!-- Nmap 6.47 scan initiated Thu Feb 26 11:38:24 2015 as: nmap -oX aula.xml x.x.x.x/26 -->
  22. <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">
  23. <scaninfo type="connect" protocol="tcp" numservices="1000" services="a lot of numbers"/>
  24. <verbose level="0"/>
  25. <debugging level="0"/>
  26. <host starttime="1424947104" endtime="1424947111"><status state="up" reason="conn-refused" reason_ttl="0"/>
  27. <address addr="x.x.x.x" addrtype="ipv4"/>
  28. <hostnames>
  29. </hostnames>
  30. <ports>
  31. <extraports state="closed" count="998">
  32. <extrareasons reason="conn-refused" count="998"/>
  33. </extraports>
  34. <port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="ssh" method="table" conf="3"/></port>
  35. <port protocol="tcp" portid="111"><state state="open" reason="syn-ack" reason_ttl="0"/><service name="rpcbind" method="table" conf="3"/></port>
  36. </ports>
  37. <times srtt="1280" rttvar="264" to="100000"/>
  38. </host>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement