summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp40
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
@@ -15,6 +15,7 @@
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"
@@ -85,6 +86,8 @@ Wellenreiter::Wellenreiter( QWidget* parent )
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
@@ -167,6 +170,14 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
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
@@ -238,7 +249,7 @@ 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();
@@ -357,7 +368,10 @@ void Wellenreiter::startClicked()
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 );
@@ -389,20 +403,29 @@ void Wellenreiter::startClicked()
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" );
@@ -430,7 +453,10 @@ void Wellenreiter::startClicked()
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 {