-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 1525934..1ef24d2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -253,58 +253,60 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS if ( WellenreiterConfigWindow::instance() && type == "networks" ) playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); decorateItem( type, essid, macaddr, wep, channel, signal ); } MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { qDebug( "creating scanlist item" ); decorateItem( type, essid, macaddr, wep, channel, signal ); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } void MScanListItem::serializeTo( QDataStream& s ) const { qDebug( "serializing MScanListItem" ); OListViewItem::serializeTo( s ); s << _type; - s << (Q_UINT8) _wep; + s << (Q_UINT8) ( _wep ? 'y' : 'n' ); } void MScanListItem::serializeFrom( QDataStream& s ) { qDebug( "serializing MScanListItem" ); OListViewItem::serializeFrom( s ); + char wep; s >> _type; - s >> (Q_UINT8) _wep; + s >> (Q_UINT8) wep; + _wep = (wep == 'y'); QString name; name.sprintf( "wellenreiter/%s", (const char*) _type ); setPixmap( col_type, Resource::loadPixmap( name ) ); if ( _wep ) setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! listView()->triggerUpdate(); } void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) { qDebug( "decorating scanlist item %s / %s / %s [%d]", (const char*) type, (const char*) essid, (const char*) macaddr, channel ); // set icon for managed or adhoc mode QString name; name.sprintf( "wellenreiter/%s", (const char*) type ); setPixmap( col_type, Resource::loadPixmap( name ) ); // set icon for wep (wireless encryption protocol) if ( wep ) diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 8d18f73..8c2c315 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -93,63 +93,72 @@ Wellenreiter::Wellenreiter( QWidget* parent ) 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::receivePacket(OPacket* p) { hexWindow()->log( p->dump( 8 ) ); // check if we received a beacon frame OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); - if ( beacon ) + if ( beacon && beacon->managementType() == "Beacon" ) { QString type; if ( beacon->canIBSS() ) + { type = "adhoc"; - else + } + else if ( beacon->canESS() ) + { type = "managed"; + } + else + { + qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); + 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(), header->usesWep(), channel, 0 ); + netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); return; } // check for a data frame OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); if ( 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()->traffic( "fromDS", wlan->macAddress3().toString(), wlan->macAddress1().toString(), wlan->macAddress2().toString() ); } 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), |