Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 40 |
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; | |||
31 | // Qt | 31 | // Qt |
32 | 32 | ||
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
37 | #include <qtoolbutton.h> | ||
37 | #include <qmainwindow.h> | 38 | #include <qmainwindow.h> |
38 | 39 | ||
39 | // Standard | 40 | // Standard |
40 | 41 | ||
41 | #include <assert.h> | 42 | #include <assert.h> |
42 | #include <errno.h> | 43 | #include <errno.h> |
@@ -49,13 +50,13 @@ using namespace Opie; | |||
49 | 50 | ||
50 | #include "wellenreiter.h" | 51 | #include "wellenreiter.h" |
51 | #include "scanlist.h" | 52 | #include "scanlist.h" |
52 | #include "logwindow.h" | 53 | #include "logwindow.h" |
53 | #include "hexwindow.h" | 54 | #include "hexwindow.h" |
54 | #include "configwindow.h" | 55 | #include "configwindow.h" |
55 | 56 | #include "statwindow.h" | |
56 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
57 | 58 | ||
58 | Wellenreiter::Wellenreiter( QWidget* parent ) | 59 | Wellenreiter::Wellenreiter( QWidget* parent ) |
59 | : WellenreiterBase( parent, 0, 0 ), | 60 | : WellenreiterBase( parent, 0, 0 ), |
60 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 61 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) |
61 | { | 62 | { |
@@ -214,15 +215,14 @@ void Wellenreiter::receivePacket(OPacket* p) | |||
214 | wlan->macAddress3().toString() ); | 215 | wlan->macAddress3().toString() ); |
215 | } | 216 | } |
216 | return; | 217 | return; |
217 | } | 218 | } |
218 | } | 219 | } |
219 | 220 | ||
220 | void Wellenreiter::startStopClicked() | 221 | |
221 | { | 222 | void Wellenreiter::stopClicked() |
222 | if ( sniffing ) | ||
223 | { | 223 | { |
224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 224 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 225 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
226 | iface->setChannelHopping(); // stop hopping channels | 226 | iface->setChannelHopping(); // stop hopping channels |
227 | pcap->close(); | 227 | pcap->close(); |
228 | sniffing = false; | 228 | sniffing = false; |
@@ -246,15 +246,38 @@ void Wellenreiter::startStopClicked() | |||
246 | logwindow->log( "(i) Stopped Scanning." ); | 246 | logwindow->log( "(i) Stopped Scanning." ); |
247 | assert( parent() ); | 247 | assert( parent() ); |
248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 248 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
249 | 249 | ||
250 | // message the user | 250 | // message the user |
251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | 251 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); |
252 | |||
253 | sniffing = false; | ||
254 | emit( stoppedSniffing() ); | ||
255 | |||
256 | // print out statistics | ||
257 | statwindow->log( "-----------------------------------------" ); | ||
258 | statwindow->log( "- Wellenreiter II Capturing Statistic -" ); | ||
259 | statwindow->log( "-----------------------------------------" ); | ||
260 | statwindow->log( "Packet Type | Receive Count" ); | ||
261 | |||
262 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | ||
263 | { | ||
264 | QString left; | ||
265 | left.sprintf( "%s", (const char*) it.key() ); | ||
266 | left = left.leftJustify( 20 ); | ||
267 | left.append( '|' ); | ||
268 | QString right; | ||
269 | right.sprintf( "%d", it.data() ); | ||
270 | right = right.rightJustify( 7 ); | ||
271 | statwindow->log( left + right ); | ||
252 | } | 272 | } |
253 | 273 | ||
254 | else | 274 | } |
275 | |||
276 | |||
277 | void Wellenreiter::startClicked() | ||
255 | { | 278 | { |
256 | // get configuration from config window | 279 | // get configuration from config window |
257 | 280 | ||
258 | const QString& interface = configwindow->interfaceName->currentText(); | 281 | const QString& interface = configwindow->interfaceName->currentText(); |
259 | const int cardtype = configwindow->daemonDeviceType(); | 282 | const int cardtype = configwindow->daemonDeviceType(); |
260 | const int interval = configwindow->daemonHopInterval(); | 283 | const int interval = configwindow->daemonHopInterval(); |
@@ -275,15 +298,17 @@ void Wellenreiter::startStopClicked() | |||
275 | switch ( cardtype ) | 298 | switch ( cardtype ) |
276 | { | 299 | { |
277 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | 300 | case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
278 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | 301 | case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
279 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | 302 | case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
280 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | 303 | case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; |
281 | default: assert( 0 ); // shouldn't happen | 304 | default: |
305 | QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); | ||
282 | } | 306 | } |
283 | 307 | ||
308 | if ( cardtype > 0 && cardtype < 5 ) | ||
284 | iface->setMonitorMode( true ); | 309 | iface->setMonitorMode( true ); |
285 | 310 | ||
286 | if ( !iface->monitorMode() ) | 311 | if ( !iface->monitorMode() ) |
287 | { | 312 | { |
288 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); | 313 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); |
289 | return; | 314 | return; |
@@ -307,9 +332,8 @@ void Wellenreiter::startStopClicked() | |||
307 | // connect | 332 | // connect |
308 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 333 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
309 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 334 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
310 | 335 | ||
311 | logwindow->log( "(i) Started Scanning." ); | 336 | logwindow->log( "(i) Started Scanning." ); |
312 | sniffing = true; | 337 | sniffing = true; |
313 | 338 | emit( startedSniffing() ); | |
314 | } | ||
315 | } | 339 | } |