summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/ChangeLog1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp41
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h4
3 files changed, 38 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog
index 755ed76..8bf8cc8 100644
--- a/noncore/net/wellenreiter/ChangeLog
+++ b/noncore/net/wellenreiter/ChangeLog
@@ -1,18 +1,19 @@
1 2004-??-?? Michael Lauer <mickey@Vanille.de> 1 2004-??-?? Michael Lauer <mickey@Vanille.de>
2 2
3 * Added parsing of control frames. Display stations sending them SSID "???" for now.
3 * Added command line option "-nocheck" to skip non-root and dhcp tests 4 * Added command line option "-nocheck" to skip non-root and dhcp tests
4 * Improved the speed reading the manufacturer list 5 * Improved the speed reading the manufacturer list
5 * GPS coordinates are now presented in the DMS (as opposed to decimal) format 6 * GPS coordinates are now presented in the DMS (as opposed to decimal) format
6 7
7 2003-12-18 Michael Lauer <mickey@Vanille.de> 8 2003-12-18 Michael Lauer <mickey@Vanille.de>
8 9
9 * Released as Version 1.0.2 (Development Snapshot) 10 * Released as Version 1.0.2 (Development Snapshot)
10 * Added automatic uploading of capture files to "The Capture Dump" site at 11 * Added automatic uploading of capture files to "The Capture Dump" site at
11 http://www.Vanille.de/projects/capturedump.spy 12 http://www.Vanille.de/projects/capturedump.spy
12 * Initial reading of the manufacturer database happens now in background 13 * Initial reading of the manufacturer database happens now in background
13 * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now. 14 * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now.
14 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that 15 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that
15 doesn't work, it falls back to using the proprietary iwpriv commands 16 doesn't work, it falls back to using the proprietary iwpriv commands
16 17
17 2003-11-30 Michael Lauer <mickey@Vanille.de> 18 2003-11-30 Michael Lauer <mickey@Vanille.de>
18 19
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 5575d6e..45d7142 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -146,79 +146,98 @@ void Wellenreiter::handleNotification( OPacket* p )
146 QString name = it.current()->name(); 146 QString name = it.current()->name();
147 if ( configwindow->parsePackets->isProtocolChecked( name ) ) 147 if ( configwindow->parsePackets->isProtocolChecked( name ) )
148 { 148 {
149 QString action = configwindow->parsePackets->protocolAction( name ); 149 QString action = configwindow->parsePackets->protocolAction( name );
150 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 150 qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
151 doAction( action, name, p ); 151 doAction( action, name, p );
152 } 152 }
153 else 153 else
154 { 154 {
155 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); 155 qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
156 } 156 }
157 ++it; 157 ++it;
158 } 158 }
159} 159}
160 160
161 161
162void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) 162void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
163{ 163{
164 if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time
165
166 OWaveLanManagementPacket* beacon = manage;
167
164 QString type; 168 QString type;
165 if ( beacon->canIBSS() ) 169 if ( beacon->canIBSS() )
166 { 170 {
167 type = "adhoc"; 171 type = "adhoc";
168 } 172 }
169 else if ( beacon->canESS() ) 173 else if ( beacon->canESS() )
170 { 174 {
171 type = "managed"; 175 type = "managed";
172 } 176 }
173 else 177 else
174 { 178 {
175 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); 179 qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
176 return; 180 return;
177 } 181 }
178 182
179 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); 183 OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
180 QString essid = ssid ? ssid->ID() : QString("<unknown>"); 184 QString essid = ssid ? ssid->ID() : QString("<unknown>");
181 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); 185 OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
182 int channel = ds ? ds->channel() : -1; 186 int channel = ds ? ds->channel() : -1;
183 187
184 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 188 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
185 189
186 GpsLocation loc( 0, 0 ); 190 GpsLocation loc( -111.111, -111.111 );
187 if ( configwindow->enableGPS->isChecked() ) 191 if ( configwindow->enableGPS->isChecked() )
188 { 192 {
189 // TODO: add check if GPS is working!? 193 // TODO: add check if GPS is working!?
190 qDebug( "Wellenreiter::gathering GPS data..." ); 194 qDebug( "Wellenreiter::gathering GPS data..." );
191 loc = gps->position(); 195 loc = gps->position();
192 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); 196 qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
193 } 197 }
194 198
195 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); 199 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
196 200
197 // update graph window 201 // update graph window
198 if ( ds ) 202 if ( ds )
199 { 203 {
200 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); 204 OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
201 if ( prism ) 205 if ( prism )
202 graphwindow->traffic( ds->channel(), prism->signalStrength() ); 206 graphwindow->traffic( ds->channel(), prism->signalStrength() );
203 else 207 else
204 graphwindow->traffic( ds->channel(), 95 ); 208 graphwindow->traffic( ds->channel(), 95 );
205 } 209 }
206} 210}
207 211
208 212
213void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
214{
215 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
216
217 if ( control->controlType() == "Acknowledge" )
218 {
219 netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) );
220 }
221 else
222 {
223 qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() );
224 }
225}
226
227
209void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) 228void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
210{ 229{
211 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); 230 OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
212 if ( wlan->fromDS() && !wlan->toDS() ) 231 if ( wlan->fromDS() && !wlan->toDS() )
213 { 232 {
214 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); 233 netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
215 from = wlan->macAddress3(); 234 from = wlan->macAddress3();
216 to = wlan->macAddress2(); 235 to = wlan->macAddress2();
217 } 236 }
218 else if ( !wlan->fromDS() && wlan->toDS() ) 237 else if ( !wlan->fromDS() && wlan->toDS() )
219 { 238 {
220 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() ); 239 netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
221 from = wlan->macAddress2(); 240 from = wlan->macAddress2();
222 to = wlan->macAddress3(); 241 to = wlan->macAddress3();
223 } 242 }
224 else if ( wlan->fromDS() && wlan->toDS() ) 243 else if ( wlan->fromDS() && wlan->toDS() )
@@ -228,33 +247,33 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd
228 to = wlan->macAddress3(); 247 to = wlan->macAddress3();
229 } 248 }
230 else 249 else
231 { 250 {
232 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() ); 251 netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
233 from = wlan->macAddress2(); 252 from = wlan->macAddress2();
234 to = wlan->macAddress1(); 253 to = wlan->macAddress1();
235 } 254 }
236} 255}
237 256
238 257
239void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) 258void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
240{ 259{
241 from = data->sourceAddress(); 260 from = data->sourceAddress();
242 to = data->destinationAddress(); 261 to = data->destinationAddress();
243 262
244 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) ); 263 netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) );
245} 264}
246 265
247 266
248void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) 267void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
249{ 268{
250 OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); 269 OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
251 if ( arp ) 270 if ( arp )
252 { 271 {
253 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); 272 qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
254 if ( arp->type() == "REQUEST" ) 273 if ( arp->type() == "REQUEST" )
255 { 274 {
256 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 275 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
257 } 276 }
258 else if ( arp->type() == "REPLY" ) 277 else if ( arp->type() == "REPLY" )
259 { 278 {
260 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); 279 netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
@@ -327,37 +346,45 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
327 } 346 }
328 ++it; 347 ++it;
329 } 348 }
330 return true; 349 return true;
331} 350}
332 351
333 352
334void Wellenreiter::receivePacket( OPacket* p ) 353void Wellenreiter::receivePacket( OPacket* p )
335{ 354{
336 hexWindow()->log( p->dump( 8 ) ); 355 hexWindow()->log( p->dump( 8 ) );
337 356
338 if ( checkDumpPacket( p ) ) 357 if ( checkDumpPacket( p ) )
339 { 358 {
340 pcap->dump( p ); 359 pcap->dump( p );
341 } 360 }
342 361
343 // check if we received a beacon frame 362 // check for a management frame
344 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) ); 363 OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
345 if ( beacon && beacon->managementType() == "Beacon" ) 364 if ( manage )
365 {
366 handleManagementFrame( p, manage );
367 return;
368 }
369
370 // check for a control frame
371 OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) );
372 if ( control )
346 { 373 {
347 handleBeacon( p, beacon ); 374 handleControlFrame( p, control );
348 return; 375 return;
349 } 376 }
350 377
351 OMacAddress source; 378 OMacAddress source;
352 OMacAddress dest; 379 OMacAddress dest;
353 380
354 //TODO: WEP check here 381 //TODO: WEP check here
355 382
356 // check for a wireless data frame 383 // check for a wireless data frame
357 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) ); 384 OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
358 if ( wlan ) 385 if ( wlan )
359 { 386 {
360 handleWlanData( p, wlan, source, dest ); 387 handleWlanData( p, wlan, source, dest );
361 } 388 }
362 389
363 // check for a wired data frame 390 // check for a wired data frame
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 58dd1fd..5414fda 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -14,32 +14,33 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITER_H 16#ifndef WELLENREITER_H
17#define WELLENREITER_H 17#define WELLENREITER_H
18 18
19#include "wellenreiterbase.h" 19#include "wellenreiterbase.h"
20 20
21#ifdef QWS 21#ifdef QWS
22#include <opie/odevice.h> 22#include <opie/odevice.h>
23using namespace Opie; 23using namespace Opie;
24#endif 24#endif
25 25
26class QTimerEvent; 26class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OWaveLanManagementPacket; 29class OWaveLanManagementPacket;
30class OWaveLanControlPacket;
30class OWaveLanDataPacket; 31class OWaveLanDataPacket;
31class OEthernetPacket; 32class OEthernetPacket;
32class OARPPacket; 33class OARPPacket;
33class OMacAddress; 34class OMacAddress;
34class OIPPacket; 35class OIPPacket;
35class OPacketCapturer; 36class OPacketCapturer;
36class OWirelessNetworkInterface; 37class OWirelessNetworkInterface;
37class WellenreiterConfigWindow; 38class WellenreiterConfigWindow;
38class MLogWindow; 39class MLogWindow;
39class MHexWindow; 40class MHexWindow;
40class GPS; 41class GPS;
41 42
42class Wellenreiter : public WellenreiterBase { 43class Wellenreiter : public WellenreiterBase {
43 Q_OBJECT 44 Q_OBJECT
44 45
45 public: 46 public:
@@ -61,33 +62,34 @@ class Wellenreiter : public WellenreiterBase {
61 62
62 public slots: 63 public slots:
63 void initialTimer(); 64 void initialTimer();
64 65
65 void channelHopped(int); 66 void channelHopped(int);
66 void receivePacket(OPacket*); 67 void receivePacket(OPacket*);
67 void startClicked(); 68 void startClicked();
68 void stopClicked(); 69 void stopClicked();
69 70
70 void joinNetwork(const QString&,const QString&,int,const QString&); 71 void joinNetwork(const QString&,const QString&,int,const QString&);
71 72
72 signals: 73 signals:
73 void startedSniffing(); 74 void startedSniffing();
74 void stoppedSniffing(); 75 void stoppedSniffing();
75 76
76 private: 77 private:
77 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); 78 void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage );
79 void handleControlFrame( OPacket* p, OWaveLanControlPacket* control );
78 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); 80 void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to );
79 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); 81 void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to );
80 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); 82 void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to );
81 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); 83 void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to );
82 void handleNotification( OPacket* p ); 84 void handleNotification( OPacket* p );
83 void doAction( const QString& action, const QString& protocol, OPacket* p ); 85 void doAction( const QString& action, const QString& protocol, OPacket* p );
84 QObject* childIfToParse( OPacket* p, const QString& protocol ); 86 QObject* childIfToParse( OPacket* p, const QString& protocol );
85 bool checkDumpPacket( OPacket* p ); 87 bool checkDumpPacket( OPacket* p );
86 88
87 private: 89 private:
88 #ifdef QWS 90 #ifdef QWS
89 OSystem _system; // Opie Operating System identifier 91 OSystem _system; // Opie Operating System identifier
90 #endif 92 #endif
91 93
92 QString dumpname; 94 QString dumpname;
93 OWirelessNetworkInterface* iface; 95 OWirelessNetworkInterface* iface;