verinec.importer.analysis
Class HostCommRenderer

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

public class HostCommRenderer
extends Object

Each host is stored as an HostCommRenderer object in a HashMap in the SnifferThread. In such an object the found information about a host will be stored. For each portnumber a new PortDescriptor will be used.

Author:
Patrick Aebischer, martial.seifriz at unifr.ch

Field Summary
private  Vector children
          The children of this host, form a tree view.
private  String hostName
           
private  String ipAddress
           
private  Logger log
           
private  String MACAddress
           
private  Vector neighbours
          The neightbours of this host, form a graph view.
private  String operatingSystem
          Textual information about the operating system to add into the node description.
private  HostCommRenderer parent
          The partent of this host, form a tree view.
private  HashMap portsMap
           
private  int xpos
           
private  int ypos
           
 
Constructor Summary
HostCommRenderer(String ipAddress, String HWA)
          Creates a new host renderer and tries to lookup host name using reverse DNS in a separate thread.
HostCommRenderer(String hostname, String ipAddress, String HWA)
          Creates a new host renderer with known host name.
 
Method Summary
 void addChild(HostCommRenderer child)
          Add a child to the host associated with this renderer
 void addNeighbour(HostCommRenderer neighbour)
          Add a neighbour of the host associated with this renderer.
 PortDescriptor createPortDescriptor(String protocol, int port, String state)
          Create a new PortDescriptor and add it to the host.
 HostCommRenderer getChild(int i)
          Fetch a specified child.
 HostCommRenderer getChild(String ip)
          Test if the host associated with this renderer has a specified child.
 int getChildCount()
          Fetch the number of childs of the host associated with this renderer.
 Vector getChildren()
          Fetch the childs, ie. this host is one step closer to the root than its childs.
 String getHostName()
          Fetch the name of the host associated with this renderer.
 String getIpAddress()
          Fetch the IP address of the host associated with this renderer.
 String getMACAdress()
          Fetch the MAC Address of the host associated with this renderer.
 Vector getNeighbours()
          Get the neighbours of the host associated with this renderer.
 HostCommRenderer getParent()
          Fetch the parent of the host associated with this renderer.
 PortDescriptor getPortDescriptor(int port)
          Fetch a PortDescriptor.
 int[] getPortsList()
          Fetch the used ports on this host.
 int getXpos()
          Fetch the x postion.
 int getYpos()
          Fetch the y position.
 boolean hasChild(String ip)
          Test if the host associated with this renderer has a specified child.
 void removeChild(HostCommRenderer child)
          Add a child to the host associated with this renderer
 void setChildren(Vector childs)
          Fetch the children of the host associated with this renderer.
 void setHostName(String hostName)
          Set the name of the host associated with this renderer.
 void setOperatingSystem(String os)
          Set the operating system.
 void setParent(HostCommRenderer parent)
          Set the partent of the host associated with this renderer.
 void setXPos(int x)
          Set the x position to hnow, where the node should be placed in the gui.
 void setYPos(int y)
          Set the y position to hnow, where the node should be placed in the gui.
 String toString()
          Convert this host renderer to a readable string.
 void updateNode(Element node)
          Add the scan result to a node xml tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ipAddress

private String ipAddress

hostName

private String hostName

operatingSystem

private String operatingSystem
Textual information about the operating system to add into the node description. Might be set during the scan process with setOperatingSystem(String).


MACAddress

private String MACAddress

portsMap

private HashMap portsMap

log

private Logger log

children

private Vector children
The children of this host, form a tree view. This is used to structure the output


neighbours

private Vector neighbours
The neightbours of this host, form a graph view. This vector contains all host, which are conneted to this one, but aren't childs or the parend of this root


parent

private HostCommRenderer parent
The partent of this host, form a tree view. This is used to structure the output


xpos

private int xpos

ypos

private int ypos
Constructor Detail

HostCommRenderer

public HostCommRenderer(String ipAddress,
                        String HWA)
Creates a new host renderer and tries to lookup host name using reverse DNS in a separate thread.

Parameters:
ipAddress - the ip address of the host
HWA - the hardware address (MAC) of the host

HostCommRenderer

public HostCommRenderer(String hostname,
                        String ipAddress,
                        String HWA)
Creates a new host renderer with known host name.

