verinec.importer.analysis
Class PortDescriptor

java.lang.Object
  extended by verinec.importer.analysis.PortDescriptor

public class PortDescriptor
extends Object

A descriptor for each port number on a host. The HostCommRenderer keeps a mapping of port numbers and PortDescriptors It contains the number of packets sent and received, and an XML element for the service running on that port as described by the generic-service element of node.xsd

Author:
Patrick Aebischer, David Buchmann

Field Summary
private  String Description
           
private  int packetCount
          Number of packets for that port in sniffing phase.
private  Element portXML
           
 
Constructor Summary
PortDescriptor(String protocol, int portid, String state)
          Create a minimalistic port description.
 
Method Summary
 int getCount()
          Fetch the packet counter.
 Element getPortXML()
          Fetch the service description.
 void incrementCounter()
          Increment the packet counter (packets sent to this port).
 void setPortFromNmap(Element nmapPort)
          Convert an nmap port element to the node.xsd schema generic-service.
 void setPortXML(Element portXML)
          Set the service description element of the service running on this portnumber.
 String toString()
          Retruns a String containing the number and the description of the ports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

packetCount

private int packetCount
Number of packets for that port in sniffing phase.


portXML

private Element portXML

Description

private String Description
Constructor Detail

PortDescriptor

public PortDescriptor(String protocol,
                      int portid,
                      String state)
Create a minimalistic port description.

Parameters:
protocol - The protocol running on this port. One of tcp, udp or ip.
portid - The port number.
state - The port state (nmap values)
Method Detail

setPortXML

public void setPortXML(Element portXML)
Set the service description element of the service running on this portnumber.

Parameters:
portXML - A generic-service element as in node.xsd.

setPortFromNmap

public void setPortFromNmap(Element nmapPort)
Convert an nmap port element to the node.xsd schema generic-service. nmap does not use namespaces, while the node representation will be in the node namespace.

Parameters:
nmapPort - Nmap XML output port element.

getPortXML

public Element getPortXML()
Fetch the service description.

Returns:
generic-service element as in node.xsd

incrementCounter

public void incrementCounter()
Increment the packet counter (packets sent to this port).


getCount

public int getCount()
Fetch the packet counter.

Returns:
Number of Packets used over this port.

toString

public String toString()
Retruns a String containing the number and the description of the ports.

Overrides:
toString in class Object
Returns:
The above string.

Copyright © 2005 Verinec, DIUF