author | mickeyl <mickeyl> | 2003-05-10 17:03:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-10 17:03:50 (UTC) |
commit | e858fffe853c2893775c202c52ba1d4898e723bc (patch) (side-by-side diff) | |
tree | 6d5bbe5ff471d12c89fd1e6d04458477fb1292d3 /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | e9195d3c80eca6ca41893ddcfef46683da6c5627 (diff) | |
download | opie-e858fffe853c2893775c202c52ba1d4898e723bc.zip opie-e858fffe853c2893775c202c52ba1d4898e723bc.tar.gz opie-e858fffe853c2893775c202c52ba1d4898e723bc.tar.bz2 |
- use OManufacturerDB instead of ManufacturerDB
- misc fixes
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 76 |
1 files changed, 13 insertions, 63 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 4257be1..2f26702 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -9,33 +9,32 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ***********************************************************************/ // Local #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "hexwindow.h" #include "configwindow.h" #include "statwindow.h" #include "graphwindow.h" -#include "manufacturers.h" #include "protolistview.h" // Opie #ifdef QWS #include <opie/odevice.h> using namespace Opie; #endif #ifdef QWS #include <opie2/oapplication.h> #else #include <qapplication.h> #endif #include <opie2/onetwork.h> #include <opie2/opcap.h> @@ -52,76 +51,55 @@ using namespace Opie; #include <qregexp.h> #include <qspinbox.h> #include <qtoolbutton.h> #include <qmainwindow.h> // Standard #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), - sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) + sniffing( false ), iface( 0 ), configwindow( 0 ) { - // - // construct manufacturer database - // - - QString manufile; - #ifdef QWS - manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); - #else - manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); - #endif - manufacturerdb = new ManufacturerDB( manufile ); - logwindow->log( "(i) Wellenreiter has been started." ); // // detect operating system // #ifdef QWS QString sys; sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); #endif - // setup GUI netview->setColumnWidthMode( 1, QListView::Manual ); - - if ( manufacturerdb ) - netview->setManufacturerDB( manufacturerdb ); - pcap = new OPacketCapturer(); - } Wellenreiter::~Wellenreiter() { - // no need to delete child widgets, Qt does it all for us - - delete manufacturerdb; delete pcap; } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } void Wellenreiter::channelHopped(int c) { QString title = "Wellenreiter II -scan- ["; QString left; if ( c > 1 ) left.fill( '.', c-1 ); title.append( left ); @@ -173,106 +151,78 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) else if ( beacon->canESS() ) { type = "managed"; } else { qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); return; } 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" ) ); - netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); + netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); // update graph window if ( ds ) { OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); if ( prism ) graphwindow->traffic( ds->channel(), prism->signalStrength() ); else graphwindow->traffic( ds->channel(), 95 ); } } void Wellenreiter::handleData( OPacket* p, OWaveLanDataPacket* data ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) { - qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", - (const char*) wlan->macAddress3().toString(true), - (const char*) wlan->macAddress1().toString(true), - (const char*) wlan->macAddress2().toString(true) ); - netView()->fromDStraffic( wlan->macAddress3().toString(), - wlan->macAddress1().toString(), - wlan->macAddress2().toString() ); + netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); } - else - if ( !wlan->fromDS() && wlan->toDS() ) + else if ( !wlan->fromDS() && wlan->toDS() ) { - qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", - (const char*) wlan->macAddress2().toString(true), - (const char*) wlan->macAddress3().toString(true), - (const char*) wlan->macAddress1().toString(true) ); - netView()->toDStraffic( wlan->macAddress2().toString(), - wlan->macAddress3().toString(), - wlan->macAddress1().toString() ); + netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); } - else - if ( wlan->fromDS() && wlan->toDS() ) - { - qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", - (const char*) wlan->macAddress4().toString(true), - (const char*) wlan->macAddress3().toString(true), - (const char*) wlan->macAddress1().toString(true), - (const char*) wlan->macAddress2().toString(true) ); - netView()->WDStraffic( wlan->macAddress4().toString(), - wlan->macAddress3().toString(), - wlan->macAddress1().toString(), - wlan->macAddress2().toString() ); + else if ( wlan->fromDS() && wlan->toDS() ) + { + netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); } else { - qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", - (const char*) wlan->macAddress2().toString(true), - (const char*) wlan->macAddress1().toString(true), - (const char*) wlan->macAddress3().toString(true) ); - netView()->IBSStraffic( wlan->macAddress2().toString(), - wlan->macAddress1().toString(), - wlan->macAddress3().toString() ); + netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); } OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) { qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); if ( arp->type() == "REQUEST" ) { - netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); + netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); } else if ( arp->type() == "REPLY" ) { - netView()->identify( arp->senderMacAddress().toString(), arp->senderIPV4Address().toString() ); - netView()->identify( arp->targetMacAddress().toString(), arp->targetIPV4Address().toString() ); + netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); + netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); } } OIPPacket* ip = (OIPPacket*) p->child( "IP" ); if ( ip ) { qDebug( "Received IP packet." ); } } QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) { if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) return 0; @@ -424,33 +374,33 @@ void Wellenreiter::startClicked() case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode 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' into monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); + tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); return; } } // open pcap and start sniffing if ( cardtype != DEVTYPE_FILE ) { pcap->open( interface ); if ( configwindow->writeCaptureFile->isOn() ) { QString dumpname( configwindow->captureFileName->text() ); dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); pcap->openDumpFile( dumpname ); |