473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Parse nmap XML output using tinyxml

The following is the nmap xml output. Can someone help me to parse it using tinyxml library.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE nmaprun>
  3. <?xml-stylesheet href="file:///C:/Program Files (x86)/Nmap/nmap.xsl" type="text/xsl"?>
  4. <!-- Nmap 7.40 scan initiated Thu Mar 16 11:09:08 2017 as: nmap -oX opt.xml -v -sS -O -pT:80,22 192.16.112.27 -->
  5. <nmaprun scanner="nmap" args="nmap -oX opt.xml -v -sS -O -pT:80,22 192.16.112.27" start="1489642748" startstr="Thu Mar 16 11:09:08 2017" version="7.40" xmloutputversion="1.04">
  6. <scaninfo type="syn" protocol="tcp" numservices="2" services="22,80"/>
  7. <verbose level="1"/>
  8. <debugging level="0"/>
  9. <taskbegin task="Ping Scan" time="1489642748"/>
  10. <taskend task="Ping Scan" time="1489642748" extrainfo="1 total hosts"/>
  11. <taskbegin task="Parallel DNS resolution of 1 host." time="1489642748"/>
  12. <taskend task="Parallel DNS resolution of 1 host." time="1489642748"/>
  13. <taskbegin task="SYN Stealth Scan" time="1489642748"/>
  14. <taskend task="SYN Stealth Scan" time="1489642748" extrainfo="2 total ports"/>
  15. <host starttime="1489642748" endtime="1489642750"><status state="up" reason="echo-reply" reason_ttl="63"/>
  16. <address addr="192.16.112.27" addrtype="ipv4"/>
  17. <hostnames>
  18. </hostnames>
  19. <ports><port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="63"/><service name="ssh" method="table" conf="3"/></port>
  20. <port protocol="tcp" portid="80"><state state="closed" reason="reset" reason_ttl="63"/><service name="http" method="table" conf="3"/></port>
  21. </ports>
  22. <os><portused state="open" proto="tcp" portid="22"/>
  23. <portused state="closed" proto="tcp" portid="80"/>
  24. <portused state="closed" proto="udp" portid="35303"/>
  25. <osmatch name="Apple Mac OS X 10.7.0 (Lion) - 10.11 (El Capitan) or iOS 4.1 - 9.3.3 (Darwin 10.0.0 - 15.6.0)" accuracy="100" line="6233">
  26. <osclass type="general purpose" vendor="Apple" osfamily="Mac OS X" osgen="10.7.X" accuracy="100"><cpe>cpe:/o:apple:mac_os_x:10.7</cpe></osclass>
  27. <osclass type="general purpose" vendor="Apple" osfamily="OS X" osgen="10.8.X" accuracy="100"><cpe>cpe:/o:apple:mac_os_x:10.8</cpe></osclass>
  28. <osclass type="general purpose" vendor="Apple" osfamily="OS X" osgen="10.9.X" accuracy="100"><cpe>cpe:/o:apple:mac_os_x:10.9</cpe></osclass>
  29. <osclass type="general purpose" vendor="Apple" osfamily="OS X" osgen="10.10.X" accuracy="100"><cpe>cpe:/o:apple:mac_os_x:10.10</cpe></osclass>
  30. <osclass type="general purpose" vendor="Apple" osfamily="OS X" osgen="10.11.X" accuracy="100"><cpe>cpe:/o:apple:mac_os_x:10.11</cpe></osclass>
  31. <osclass type="media device" vendor="Apple" osfamily="iOS" osgen="4.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:4</cpe><cpe>cpe:/a:apple:apple_tv:4</cpe></osclass>
  32. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="4.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:4</cpe></osclass>
  33. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="5.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:5</cpe></osclass>
  34. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="6.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:6</cpe></osclass>
  35. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="7.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:7</cpe></osclass>
  36. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="8.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:8</cpe></osclass>
  37. <osclass type="phone" vendor="Apple" osfamily="iOS" osgen="9.X" accuracy="100"><cpe>cpe:/o:apple:iphone_os:9</cpe></osclass>
  38. </osmatch>
  39. </os>
  40. <uptime seconds="3410036" lastboot="Sat Feb 04 23:55:14 2017"/>
  41. <distance value="2"/>
  42. <tcpsequence index="256" difficulty="Good luck!" values="B5EF23AF,CD041F8E,81EBD9FE,E469975C,94BA072B,C9470524"/>
  43. <ipidsequence class="Randomized" values="5EC0,5EA7,DB6F,CD28,7415,7D9A"/>
  44. <tcptssequence class="1000HZ" values="CB410263,CB4102C6,CB410329,CB410398,CB4103FC,CB41045F"/>
  45. <times srtt="2217" rttvar="1576" to="100000"/>
  46. </host>
  47. <runstats><finished time="1489642750" timestr="Thu Mar 16 11:09:10 2017" elapsed="2.42" summary="Nmap done at Thu Mar 16 11:09:10 2017; 1 IP address (1 host up) scanned in 2.42 seconds" exit="success"/><hosts up="1" down="0" total="1"/>
  48. </runstats>
  49. </nmaprun>
  50.  
Thanks,
Arnav
Mar 28 '17 #1
0 1132

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Prasad Dabak | last post by:
Hello, I have a legacy unmanaged application that returns property=value pairs separated by chr(252)and I am trying to parse this output from C# using string.split method. This works fine as...
1
by: Daniel | last post by:
how to parse xsl:output ... with xpath? "./xsl:output" does not work. is there other notation for this?
0
by: nithyasri | last post by:
How to Parse Xml schema using .NET and get an object model? I need to parse an Xml schema and display it as a tree structure in dot net. How do i do it? Any help will be appreciated.
0
Meetee
by: Meetee | last post by:
Hi.. I have created an XML file which contains username and password. I want to parse this XML file so that username and password can be stored in database. I am using TinyXML and want to parse...
4
by: ohaqqi | last post by:
Hi everybody. I haven't programmed anything in about 8 years, I've read up a little bit on C and need to write a shell in C. I want to use strtok() to take an input from a user and parse it into the...
9
by: abhishekltil | last post by:
hello, can you please help me in reading this sample xml using tinyxml library. <?xml version="1.0" encoding="ISO-8859-1"?> <Configuration> <Parameter name="loglevel" value="3"/>...
1
by: dragrid | last post by:
would like to read and parse certain fields from multiple lines ( say lines 5 and 9 and the first and sixth fields respectively) from the variable of the file the command output created tried this...
0
by: modykun | last post by:
Reading an XML here is a must for my need I have to say though that i don't have any previous XML experience , so I'm not sure how to make it read it I'm using TinyXML , because i need fast code...
0
by: bogusbonafide | last post by:
I have written the following classes to generate an XML which is as below: <JBEToOverseerRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.