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 @@ -12,12 +12,13 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ***********************************************************************/ // Local +#include "gps.h" #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "hexwindow.h" #include "configwindow.h" #include "statwindow.h" @@ -82,12 +83,14 @@ Wellenreiter::Wellenreiter( QWidget* parent ) #endif netview->setColumnWidthMode( 1, QListView::Manual ); connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); pcap = new OPacketCapturer(); + + gps = new GPS( this ); } Wellenreiter::~Wellenreiter() { delete pcap; @@ -164,12 +167,20 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID() : QString("<unknown>"); OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); + + if ( configwindow->enableGPS->isChecked() ) + { + qDebug( "Wellenreiter::gathering GPS data..." ); + float lat = gps->latitude(); + qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 ); + } + netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); // update graph window if ( ds ) { OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); @@ -235,13 +246,13 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) bool Wellenreiter::checkDumpPacket( OPacket* p ) { // go through all child packets and see if one is inside the child hierarchy for p // if so, do what the user requested (protocolAction), e.g. pass or discard - if ( !configwindow->writeCaptureFile->isOn() ) + if ( !configwindow->writeCaptureFile->isChecked() ) return false; QObjectList* l = p->queryList(); QObjectListIt it( *l ); QObject* o; @@ -354,13 +365,16 @@ void Wellenreiter::startClicked() tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); return; } // configure device ONetwork* net = ONetwork::instance(); - iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); + + // TODO: check if interface is wireless and support sniffing for non-wireless interfaces + + iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! // bring device UP iface->setUp( true ); if ( !iface->isUp() ) { QMessageBox::warning( this, "Wellenreiter II", @@ -386,26 +400,35 @@ void Wellenreiter::startClicked() if ( cardtype < DEVTYPE_FILE ) { if ( cardtype != DEVTYPE_MANUAL ) iface->setMonitorMode( true ); if ( !iface->monitorMode() ) { - QMessageBox::warning( this, "Wellenreiter II", - tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); - return; + if ( QMessageBox::warning( this, "Wellenreiter II", + tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + + tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) + return; } } + // open GPS device + if ( configwindow->enableGPS->isChecked() ) + { + qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); + } + // open pcap and start sniffing if ( cardtype != DEVTYPE_FILE ) { pcap->open( interface ); - if ( configwindow->writeCaptureFile->isOn() ) + if ( configwindow->writeCaptureFile->isChecked() ) { QString dumpname( configwindow->captureFileName->text() ); + if ( dumpname.isEmpty() ) dumpname = "captureFile"; dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); pcap->openDumpFile( dumpname ); } else @@ -427,13 +450,16 @@ void Wellenreiter::startClicked() // set capturer to non-blocking mode pcap->setBlocking( false ); // start channel hopper if ( cardtype != DEVTYPE_FILE ) - iface->setChannelHopping( 1000 ); //use interval from config window + { + logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); + iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window + } if ( cardtype != DEVTYPE_FILE ) { // connect socket notifier and start channel hopper connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |