-rw-r--r-- | noncore/net/wellenreiter/ChangeLog | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 5 |
5 files changed, 60 insertions, 16 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog index d4dca9f..f183d80 100644 --- a/noncore/net/wellenreiter/ChangeLog +++ b/noncore/net/wellenreiter/ChangeLog @@ -1,12 +1,13 @@ 2004-??-?? Michael Lauer <mickey@Vanille.de> + * Added parsing of named ProbeRequests. Display only-probed-yet SSIDs in a different network color. * Rewrote the simple actions on new {Network, Client, Station}. Besides playing a sound or blinking a LED, a user customizable script can now be executed, if something has been - detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing Flite. + detected. This opens up many possibilities, i.e. a qcop to qpegps or exec'ing flite (speech). * Added decloaking of cloaked ESSIDs (length != 0, but essid[0] == \0) * Hided the 'Parse' Tab in the configuration window. Not functional now and may come later - * Added parsing of control frames. Display stations sending them SSID "???" for now. + * Added parsing of control frames. Display stations sending them SSID "<unknown>" 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 diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index aea7eb6..fd88b63 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -119,9 +119,10 @@ void MScanListView::addNewItem( const QString& type, const OMacAddress& mac, bool wep, int channel, int signal, - const GpsLocation& loc ) + const GpsLocation& loc, + bool probe ) { QString macaddr = mac.toString(true); #ifdef DEBUG @@ -172,9 +173,9 @@ void MScanListView::addNewItem( const QString& type, else { s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); MLogWindow::logwindow()->log( s ); - network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); + network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); } // insert new station as child from network @@ -196,9 +197,8 @@ void MScanListView::addNewItem( const QString& type, { s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); } MLogWindow::logwindow()->log( s ); - } void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) @@ -409,9 +409,9 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in // MScanListItem //============================================================ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, - bool wep, int channel, int signal ) + bool wep, int channel, int signal, bool probed ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), _channel( channel ), _signal( signal ), _beacons( 1 ) { @@ -421,9 +421,9 @@ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QStr if ( WellenreiterConfigWindow::instance() ) WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here - decorateItem( type, essid, macaddr, wep, channel, signal ); + decorateItem( type, essid, macaddr, wep, channel, signal, probed ); } MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, bool wep, int channel, int signal ) @@ -431,9 +431,9 @@ MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const { #ifdef DEBUG qDebug( "creating scanlist item" ); #endif - decorateItem( type, essid, macaddr, wep, channel, signal ); + decorateItem( type, essid, macaddr, wep, channel, signal, false ); } const QString& MScanListItem::essid() const { @@ -478,9 +478,9 @@ void MScanListItem::serializeFrom( QDataStream& s ) 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 ) +void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) { #ifdef DEBUG qDebug( "decorating scanlist item %s / %s / %s [%d]", (const char*) type, @@ -493,8 +493,14 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, QString name; name.sprintf( "wellenreiter/%s", (const char*) type ); setPixmap( col_type, Resource::loadPixmap( name ) ); + // special case for probed networks FIXME: This is ugly at present + if ( type == "network" && probed ) + { + setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); + } + // set icon for wep (wireless encryption protocol) if ( wep ) setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index e8d48c3..cbacdee 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -40,9 +40,9 @@ class MScanListView: public OListView virtual void serializeTo( QDataStream& s ) const; virtual void serializeFrom( QDataStream& s ); public slots: - void addNewItem( const QString& type, const QString& essid, const OMacAddress& macaddr, bool wep, int channel, int signal, const GpsLocation& location ); + void addNewItem( const QString& type, const QString&, const OMacAddress&, bool, int, int, const GpsLocation&, bool = false ); void addService( const QString& name, const OMacAddress& macaddr, const QString& ip ); void fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); void toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); @@ -72,9 +72,10 @@ class MScanListItem: public OListViewItem const QString& essid = "unknown", const QString& macaddr = "unknown", bool wep = false, int channel = 0, - int signal = 0 ); + int signal = 0, + bool probed = false ); MScanListItem::MScanListItem( QListViewItem* parent, const QString& type = "unknown", const QString& essid = "unknown", @@ -84,9 +85,9 @@ class MScanListItem: public OListViewItem int signal = 0 ); protected: - virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); + virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ); public: QString type; diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 25632f3..cd74bed 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -160,12 +160,45 @@ void Wellenreiter::handleNotification( OPacket* p ) void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) { - if ( manage->managementType() != "Beacon" ) return; // only handling beacons at that time + if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); + else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); + else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); + else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); +} - OWaveLanManagementPacket* beacon = manage; +void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) +{ + OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); + QString essid = ssid ? ssid->ID( true /* decloak */ ) : 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( -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() ); + } + + if ( essid.length() ) + netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); + qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); +} + + +void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) +{ +} + + +void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) +{ QString type; if ( beacon->canIBSS() ) { type = "adhoc"; @@ -215,9 +248,9 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); if ( control->controlType() == "Acknowledge" ) { - netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); + netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); } else { qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index 5414fda..a28740b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -74,9 +74,12 @@ class Wellenreiter : public WellenreiterBase { void startedSniffing(); void stoppedSniffing(); private: - void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ); + void handleManagementFrame( OPacket* p, OWaveLanManagementPacket* ); + void handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* ); + void handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* ); + void handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* ); 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 ); |