net.spy.nmap
Class NmapParser

java.lang.Object
  extended bynet.spy.nmap.NmapParser

public class NmapParser
extends Object

NMAP log parser. After creating an nmap machine parseable log, you can parse the log like this:

 NmapParser np = new NmapParser("/path/to/log/file");

 for(Enumeration e = p.entries(); e.hasMoreElements(); ) {
 	NmapEntry ne = (NmapEntry)e.nextElement();
 	System.out.println(ne);
 }
 

NOTE: That's not a very useful example, please read the rest of the documentation and play around before complaining.


Constructor Summary
NmapParser(String inputFile)
          Construct an NmapParser object to parse a given text file.
 
Method Summary
 Enumeration entries()
          gets an enumeration of all of the entries.
 NmapEntry entry(String ip)
          gets an NmapEntry for a specific IP address
 Vector listeningOn(int port)
          gets a list of NmapEntries for hosts listening on a given port.
static void main(String[] args)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NmapParser

public NmapParser(String inputFile)
           throws IOException
Construct an NmapParser object to parse a given text file.

Parameters:
inputFile - the path to a machine readable NMAP log file.
Throws:
IOException - if an error occurs while opening or reading the log file.
Method Detail

entries

public Enumeration entries()
gets an enumeration of all of the entries.


entry

public NmapEntry entry(String ip)
gets an NmapEntry for a specific IP address

Parameters:
ip - IP address to look up
Returns:
specified NmapEntry, or null if no such entry exists

listeningOn

public Vector listeningOn(int port)
gets a list of NmapEntries for hosts listening on a given port.

Parameters:
port - port number we're looking for

toString

public String toString()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception