Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 96733ff..c03debb 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -14,8 +14,9 @@ | |||
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Local | 16 | // Local |
17 | 17 | ||
18 | #include "gps.h" | ||
18 | #include "wellenreiter.h" | 19 | #include "wellenreiter.h" |
19 | #include "scanlist.h" | 20 | #include "scanlist.h" |
20 | #include "logwindow.h" | 21 | #include "logwindow.h" |
21 | #include "hexwindow.h" | 22 | #include "hexwindow.h" |
@@ -84,8 +85,10 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
84 | netview->setColumnWidthMode( 1, QListView::Manual ); | 85 | netview->setColumnWidthMode( 1, QListView::Manual ); |
85 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), | 86 | connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), |
86 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); | 87 | this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); |
87 | pcap = new OPacketCapturer(); | 88 | pcap = new OPacketCapturer(); |
89 | |||
90 | gps = new GPS( this ); | ||
88 | } | 91 | } |
89 | 92 | ||
90 | 93 | ||
91 | Wellenreiter::~Wellenreiter() | 94 | Wellenreiter::~Wellenreiter() |
@@ -166,8 +169,16 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | |||
166 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 169 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
167 | int channel = ds ? ds->channel() : -1; | 170 | int channel = ds ? ds->channel() : -1; |
168 | 171 | ||
169 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 172 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
173 | |||
174 | if ( configwindow->enableGPS->isChecked() ) | ||
175 | { | ||
176 | qDebug( "Wellenreiter::gathering GPS data..." ); | ||
177 | float lat = gps->latitude(); | ||
178 | qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 ); | ||
179 | } | ||
180 | |||
170 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); | 181 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); |
171 | 182 | ||
172 | // update graph window | 183 | // update graph window |
173 | if ( ds ) | 184 | if ( ds ) |
@@ -237,9 +248,9 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | |||
237 | bool Wellenreiter::checkDumpPacket( OPacket* p ) | 248 | bool Wellenreiter::checkDumpPacket( OPacket* p ) |
238 | { | 249 | { |
239 | // go through all child packets and see if one is inside the child hierarchy for p | 250 | // go through all child packets and see if one is inside the child hierarchy for p |
240 | // if so, do what the user requested (protocolAction), e.g. pass or discard | 251 | // if so, do what the user requested (protocolAction), e.g. pass or discard |
241 | if ( !configwindow->writeCaptureFile->isOn() ) | 252 | if ( !configwindow->writeCaptureFile->isChecked() ) |
242 | return false; | 253 | return false; |
243 | 254 | ||
244 | QObjectList* l = p->queryList(); | 255 | QObjectList* l = p->queryList(); |
245 | QObjectListIt it( *l ); | 256 | QObjectListIt it( *l ); |
@@ -356,9 +367,12 @@ void Wellenreiter::startClicked() | |||
356 | } | 367 | } |
357 | 368 | ||
358 | // configure device | 369 | // configure device |
359 | ONetwork* net = ONetwork::instance(); | 370 | ONetwork* net = ONetwork::instance(); |
360 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 371 | |
372 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | ||
373 | |||
374 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | ||
361 | 375 | ||
362 | // bring device UP | 376 | // bring device UP |
363 | iface->setUp( true ); | 377 | iface->setUp( true ); |
364 | if ( !iface->isUp() ) | 378 | if ( !iface->isUp() ) |
@@ -388,22 +402,31 @@ void Wellenreiter::startClicked() | |||
388 | if ( cardtype != DEVTYPE_MANUAL ) | 402 | if ( cardtype != DEVTYPE_MANUAL ) |
389 | iface->setMonitorMode( true ); | 403 | iface->setMonitorMode( true ); |
390 | if ( !iface->monitorMode() ) | 404 | if ( !iface->monitorMode() ) |
391 | { | 405 | { |
392 | QMessageBox::warning( this, "Wellenreiter II", | 406 | if ( QMessageBox::warning( this, "Wellenreiter II", |
393 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); | 407 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
394 | return; | 408 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
409 | return; | ||
395 | } | 410 | } |
396 | } | 411 | } |
397 | 412 | ||
413 | // open GPS device | ||
414 | if ( configwindow->enableGPS->isChecked() ) | ||
415 | { | ||
416 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
417 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | ||
418 | } | ||
419 | |||
398 | // open pcap and start sniffing | 420 | // open pcap and start sniffing |
399 | if ( cardtype != DEVTYPE_FILE ) | 421 | if ( cardtype != DEVTYPE_FILE ) |
400 | { | 422 | { |
401 | pcap->open( interface ); | 423 | pcap->open( interface ); |
402 | 424 | ||
403 | if ( configwindow->writeCaptureFile->isOn() ) | 425 | if ( configwindow->writeCaptureFile->isChecked() ) |
404 | { | 426 | { |
405 | QString dumpname( configwindow->captureFileName->text() ); | 427 | QString dumpname( configwindow->captureFileName->text() ); |
428 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | ||
406 | dumpname.append( '-' ); | 429 | dumpname.append( '-' ); |
407 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 430 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
408 | dumpname.append( ".wellenreiter" ); | 431 | dumpname.append( ".wellenreiter" ); |
409 | pcap->openDumpFile( dumpname ); | 432 | pcap->openDumpFile( dumpname ); |
@@ -429,9 +452,12 @@ void Wellenreiter::startClicked() | |||
429 | pcap->setBlocking( false ); | 452 | pcap->setBlocking( false ); |
430 | 453 | ||
431 | // start channel hopper | 454 | // start channel hopper |
432 | if ( cardtype != DEVTYPE_FILE ) | 455 | if ( cardtype != DEVTYPE_FILE ) |
433 | iface->setChannelHopping( 1000 ); //use interval from config window | 456 | { |
457 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | ||
458 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | ||
459 | } | ||
434 | 460 | ||
435 | if ( cardtype != DEVTYPE_FILE ) | 461 | if ( cardtype != DEVTYPE_FILE ) |
436 | { | 462 | { |
437 | // connect socket notifier and start channel hopper | 463 | // connect socket notifier and start channel hopper |