verinec.importer.analysis.sniffer
Class StartSniffer

java.lang.Object
  extended by verinec.importer.analysis.AAnalyserStartOperation
      extended by verinec.importer.analysis.sniffer.StartSniffer
All Implemented Interfaces:
IOperation

public class StartSniffer
extends AAnalyserStartOperation

The StartSniffer controls the jpcap instances on the devices.

The creator instantiates a new SnifferThread thread for each active interface configured to sniff.
Contrary to scanner and traceroute with their limited number of worker threads, sniffing is done with one thread for each interface.
The sniff method starts the sniffing threads, waits for them to finish and does the cleanup afterwards. It informs the ConfigPanel of having finished.

If no active interfaces are found, nothing will be done. (Sniffing is finished immediately.)

Author:
Patrick Aebischer, david.buchmann at unifr.ch, martial.seifriz at unifr.ch
See Also:
SnifferThread

Nested Class Summary
static class StartSniffer.ConfigPanel
          Configuration for the sniffer.
 
Field Summary
private  Logger logger
          The logger for this object
 
Fields inherited from class verinec.importer.analysis.AAnalyserStartOperation
analyser
 
Constructor Summary
StartSniffer(StartSniffer.ConfigPanel conf, AnalysisThread a)
          Create the Sniffer for each interface.
 
Method Summary
protected  HostCommRenderer addToResult(String ip, String mac)
          Add a host to the result structure.
 void sniff()
          Start all sniffer threads and waits for them to finish.
protected static boolean testAccessRights()
          This method tests if the user has sufficent rights for capturing, that is if he can set the device into promiscious mode.
 void updateState(int id)
          Update the actual state of a SnifferThread and send this information to the AnalysisThread
 
Methods inherited from class verinec.importer.analysis.AAnalyserStartOperation
abortOperation, getThread, joinThreads, printMessage, setThread, startThreads
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private Logger logger
The logger for this object

Constructor Detail

StartSniffer

public StartSniffer(StartSniffer.ConfigPanel conf,
                    AnalysisThread a)
Create the Sniffer for each interface.

Currently, we also sniff on the local interface, which is a bit problematic if we sniff for a number of packets: They may not arrive as fast as for the other interfaces.

Parameters:
conf - The configuration dialog with the configutation of the devices.
a - The analysis information to get and create host information.
Method Detail

sniff

public void sniff()
Start all sniffer threads and waits for them to finish.


addToResult

protected HostCommRenderer addToResult(String ip,
                                       String mac)
Add a host to the result structure.

Parameters:
ip - the ip of the host
mac - the mac address of the host
Returns:
a HostCommRenderer Object which contains all informations

testAccessRights

protected static boolean testAccessRights()
This method tests if the user has sufficent rights for capturing, that is if he can set the device into promiscious mode. todo: we could do this on a per-device basis.

Returns:
True if user has admin rights.

updateState

public void updateState(int id)
Update the actual state of a SnifferThread and send this information to the AnalysisThread

Parameters:
id - the identifier of the SnifferThread which calls this method

Copyright © 2005 Verinec, DIUF