- Nmap::Parser.new() now no longer
accepts a string to parse, but rather a hash of options (more on this
below). new() of course returns a new Parser object, but now after you have
the object you call instance parsing methods such as parsescan() or
parsefile() to do the work. All of the class methods which previously
existed are still available; they’re just wrappers around new() and
the instance methods now.
- Switched from parsing the XML using the tree-style approach to using a
stream approach. It was kind of a pain in the ass setting up the
“listener” class and associated helper structures since
I’ve never done it before, but it was all well worth it to help speed
things up. I’m still using REXML instead of something I’ve
heard to be much faster (e.g. libxml) because I think a big determining
factor on what to use is its availability. REXML has come in Ruby’s
standard library since 1.8.
- You can now parse using callbacks. Tell Parser what method or proc you want
to use like this:
Nmap::Parser.new(:callback => mymeth)
Now as soon as a new Host object is created (which happens a lot faster now
thanks to the stream-style XML parsing), it will be passed to your callback
much like this:
mymeth.call(newhostobj)
The callback is run in a new thread.
- Added support for the SCTP scanning capabilities Nmap newly acquired.
- Added getport(), getports() and getportlist() methods to ::Host. The first
argument can be symbol specifying the desired protocol to use (:tcp, :udp,
:sctp or :ip), and the rest is the same as the corresponding method, e.g.
getports(:tcp, 'open')
is the same as
tcp_ports('open')
getports() also supports an :any type to give matching ports from all
protocols. I want to thank Tom Sellers (nmap(a)fadedcode.net) for
discussing this latter aspect with me as he had the general idea for this
functionality but just a different design in mind.
The first argument can also be an array of symbols specifying the protocols
to use, such as [:tcp, :udp].
- Added numhosts() to ::Session, which currently returns the number of up,
down or total hosts scanned. This can be very different from calling things
like hosts.size or get_ips.size in Parser because Nmap usually won’t list all of the individual
hosts that it doesn’t know or assume to be up (unless, for example,
you’re doing a ping or list scan).
- Added a + operator to Nmap::Parser to return
a new Parser object containing hosts from both operands (but no duplicates
from the second, as determined by host.addr info). rawxml and session are
both nil in the new object. The new combination? method is provided to
return a boolean value depending on whether or not the current object is
just a combination of others.
- Added exit and errormsg to ::Session for the new XML attributes. The former
specifies if Nmap exited successfully
(“success”) or in error (“error”), and if
applicable, in the latter provides the error message.
- Added version constants to Parser:
Major - Major version number (currently 0)
Minor - Minor version number (currently 3)
Teeny - Teeny version number (currently 5)
Stage - Development stage ("release" or "dev", currently the former)
Version - Pre-built string in the form Major.Minor.Teeny
- Fixed some methods in ::OS which could have lead to an exception if given
an invalid index.
- Fixed get_ips() in ::Parser which was broken and would end up generating an
ArgumentError.
- Have scan_time in ::Session take on (stop_time-start_time).to_f (which was
its original value) if the “elapsed” XML attribute isn’t
available. I added this attribute to Nmap, but I
was totally absent-minded here and completely neglected earlier versions.
Thanks to Dustin Webber (dustinw(a)aos5.com) for the report of 0.0 results.
- Fixed the tcpsequence_index Host attribute so that it’s an integer
instead of a string (from the XML parsing).
- Added proto to ::Port to hold the port protocol (e.g. “tcp”).
This is one of those simple things that just should’ve been in from
the start. Thanks to Tom Sellers (nmap(a)fadedcode.net) for the patch.
- Fixed the regex which looks for output options (-o*) in parsescan(); it was
matching things like the script name smb-os-discovery. Thanks to Russell
Fulton (r.fulton(a)auckland.ac.nz) for the report and fix.
- Instead of being quite so anal, the Parser now accepts XML not only as a
String but also as anything responding to to_str().
- Use /usr/bin/env in the shebang (#!) lines of the example scripts for some
improved portability. Thanks to Daniel Roethlisberger (daniel(a)roe.ch) for
noticing the problem and taking care of this.
- The mysterious and totally inconspicuously named :blinken key can also be
used in the new() option hash. :)
- Made a lot of internal implementation improvements, including (but most
definitely not limited to!) doing some metaprogramming.
- Added some unit tests, starting with test/test.ts.rb. The tests performed
now are messy and incomplete so far, but I originally wrote them nearly a
year ago and I think that it’s better than nothing. I hope to
eventually have unit tests covering every aspect of the parser, even all of
the little tedious things I was too lazy to write tests for before. Any
help writing tests would be much appreciated! :)
- Made many documentation improvements.
- Renamed this ChangeLog to ChangeLog.rdoc
and formatted it RDoc-style.