author | mickeyl <mickeyl> | 2004-01-08 17:26:01 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-08 17:26:01 (UTC) |
commit | c0a0d53fb92f8a1723c57580a5fd0ade66574ec4 (patch) (side-by-side diff) | |
tree | 0d1cb64ad905b81a04bd8c45cada4feda3c122f6 | |
parent | 9634c11f8ea28af19a4afc6821c68cdc2b3e7c8a (diff) | |
download | opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.zip opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.tar.gz opie-c0a0d53fb92f8a1723c57580a5fd0ade66574ec4.tar.bz2 |
Display stations sending out named ProbeRequests.
Wellenreiter II reaches a critical point in its lifetime, i.e.
the scanlist and wellenreiter classes are the mainly still as they
were during the early prototype phrase. It's time to rewrite the major
UI core and start with giving it something like a design (D'Oh!)...
-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,79 +1,80 @@ 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 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 doesn't work, it falls back to using the proprietary iwpriv commands 2003-11-30 Michael Lauer <mickey@Vanille.de> * Released as Version 1.0.1 (Development Snapshot) * Fixed ARP decoding for wired networks. Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol. * Added reading GPS data from a gps daemon. * Started preparations for utilizing Wellenreiter II in wired networks. * Implemented persistant configuration interface and retriggerable auto detection. * Added QCOP interface for talking to opie-networksettings. * Added parsing of DHCP packets and detecting DHCP servers. * Overhauled the configuration window and started with the customizable event system. * Added disabling the screensaver. * Added automatic opening and scrolling to the network tree if a new station appears. 2003-05-10 Michael Lauer <mickey@Vanille.de> * Released as Version 1.0 (Stable) * Added restarting the dhcp client if having killed it before. * Decouple dump files from live capture to shift control over 'what' is dumped to applications. 2003-05-05 Michael Lauer <mickey@Vanille.de> * Released as Version 1.0-RC1 (Release Candidate) * Fixed rare segfaults while sniffing and operating the GUI simultaenously. * Parse more data packets and detect more participating stations. * Added live graph window showing the signal strength on all channels. * Added parsing ARP packets and identifying IP addresses of participating stations. * Added parsing with optionally enabled PRISM headers (signal strength). 2003-04-12 Michael Lauer <mickey@Vanille.de> * Released as Version 1.0 (Beta) * GUI enhancements in the Menubar and the Toolbar. * Improved keyboard handling. * Added sanity checks for running Wellenreiter II as non-root or with dhcp clients in the background. * Add writing and replaying of libpcap compatible capture files. 2003-04-08 Michael Lauer <mickey@Vanille.de> * Released as Version 0.2 (Alpha) * Closed memory leak in packet capturer. * Fixed client stations appearing under essid as access points. * Fixed false WEP reporting in some cases. * Started with inspecting data packages. * Add detecting associated client stations in infrastructural networks (if they transmit data). * Worked around buggy hostap drivers writing past fixed-length-structures on arm. * Added dynamic checking of available private ioctls. * Added a saveable hex window for packet dissection. 2003-03-30 Michael Lauer <mickey@Vanille.de> * Released as Version 0.1 (Alpha) 2003-03-25 Michael Lauer <mickey@Vanille.de> * Rewrote Wellenreiter II from scratch - including the sniffing engine. * Beacon inspection works and finds ad-hoc networks and managed networks. 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 @@ -1,554 +1,560 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "scanlist.h" #include "configwindow.h" #include "logwindow.h" #include <assert.h> #include <qcursor.h> #include <qdatetime.h> #include <qtextstream.h> #include <qpopupmenu.h> #include <qcheckbox.h> #ifdef QWS #include <qpe/qpeapplication.h> #endif #ifdef QWS #include <qpe/resource.h> #else #include "resource.h" #endif const int col_type = 0; const int col_essid = 0; const int col_sig = 1; const int col_ap = 2; const int col_channel = 3; const int col_wep = 4; const int col_traffic = 5; const int col_ip = 6; const int col_manuf = 7; const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { setFrameShape( QListView::StyledPanel ); setFrameShadow( QListView::Sunken ); addColumn( tr( "Net/Station" ) ); setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); addColumn( tr( "#" ) ); setColumnAlignment( col_sig, AlignCenter ); addColumn( tr( "MAC" ) ); setColumnAlignment( col_ap, AlignCenter ); addColumn( tr( "Chn" ) ); setColumnAlignment( col_channel, AlignCenter ); addColumn( tr( "W" ) ); setColumnAlignment( col_wep, AlignCenter ); addColumn( tr( "T" ) ); setColumnAlignment( col_traffic, AlignCenter ); addColumn( tr( "IP" ) ); setColumnAlignment( col_ip, AlignCenter ); addColumn( tr( "Manufacturer" ) ); setColumnAlignment( col_manuf, AlignCenter ); addColumn( tr( "First Seen" ) ); setColumnAlignment( col_firstseen, AlignCenter ); addColumn( tr( "Last Seen" ) ); setColumnAlignment( col_lastseen, AlignCenter ); addColumn( tr( "Location" ) ); setColumnAlignment( col_location, AlignCenter ); setRootIsDecorated( true ); setAllColumnsShowFocus( true ); connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); #ifdef QWS QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif }; MScanListView::~MScanListView() { }; OListViewItem* MScanListView::childFactory() { return new MScanListItem( this ); } void MScanListView::serializeTo( QDataStream& s) const { qDebug( "serializing MScanListView" ); OListView::serializeTo( s ); } void MScanListView::serializeFrom( QDataStream& s) { qDebug( "serializing MScanListView" ); OListView::serializeFrom( s ); } void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal, - const GpsLocation& loc ) + const GpsLocation& loc, + bool probe ) { QString macaddr = mac.toString(true); #ifdef DEBUG qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, (const char*) essid, (const char*) macaddr, channel ); #endif // search, if we already have seen this net QString s; MScanListItem* network; MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); while ( item && ( item->text( col_essid ) != essid ) ) { #ifdef DEBUG qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this net, check all childs if MAC exists network = item; item = static_cast<MScanListItem*> ( item->firstChild() ); assert( item ); // this shouldn't fail while ( item && ( item->text( col_ap ) != macaddr ) ) { #ifdef DEBUG qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); #endif item = static_cast<MScanListItem*> ( item->nextSibling() ); } if ( item ) { // we have already seen this item, it's a dupe #ifdef DEBUG qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); #endif item->receivedBeacon(); return; } } 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 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? #ifdef DEBUG qDebug( "inserting new station %s", (const char*) macaddr ); #endif MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); station->setManufacturer( mac.manufacturer() ); station->setLocation( loc.dmsPosition() ); if ( type == "managed" ) { s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); } else { 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 ) { MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) { #ifdef DEBUG qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // Hey, it seems to be a new item :-D MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); station->setManufacturer( addr.manufacturer() ); QString s; if ( type == "station" ) { s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); } else { s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); } MLogWindow::logwindow()->log( s ); } void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != viaFrom.toString(true) && it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); } else { qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); } } void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); } else { qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); } } void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { QString s; MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; MScanListItem* item = static_cast<MScanListItem*>( it.current() ); if ( item ) // AP has shown up yet, so just add our new "from" - station { addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); } else { qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); } } void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) { qWarning( "D'oh! Not yet implemented..." ); MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); } void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { it.current()->setText( col_ip, ip ); return; } } qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView // (Hmm, didn't I already start something in this direction?) QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { if ( it.current()->text( col_ap ) == macaddr.toString(true) ) { MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); while ( subitem && ( subitem->text( col_essid ) != name ) ) { #ifdef DEBUG qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); #endif subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); } if ( subitem ) { // we have already seen this item, it's a dupe #ifdef DEBUG qDebug( "%s is a dupe - ignoring...", (const char*) name ); #endif subitem->receivedBeacon(); //FIXME: sent data bit return; } // never seen that - add new item MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); item->setText( col_essid, name ); return; } } qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", (const char*) macaddr.toString(), (const char*) ip ) ); } void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) { if ( !item ) return; MScanListItem* itm = static_cast<MScanListItem*>( item ); qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", (const char*) itm->text(0), (const char*) itm->type, col ); if ( itm->type == "adhoc" || itm->type == "managed" ) { QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); QPopupMenu m( this ); m.insertItem( entry, 37773, 0 ); int result = m.exec( QCursor::pos() ); if ( result == 37773 ) emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); } } //============================================================ // 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 ) { #ifdef DEBUG qDebug( "creating scanlist item" ); #endif 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 ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { #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 { if ( type == "network" ) return _essid; else return ( (MScanListItem*) parent() )->essid(); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); } void MScanListItem::serializeTo( QDataStream& s ) const { #ifdef DEBUG qDebug( "serializing MScanListItem" ); #endif OListViewItem::serializeTo( s ); s << _type; s << (Q_UINT8) ( _wep ? 'y' : 'n' ); } void MScanListItem::serializeFrom( QDataStream& s ) { #ifdef DEBUG qDebug( "serializing MScanListItem" ); #endif OListViewItem::serializeFrom( s ); char wep; s >> _type; 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 ) +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, (const char*) essid, (const char*) macaddr, channel ); #endif // set icon for managed or adhoc mode 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! // set channel and signal text if ( signal != -1 ) setText( col_sig, QString::number( signal ) ); if ( channel != -1 ) setText( col_channel, QString::number( channel ) ); setText( col_firstseen, QTime::currentTime().toString() ); //setText( col_lastseen, QTime::currentTime().toString() ); listView()->triggerUpdate(); this->type = type; _type = type; _essid = essid; _macaddr = macaddr; _channel = channel; _beacons = 1; _signal = 0; if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) { listView()->ensureItemVisible( this ); } } void MScanListItem::setManufacturer( const QString& manufacturer ) { setText( col_manuf, manufacturer ); } void MScanListItem::setLocation( const QString& location ) { setText( col_location, location ); } void MScanListItem::receivedBeacon() { _beacons++; #ifdef DEBUG qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); #endif setText( col_sig, QString::number( _beacons ) ); setText( col_lastseen, QTime::currentTime().toString() ); MScanListItem* p = (MScanListItem*) parent(); if ( p ) p->receivedBeacon(); } 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 @@ -1,139 +1,140 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #ifndef SCANLIST_H #define SCANLIST_H #include "gps.h" /* OPIE */ #include <opie2/olistview.h> #include <opie2/onetutils.h> /* QT */ #include <qtextstream.h> class QString; class MScanListItem; class MScanListView: public OListView { Q_OBJECT public: MScanListView( QWidget* parent = 0, const char* name = 0 ); virtual ~MScanListView(); virtual OListViewItem* childFactory(); 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 ); void WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ); void IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ); void identify( const OMacAddress&, const QString& ipaddr ); void contextMenuRequested( QListViewItem* item, const QPoint&, int ); signals: void rightButtonClicked(QListViewItem*,const QPoint&,int); void joinNetwork( const QString&, const QString&, int, const QString& ); protected: void addIfNotExisting( MScanListItem* parent, const OMacAddress& addr, const QString& type = "station" ); }; //****************************** MScanListItem **************************************************************** class MScanListItem: public OListViewItem { public: MScanListItem::MScanListItem( QListView* parent, const QString& type = "unknown", 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", const QString& macaddr = "unknown", bool wep = false, int channel = 0, 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; public: //const QString& type() { return _type; }; const QString& essid() const; const QString& macaddr() { return _macaddr; }; bool wep() { return _wep; }; int channel() { return _channel; }; int signal() { return _signal; }; int beacons() { return _beacons; }; void setSignal( int signal ) { /* TODO */ }; void receivedBeacon(); void setManufacturer( const QString& manufacturer ); void setLocation( const QString& location ); virtual OListViewItem* childFactory(); virtual void serializeTo( QDataStream& s ) const; virtual void serializeFrom( QDataStream& s ); private: QString _type; QString _essid; QString _macaddr; bool _wep; int _channel; int _signal; int _beacons; }; //****************************** MScanListViewFactory **************************************************************** /* class MScanListViewFactory : public OListViewFactory { public: virtual QListView* listViewFactory(); virtual QListViewItem* listViewItemFactory( QListView* lv ); virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); } */ #endif 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 @@ -1,687 +1,720 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ***********************************************************************/ // Local #include "gps.h" #include "wellenreiter.h" #include "scanlist.h" #include "logwindow.h" #include "hexwindow.h" #include "configwindow.h" #include "statwindow.h" #include "graphwindow.h" #include "protolistview.h" // Opie #ifdef QWS #include <opie/odevice.h> #include <qpe/qcopenvelope_qws.h> using namespace Opie; #endif #ifdef QWS #include <opie2/oapplication.h> #else #include <qapplication.h> #endif #include <opie2/omanufacturerdb.h> #include <opie2/onetwork.h> #include <opie2/opcap.h> // Qt #include <qcheckbox.h> #include <qcombobox.h> #include <qdatetime.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qobjectlist.h> #include <qregexp.h> #include <qspinbox.h> #include <qtimer.h> #include <qtoolbutton.h> #include <qmainwindow.h> // Standard #include <assert.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <stdlib.h> Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), sniffing( false ), iface( 0 ), configwindow( 0 ) { logwindow->log( "(i) Wellenreiter has been started." ); // // detect operating system // #ifdef QWS QString sys; sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); #endif netview->setColumnWidthMode( 1, QListView::Manual ); connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); pcap = new OPacketCapturer(); gps = new GPS( this ); QTimer::singleShot( 1000, this, SLOT( initialTimer() ) ); } Wellenreiter::~Wellenreiter() { delete pcap; } void Wellenreiter::initialTimer() { qDebug( "Wellenreiter::preloading manufacturer database..." ); OManufacturerDB::instance(); } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } void Wellenreiter::channelHopped(int c) { QString title = "Wellenreiter II -scan- ["; QString left; if ( c > 1 ) left.fill( '.', c-1 ); title.append( left ); title.append( '|' ); if ( c < iface->channels() ) { QString right; right.fill( '.', iface->channels()-c ); title.append( right ); } title.append( "]" ); //title.append( QString().sprintf( " %02d", c ) ); assert( parent() ); ( (QMainWindow*) parent() )->setCaption( title ); } void Wellenreiter::handleNotification( OPacket* p ) { QObjectList* l = p->queryList(); QObjectListIt it( *l ); QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); 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::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"; } 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( 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() ); } 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 ) ); + 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() ); } } 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() ); from = wlan->macAddress2(); to = wlan->macAddress3(); } else if ( wlan->fromDS() && wlan->toDS() ) { netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); from = wlan->macAddress4(); to = wlan->macAddress3(); } else { 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( -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() ); } else if ( arp->type() == "REPLY" ) { netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); } } } void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) { //TODO: Implement more IP based protocols ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); if ( dhcp ) { qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); if ( dhcp->type() == "OFFER" ) { qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); } else if ( dhcp->type() == "ACK" ) { qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } } QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) { if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) return 0; return p->child( protocol ); } bool Wellenreiter::checkDumpPacket( OPacket* p ) { // go through all child packets and see if one is inside the child hierarchy for p // if so, do what the user requested (protocolAction), e.g. pass or discard if ( !configwindow->writeCaptureFile->isChecked() ) return true; // semantic change - we're logging anyway now to /tmp/wellenreiter QObjectList* l = p->queryList(); QObjectListIt it( *l ); QObject* o; while ( (o = it.current()) != 0 ) { QString name = it.current()->name(); if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); if ( action == "Discard" ) { logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); return false; } } else { qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); } ++it; } return true; } void Wellenreiter::receivePacket( OPacket* p ) { hexWindow()->log( p->dump( 8 ) ); if ( checkDumpPacket( p ) ) { pcap->dump( p ); } // 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 ) { 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 ) { handleWlanData( p, wlan, source, dest ); } // check for a wired data frame OEthernetPacket* eth = static_cast<OEthernetPacket*>( childIfToParse( p, "Ethernet" ) ); if ( eth ) { handleEthernetData( p, eth, source, dest ); } // check for an arp frame since arp frames come in two flavours: // 802.11 encapsulates ARP data within IP packets while wired ethernet doesn't. OARPPacket* arp = static_cast<OARPPacket*>( childIfToParse( p, "ARP" ) ); if ( arp ) { handleARPData( p, arp, source, dest ); } // check for a ip frame OIPPacket* ip = static_cast<OIPPacket*>( childIfToParse( p, "IP" ) ); if ( ip ) { handleIPData( p, ip, source, dest ); } //handleNotification( p ); } void Wellenreiter::stopClicked() { if ( iface ) { disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); iface->setChannelHopping(); // stop hopping channels } else killTimers(); pcap->close(); sniffing = false; if ( iface ) { // switch off monitor mode iface->setMode( "managed" ); // switch off promisc flag iface->setPromiscuousMode( false ); system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess } logwindow->log( "(i) Stopped Scanning." ); assert( parent() ); ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); // message the user QMessageBox::information( this, "Wellenreiter II", tr( "Your wireless card\nshould now be usable again." ) ); sniffing = false; emit( stoppedSniffing() ); #ifdef QWS if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) { QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } #else #warning FIXME: setScreenSaverMode is not operational on the X11 build #endif // print out statistics for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) statwindow->updateCounter( it.key(), it.data() ); } void Wellenreiter::startClicked() { // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->driverType(); const int interval = configwindow->hoppingInterval(); if ( ( interface == "" ) || ( cardtype == 0 ) ) { QMessageBox::information( this, "Wellenreiter II", tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); return; } // configure device ONetwork* net = ONetwork::instance(); // TODO: check if interface is wireless and support sniffing for non-wireless interfaces iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! // bring device UP if ( cardtype != DEVTYPE_FILE ) { iface->setUp( true ); if ( !iface->isUp() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); return; } } // set monitor mode bool usePrism = configwindow->usePrismHeader(); switch ( cardtype ) { case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode if ( cardtype < DEVTYPE_FILE ) { if ( cardtype != DEVTYPE_MANUAL ) iface->setMode( "monitor" ); if ( iface->mode() != "monitor" ) { if ( QMessageBox::warning( this, "Wellenreiter II", tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) return; } } // open GPS device if ( configwindow->enableGPS->isChecked() ) { qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); } // open pcap and start sniffing if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? { dumpname = configwindow->captureFileName->text(); if ( dumpname.isEmpty() ) dumpname = "captureFile"; dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); } else // write it anyway ;) { dumpname = "/var/log/dump.wellenreiter"; } if ( cardtype != DEVTYPE_FILE ) pcap->open( interface ); else pcap->open( QFile( interface ) ); qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); return; } // set capturer to non-blocking mode pcap->setBlocking( false ); // start channel hopper if ( cardtype != DEVTYPE_FILE ) { logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window } if ( cardtype != DEVTYPE_FILE ) { // connect socket notifier and start channel hopper connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); } else { // start timer for reading packets startTimer( 100 ); } logwindow->log( "(i) Started Scanning." ); sniffing = true; #ifdef QWS if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) { QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; } #else #warning FIXME: setScreenSaverMode is not operational on the X11 build #endif emit( startedSniffing() ); if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title else { assert( parent() ); ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); } } void Wellenreiter::timerEvent( QTimerEvent* ) { qDebug( "Wellenreiter::timerEvent()" ); OPacket* p = pcap->next(); if ( !p ) // no more packets available { stopClicked(); } else { receivePacket( p ); delete p; } } void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) { #ifdef QWS if ( action == "TouchSound" ) ODevice::inst()->touchSound(); else if ( action == "AlarmSound" ) ODevice::inst()->alarmSound(); else if ( action == "KeySound" ) ODevice::inst()->keySound(); else if ( action == "LedOn" ) ODevice::inst()->setLedState( Led_Mail, Led_On ); else if ( action == "LedOff" ) ODevice::inst()->setLedState( Led_Mail, Led_Off ); else if ( action == "LogMessage" ) logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); else if ( action == "MessageBox" ) QMessageBox::information( this, "Notification!", QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); #else #warning Actions do not work with Qt/X11 yet #endif } void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) { #ifdef QWS if ( !iface ) { QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); return; } if ( sniffing ) { QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); return; } qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", (const char*) iface->name(), (const char*) type, (const char*) essid, channel, (const char*) macaddr ); QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; qDebug("sending %d messages",count); msg << QString("count") << QString::number(count); qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); msg << QString(iface->name()) << QString("Mode") << type; qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); msg << QString(iface->name()) << QString("ESSID") << essid; qDebug("msg >%s< channel >%d<", iface->name(),channel); msg << QString(iface->name()) << QString("Channel") << channel; // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); // msg << QString(iface->name()) << QString("MacAddr") << macaddr; #else QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); #endif } 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 @@ -1,106 +1,109 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #ifndef WELLENREITER_H #define WELLENREITER_H #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; class Wellenreiter : public WellenreiterBase { Q_OBJECT public: Wellenreiter( QWidget* parent = 0 ); ~Wellenreiter(); void setConfigWindow( WellenreiterConfigWindow* cw ); MScanListView* netView() const { return netview; }; MLogWindow* logWindow() const { return logwindow; }; MHexWindow* hexWindow() const { return hexwindow; }; bool isDaemonRunning() const { return sniffing; }; QString captureFileName() const { return dumpname; }; public: bool sniffing; protected: virtual void timerEvent( QTimerEvent* ); public slots: void initialTimer(); 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 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 ); 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 #endif QString dumpname; OWirelessNetworkInterface* iface; OPacketCapturer* pcap; WellenreiterConfigWindow* configwindow; GPS* gps; //void readConfig(); //void writeConfig(); }; #endif |