summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp15
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
@@ -261,42 +261,44 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid
261{ 261{
262 qDebug( "creating scanlist item" ); 262 qDebug( "creating scanlist item" );
263 decorateItem( type, essid, macaddr, wep, channel, signal ); 263 decorateItem( type, essid, macaddr, wep, channel, signal );
264} 264}
265 265
266OListViewItem* MScanListItem::childFactory() 266OListViewItem* MScanListItem::childFactory()
267{ 267{
268 return new MScanListItem( this ); 268 return new MScanListItem( this );
269} 269}
270 270
271void MScanListItem::serializeTo( QDataStream& s ) const 271void MScanListItem::serializeTo( QDataStream& s ) const
272{ 272{
273 qDebug( "serializing MScanListItem" ); 273 qDebug( "serializing MScanListItem" );
274 OListViewItem::serializeTo( s ); 274 OListViewItem::serializeTo( s );
275 275
276 s << _type; 276 s << _type;
277 s << (Q_UINT8) _wep; 277 s << (Q_UINT8) ( _wep ? 'y' : 'n' );
278} 278}
279 279
280void MScanListItem::serializeFrom( QDataStream& s ) 280void MScanListItem::serializeFrom( QDataStream& s )
281{ 281{
282 qDebug( "serializing MScanListItem" ); 282 qDebug( "serializing MScanListItem" );
283 OListViewItem::serializeFrom( s ); 283 OListViewItem::serializeFrom( s );
284 284
285 char wep;
285 s >> _type; 286 s >> _type;
286 s >> (Q_UINT8) _wep; 287 s >> (Q_UINT8) wep;
288 _wep = (wep == 'y');
287 289
288 QString name; 290 QString name;
289 name.sprintf( "wellenreiter/%s", (const char*) _type ); 291 name.sprintf( "wellenreiter/%s", (const char*) _type );
290 setPixmap( col_type, Resource::loadPixmap( name ) ); 292 setPixmap( col_type, Resource::loadPixmap( name ) );
291 if ( _wep ) 293 if ( _wep )
292 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 294 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
293 listView()->triggerUpdate(); 295 listView()->triggerUpdate();
294} 296}
295 297
296void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 298void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
297{ 299{
298 qDebug( "decorating scanlist item %s / %s / %s [%d]", 300 qDebug( "decorating scanlist item %s / %s / %s [%d]",
299 (const char*) type, 301 (const char*) type,
300 (const char*) essid, 302 (const char*) essid,
301 (const char*) macaddr, 303 (const char*) macaddr,
302 channel ); 304 channel );
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
@@ -101,47 +101,56 @@ Wellenreiter::~Wellenreiter()
101 101
102 delete manufacturerdb; 102 delete manufacturerdb;
103 delete pcap; 103 delete pcap;
104} 104}
105 105
106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) 106void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
107{ 107{
108 configwindow = cw; 108 configwindow = cw;
109} 109}
110 110
111void Wellenreiter::receivePacket(OPacket* p) 111void Wellenreiter::receivePacket(OPacket* p)
112{ 112{
113 hexWindow()->log( p->dump( 8 ) ); 113 hexWindow()->log( p->dump( 8 ) );
114 114
115 // check if we received a beacon frame 115 // check if we received a beacon frame
116 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 116 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
117 if ( beacon ) 117 if ( beacon && beacon->managementType() == "Beacon" )
118 { 118 {
119 QString type; 119 QString type;
120 if ( beacon->canIBSS() ) 120 if ( beacon->canIBSS() )
121 {
121 type = "adhoc"; 122 type = "adhoc";
122 else 123 }
124 else if ( beacon->canESS() )
125 {
123 type = "managed"; 126 type = "managed";
127 }
128 else
129 {
130 qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) );
131 return;
132 }
124 133
125 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 134 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
126 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 135 QString essid = ssid ? ssid->ID() : QString("<unknown>");
127 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 136 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
128 int channel = ds ? ds->channel() : -1; 137 int channel = ds ? ds->channel() : -1;
129 138
130 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 139 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
131 netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 ); 140 netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 );
132 return; 141 return;
133 } 142 }
134 143
135 // check for a data frame 144 // check for a data frame
136 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); 145 OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) );
137 if ( data ) 146 if ( data )
138 { 147 {
139 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 148 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
140 if ( wlan->fromDS() && !wlan->toDS() ) 149 if ( wlan->fromDS() && !wlan->toDS() )
141 { 150 {
142 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", 151 qDebug( "FromDS traffic: '%s' -> '%s' via '%s'",
143 (const char*) wlan->macAddress3().toString(true), 152 (const char*) wlan->macAddress3().toString(true),
144 (const char*) wlan->macAddress1().toString(true), 153 (const char*) wlan->macAddress1().toString(true),
145 (const char*) wlan->macAddress2().toString(true) ); 154 (const char*) wlan->macAddress2().toString(true) );
146 netView()->traffic( "fromDS", wlan->macAddress3().toString(), 155 netView()->traffic( "fromDS", wlan->macAddress3().toString(),
147 wlan->macAddress1().toString(), 156 wlan->macAddress1().toString(),