summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-06 20:23:34 (UTC)
committer mickeyl <mickeyl>2004-01-06 20:23:34 (UTC)
commita513de3ae1549428595db1b6c70e4203b0a3dedd (patch) (side-by-side diff)
treebc6838aad156f2cb499ce69d1703d4c33839cfba
parent543c349726a63798491e85cf0dda89e79c6183d1 (diff)
downloadopie-a513de3ae1549428595db1b6c70e4203b0a3dedd.zip
opie-a513de3ae1549428595db1b6c70e4203b0a3dedd.tar.gz
opie-a513de3ae1549428595db1b6c70e4203b0a3dedd.tar.bz2
display stations sending control frames
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,14 +1,15 @@
2004-??-?? Michael Lauer <mickey@Vanille.de>
+ * Added parsing of control frames. Display stations sending them SSID "???" for now.
* Added command line option "-nocheck" to skip non-root and dhcp tests
* Improved the speed reading the manufacturer list
* GPS coordinates are now presented in the DMS (as opposed to decimal) format
2003-12-18 Michael Lauer <mickey@Vanille.de>
* Released as Version 1.0.2 (Development Snapshot)
* Added automatic uploading of capture files to "The Capture Dump" site at
http://www.Vanille.de/projects/capturedump.spy
* Initial reading of the manufacturer database happens now in background
* Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now.
The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that
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
@@ -150,71 +150,90 @@ void Wellenreiter::handleNotification( OPacket* p )
qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
doAction( action, name, p );
}
else
{
qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
}
++it;
}
}
-void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
+void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
{
+ if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time
+
+ OWaveLanManagementPacket* beacon = manage;
+
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
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" ) );
- GpsLocation loc( 0, 0 );
+ GpsLocation loc( -111.111, -111.111 );
if ( configwindow->enableGPS->isChecked() )
{
// TODO: add check if GPS is working!?
qDebug( "Wellenreiter::gathering GPS data..." );
loc = gps->position();
qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
}
netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
// 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::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
+{
+ OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
+
+ if ( control->controlType() == "Acknowledge" )
+ {
+ netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) );
+ }
+ else
+ {
+ qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() );
+ }
+}
+
+
void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
{
OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
if ( wlan->fromDS() && !wlan->toDS() )
{
netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
from = wlan->macAddress3();
to = wlan->macAddress2();
}
else if ( !wlan->fromDS() && wlan->toDS() )
{
netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
@@ -232,25 +251,25 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd
netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
from = wlan->macAddress2();
to = wlan->macAddress1();
}
}
void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
{
from = data->sourceAddress();
to = data->destinationAddress();
- netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( 0, 0 ) );
+ netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) );
}
void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
{
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(), arp->senderIPV4Address().toString() );
@@ -331,29 +350,37 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
}
void Wellenreiter::receivePacket( OPacket* p )
{
hexWindow()->log( p->dump( 8 ) );
if ( checkDumpPacket( p ) )
{
pcap->dump( p );
}
- // check if we received a beacon frame
- OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
- if ( beacon && beacon->managementType() == "Beacon" )
+ // check for a management frame
+ OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
+ if ( manage )
+ {
+ handleManagementFrame( p, manage );
+ return;
+ }
+
+ // check for a control frame
+ OWaveLanControlPacket* control = static_cast<OWaveLanControlPacket*>( childIfToParse( p, "802.11 Control" ) );
+ if ( control )
{
- handleBeacon( p, beacon );
+ handleControlFrame( p, control );
return;
}
OMacAddress source;
OMacAddress dest;
//TODO: WEP check here
// check for a wireless data frame
OWaveLanDataPacket* wlan = static_cast<OWaveLanDataPacket*>( childIfToParse( p, "802.11 Data" ) );
if ( wlan )
{
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
@@ -18,24 +18,25 @@
#include "wellenreiterbase.h"
#ifdef QWS
#include <opie/odevice.h>
using namespace Opie;
#endif
class QTimerEvent;
class QPixmap;
class OPacket;
class OWaveLanManagementPacket;
+class OWaveLanControlPacket;
class OWaveLanDataPacket;
class OEthernetPacket;
class OARPPacket;
class OMacAddress;
class OIPPacket;
class OPacketCapturer;
class OWirelessNetworkInterface;
class WellenreiterConfigWindow;
class MLogWindow;
class MHexWindow;
class GPS;
@@ -65,25 +66,26 @@ class Wellenreiter : public WellenreiterBase {
void channelHopped(int);
void receivePacket(OPacket*);
void startClicked();
void stopClicked();
void joinNetwork(const QString&,const QString&,int,const QString&);
signals:
void startedSniffing();
void stoppedSniffing();
private:
- void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
+ void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage );
+ void handleControlFrame( OPacket* p, OWaveLanControlPacket* control );
void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to );
void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to );
void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to );
void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to );
void handleNotification( OPacket* p );
void doAction( const QString& action, const QString& protocol, OPacket* p );
QObject* childIfToParse( OPacket* p, const QString& protocol );
bool checkDumpPacket( OPacket* p );
private:
#ifdef QWS
OSystem _system; // Opie Operating System identifier