Parameters:
hostname - the host name without domain
ipAddress - The IP address in string notation: 123.231.132.213
HWA - Hardware (MAC) address
Method Detail

toString

public String toString()
Convert this host renderer to a readable string.

Overrides:
toString in class Object
Returns:
String of the HostCommRenderer.

getIpAddress

public String getIpAddress()
Fetch the IP address of the host associated with this renderer.

Returns:
IP adress as a string.

getHostName

public String getHostName()
Fetch the name of the host associated with this renderer.

Returns:
The host name.

getMACAdress

public String getMACAdress()
Fetch the MAC Address of the host associated with this renderer.

Returns:
The MAC adress as a string.

setHostName

public void setHostName(String hostName)
Set the name of the host associated with this renderer. This must be a valid TCP/IP host name, i.e. not an IP number.

Parameters:
hostName - The host name as a string.

setOperatingSystem

public void setOperatingSystem(String os)
Set the operating system.

Parameters:
os - Operating system.

getPortsList

public int[] getPortsList()
Fetch the used ports on this host.

Returns:
Array width port numbers.

getPortDescriptor

public PortDescriptor getPortDescriptor(int port)
Fetch a PortDescriptor. If this port has not yet been added, returns null.

Parameters:
port - Portnumber
Returns:
Descriptor for this port or null if not yet added.

createPortDescriptor

public PortDescriptor createPortDescriptor(String protocol,
                                           int port,
                                           String state)
Create a new PortDescriptor and add it to the host.

Parameters:
protocol - one of tcp, udp or ip
port - the tcp/udp portnumber
state - nmap state string for the port (open, closed, ...)
Returns:
The new PortDescriptor for this port

updateNode

public void updateNode(Element node)
Add the scan result to a node xml tree.

Parameters:
node - The XML of a node element, as returned by PCNode.

addChild

public void addChild(HostCommRenderer child)
Add a child to the host associated with this renderer

Parameters:
child - The child to add.

removeChild

public void removeChild(HostCommRenderer child)
Add a child to the host associated with this renderer

Parameters:
child - The child to add.

getChildren

public Vector getChildren()
Fetch the childs, ie. this host is one step closer to the root than its childs.

Returns:
The childs of the host associated with this renderer

getNeighbours

public Vector getNeighbours()
Get the neighbours of the host associated with this renderer.

Returns:
A vector, which contains the neighbours.

addNeighbour

public void addNeighbour(HostCommRenderer neighbour)
Add a neighbour of the host associated with this renderer.

Parameters:
neighbour - The host, which is a neighbour of the host associated with this renderer.

setParent

public void setParent(HostCommRenderer parent)
Set the partent of the host associated with this renderer. This means the host, which is one hop closer to the root.

Parameters:
parent - The parent node.

setChildren

public void setChildren(Vector childs)
Fetch the children of the host associated with this renderer. This is needed to place the nodes in the gui.

Parameters:
childs - A vector, which contains the HostCommRenderer objects of the childs.

getParent

public HostCommRenderer getParent()
Fetch the parent of the host associated with this renderer. This is needed to place the nodes in the gui.

Returns:
The HostCommRenderer of the parent.

setXPos

public void setXPos(int x)
Set the x position to hnow, where the node should be placed in the gui.

Parameters:
x - The x postion.

getXpos

public int getXpos()
Fetch the x postion.

Returns:
The x position.

setYPos

public void setYPos(int y)
Set the y position to hnow, where the node should be placed in the gui.

Parameters:
y - The y position.

getYpos

public int getYpos()
Fetch the y position.

Returns:
The y position

getChildCount

public int getChildCount()
Fetch the number of childs of the host associated with this renderer.

Returns:
Numer of childs

getChild

public HostCommRenderer getChild(int i)
Fetch a specified child.

Parameters:
i - The number, ie index, of the child
Returns:
The desired child

hasChild

public boolean hasChild(String ip)
Test if the host associated with this renderer has a specified child.

Parameters:
ip - The ip of the child.
Returns:
True if child was found, else false.

getChild

public HostCommRenderer getChild(String ip)
Test if the host associated with this renderer has a specified child.

Parameters:
ip - The ip of the child.
Returns:
True if child was found, else false.

Copyright © 2005 Verinec, DIUF