--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: Holds the raw XML output from Nmap
  name: rawxml
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: Session object for this scan
  name: session
  rw: R
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: new
- !ruby/object:RI::MethodSummary 
  name: parsefile
- !ruby/object:RI::MethodSummary 
  name: parseread
- !ruby/object:RI::MethodSummary 
  name: parsescan
- !ruby/object:RI::MethodSummary 
  name: parsestring
comment: 
- !ruby/struct:SM::Flow::H 
  level: 2
  text: What Is This Library For?
- !ruby/struct:SM::Flow::P 
  body: This library provides a Ruby interface to Nmap's scan data. It can run Nmap and parse its XML output directly from the scan, parse a file containing the XML data from a separate scan, parse a String of XML data from a scan, or parse XML data from an object via its read() method. This information is presented in an easy-to-use and intuitive fashion for storage and manipulation.
- !ruby/struct:SM::Flow::P 
  body: Keep in mind that this is not just some Ruby port of Anthony Persaud's Perl Nmap::Parser! There are more classes, many different methods, and blocks are extensively available.
- !ruby/struct:SM::Flow::P 
  body: The Nmap Security Scanner is an awesome program written and maintained by Fyodor &lt;fyodor@insecure.org&gt;. Its main function is port scanning, but it also has service and operating system detection, its own scripting engine and a whole lot more. One of its many available output formats is XML, which allows machines to handle all of the information instead of us slowly sifting through tons of output.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Conventions
- !ruby/struct:SM::Flow::P 
  body: "Depending on the data type, unavailable information is presented differently:"
- !ruby/struct:SM::Flow::VERB 
  body: "  - Arrays are empty\n  - Non-arrays are nil, unless it's a method that returns the size of one of\n    the previously mentioned empty arrays.  In this case they still return the\n    size (which would be 0).\n"
- !ruby/struct:SM::Flow::P 
  body: All information available as arrays are presented via methods. These methods not only return the array, but they also yield each element to a block if one is given.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Module Hierarchy
- !ruby/struct:SM::Flow::VERB 
  body: "  Nmap::Parser\n  |\n  + Session           &lt;- Scan session information\n  |\n  + Host              &lt;- General host information\n    |\n    + ExtraPorts      &lt;- Ports consolidated in an &quot;ignored&quot; state\n    |\n    + Port            &lt;- General port information\n    | |\n    | + Service       &lt;- Port Service information\n    |\n    + Script          &lt;- NSE Script information (both host and port)\n    |\n    + Times           &lt;- Timimg information (round-trip time, etc)\n    |\n    + Traceroute      &lt;- General Traceroute information\n    | |\n    | + Hop           &lt;- Individual Hop information\n    |\n    + OS              &lt;- OS Detection information\n      |\n      + OSClass       &lt;- OS Class information\n      |\n      + OSMatch       &lt;- OS Match information\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Parsing XML Data Already Available
- !ruby/struct:SM::Flow::VERB 
  body: "        require 'nmap/parser'\n\n        parser = Nmap::Parser.parsestring(xml) # String of XML\n        parser = Nmap::Parser.new(xml) # Same thing\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Reading and Parsing from a File
- !ruby/struct:SM::Flow::VERB 
  body: "        require 'nmap/parser'\n\n        parser = Nmap::Parser.parsefile(&quot;log.xml&quot;)\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Reading and Parsing from an Object
- !ruby/struct:SM::Flow::P 
  body: This method can read from any object that responds to a read() method that returns a String.
- !ruby/struct:SM::Flow::VERB 
  body: "        require 'nmap/parser'\n\n        parser = Nmap::Parser.parseread($stdin)\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Scanning and Parsing
- !ruby/struct:SM::Flow::P 
  body: This is the only Parser method that requires Nmap to be available.
- !ruby/struct:SM::Flow::VERB 
  body: "        require 'nmap/parser'\n\n        parser = Nmap::Parser.parsescan(&quot;sudo nmap&quot;, &quot;-sVC 192.168.1.0/24&quot;)\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Actually Doing Something
- !ruby/struct:SM::Flow::P 
  body: After printing a little session information, this example will cycle through all of the up hosts, printing state and service information on the open TCP ports. See the examples directory that comes with this library for more examples.
- !ruby/struct:SM::Flow::VERB 
  body: "        puts &quot;Nmap args: #{parser.session.scan_args}&quot;\n        puts &quot;Runtime: #{parser.session.scan_time} seconds&quot;\n        puts\n\n        parser.hosts(&quot;up&quot;) do |host|\n                puts &quot;#{host.addr} is up:&quot;\n                puts\n\n                host.tcp_ports(&quot;open&quot;) do |port|\n                        srv = port.service\n\n                        puts &quot;Port ##{port.num}/tcp is open (#{port.reason})&quot;\n                        puts &quot;\\tService: #{srv.name}&quot; if srv.name\n                        puts &quot;\\tProduct: #{srv.product}&quot; if srv.product\n                        puts &quot;\\tVersion: #{srv.version}&quot; if srv.version\n                        puts\n                end\n\n                puts\n        end\n"
constants: []

full_name: Nmap::Parser
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: ==
- !ruby/object:RI::MethodSummary 
  name: del_host
- !ruby/object:RI::MethodSummary 
  name: delete_host
- !ruby/object:RI::MethodSummary 
  name: get_host
- !ruby/object:RI::MethodSummary 
  name: get_ips
- !ruby/object:RI::MethodSummary 
  name: host
- !ruby/object:RI::MethodSummary 
  name: hosts
name: Parser
superclass: Object
