summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 0bfc8e9..3372883 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -31,12 +31,13 @@ using namespace Opie;
// Qt
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qspinbox.h>
+#include <qtoolbutton.h>
#include <qmainwindow.h>
// Standard
#include <assert.h>
#include <errno.h>
@@ -49,13 +50,13 @@ using namespace Opie;
#include "wellenreiter.h"
#include "scanlist.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "configwindow.h"
-
+#include "statwindow.h"
#include "manufacturers.h"
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
{
@@ -214,15 +215,14 @@ void Wellenreiter::receivePacket(OPacket* p)
wlan->macAddress3().toString() );
}
return;
}
}
-void Wellenreiter::startStopClicked()
-{
- if ( sniffing )
+
+void Wellenreiter::stopClicked()
{
disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
iface->setChannelHopping(); // stop hopping channels
pcap->close();
sniffing = false;
@@ -246,15 +246,38 @@ void Wellenreiter::startStopClicked()
logwindow->log( "(i) Stopped Scanning." );
assert( parent() );
( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" );
// message the user
QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
+
+ sniffing = false;
+ emit( stoppedSniffing() );
+
+ // print out statistics
+ statwindow->log( "-----------------------------------------" );
+ statwindow->log( "- Wellenreiter II Capturing Statistic -" );
+ statwindow->log( "-----------------------------------------" );
+ statwindow->log( "Packet Type | Receive Count" );
+
+ for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
+ {
+ QString left;
+ left.sprintf( "%s", (const char*) it.key() );
+ left = left.leftJustify( 20 );
+ left.append( '|' );
+ QString right;
+ right.sprintf( "%d", it.data() );
+ right = right.rightJustify( 7 );
+ statwindow->log( left + right );
}
- else
+}
+
+
+void Wellenreiter::startClicked()
{
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
const int cardtype = configwindow->daemonDeviceType();
const int interval = configwindow->daemonHopInterval();
@@ -275,15 +298,17 @@ void Wellenreiter::startStopClicked()
switch ( cardtype )
{
case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
- default: assert( 0 ); // shouldn't happen
+ default:
+ QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." );
}
+ if ( cardtype > 0 && cardtype < 5 )
iface->setMonitorMode( true );
if ( !iface->monitorMode() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
return;
@@ -307,9 +332,8 @@ void Wellenreiter::startStopClicked()
// connect
connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
logwindow->log( "(i) Started Scanning." );
sniffing = true;
-
- }
+ emit( startedSniffing() );
}