Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 74 |
1 files changed, 12 insertions, 62 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 @@ -17,17 +17,16 @@ #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 @@ -60,60 +59,39 @@ using namespace Opie; #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; } @@ -181,17 +159,17 @@ 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" ) ); - 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 @@ -200,71 +178,43 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) } 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() ) + 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() ); + 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." ); } @@ -432,17 +382,17 @@ void Wellenreiter::startClicked() // 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 ); |