From cfb7335c5b65a79f5817b393e5a8b3345558f220 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Wed, 07 Jan 2004 23:04:55 +0000 Subject: A bunch of miscellaneous changes and improvements. read the ChangeLog :) Oh and it's WIP - not everything mentioned there works already. Will soon, though. --- (limited to 'noncore') diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog index 8bf8cc8..d4dca9f 100644 --- a/noncore/net/wellenreiter/ChangeLog +++ b/noncore/net/wellenreiter/ChangeLog @@ -1,5 +1,10 @@ 2004-??-?? Michael Lauer + * 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. + * 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 command line option "-nocheck" to skip non-root and dhcp tests * Improved the speed reading the manufacturer list diff --git a/noncore/net/wellenreiter/TODO b/noncore/net/wellenreiter/TODO index ff98eaf..ab171c8 100644 --- a/noncore/net/wellenreiter/TODO +++ b/noncore/net/wellenreiter/TODO @@ -8,7 +8,7 @@ - identification of probe requests i.e. other sniffers around -- decloaking of falsely reported zero-length SSIDs +- decloaking of falsely reported SSIDs [done] - option to launch an external application (i.e. qcop) on - new net @@ -33,3 +33,6 @@ packet dissection framework... (unlikely) - revamp hex window, make it more sophisticated than just a QMultiLineEdit + +- write kismet-like .network format and format to be importable into AutoRoute + diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 2c335df..de6abfc 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -11,8 +11,8 @@ 0 0 - 303 - 343 + 250 + 371 @@ -706,11 +706,11 @@ margin - 6 + 5 spacing - 6 + 3 QCheckBox @@ -774,74 +774,251 @@ enabled - false + true title - Action On Detecting + Action on detecting a new + + + layoutMargin + + + layoutSpacing margin - 11 + 3 spacing - 6 + 0 - - QLabel - - name - TextLabel2 - - - text - New Wireless Station - - - QLabel - - name - TextLabel1_3 - - - text - New Network - - - - QComboBox - - name - newNetwork - - - - QComboBox - - name - newWirelessStation - - - - QComboBox + QLayoutWidget name - newStation + Layout6 - - - QLabel - - name - TextLabel3 + + layoutMargin - - text - New Station + + layoutSpacing + + + margin + 2 + + + spacing + 2 + + + QLabel + + name + TextLabel3 + + + text + Wired Station: + + + + QLabel + + name + TextLabel1_3 + + + text + Network: + + + + QComboBox + + + text + <Ignore> + + + + + text + Play Alarm + + + + + text + Play Click + + + + + text + Blink LED + + + + + text + Run Script + + + + name + newClientAction + + + sizePolicy + + 7 + 0 + + + + + QLineEdit + + name + newClientScript + + + enabled + true + + + + QLabel + + name + TextLabel2 + + + text + Wireless Station: + + + + QComboBox + + + text + <Ignore> + + + + + text + Play Alarm + + + + + text + Play Click + + + + + text + Blink LED + + + + + text + Run Script + + + + name + newStationAction + + + sizePolicy + + 7 + 0 + + + + + QComboBox + + + text + <Ignore> + + + + + text + Play Alarm + + + + + text + Play Click + + + + + text + Blink LED + + + + + text + Run Script + + + + name + newNetworkAction + + + sizePolicy + + 7 + 0 + + + + editable + false + + + + QLineEdit + + name + newNetworkScript + + + enabled + true + + + + QLineEdit + + name + newStationScript + + + enabled + true + + + diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index f536f4e..1341d03 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -17,6 +17,13 @@ #include "configwindow.h" #include "mainwindow.h" +/* OPIE */ +#include +#ifdef QWS +#include +#include +#endif + /* QT */ #include #include @@ -26,17 +33,11 @@ #include #include #include +#include #include #include #include -/* OPIE */ -#include - -#ifdef QWS -#include -#include -#endif WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; @@ -72,12 +73,18 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char WellenreiterConfigWindow::_instance = this; connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); + connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); + connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); + connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); // make the checkbox 'channelAll' control all other channels connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); + + // hide tab4 (parse) until Wellenreiter 1.2 + tab->removePage( tab_4 ); }; @@ -185,6 +192,36 @@ void WellenreiterConfigWindow::changedDeviceType(int t) } +void WellenreiterConfigWindow::synchronizeActionsAndScripts() +{ + if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); + if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); + if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); + + //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); + //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); + //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); +} + + +void WellenreiterConfigWindow::changedNetworkAction(int t) +{ + synchronizeActionsAndScripts(); +} + + +void WellenreiterConfigWindow::changedClientAction(int t) +{ + synchronizeActionsAndScripts(); +} + + +void WellenreiterConfigWindow::changedStationAction(int t) +{ + synchronizeActionsAndScripts(); +} + + void WellenreiterConfigWindow::getCaptureFileNameClicked() { QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); @@ -235,6 +272,45 @@ int WellenreiterConfigWindow::gpsPort() const } +void WellenreiterConfigWindow::performAction( const QString& type ) +{ + int action; + QString script; + + if ( type == "network" ) + { + action = newNetworkAction->currentItem(); + script = newNetworkScript->text(); + } + else if ( type == "managed" || type == "adhoc" ) + { + action = newClientAction->currentItem(); + script = newClientScript->text(); + } + else if ( type == "station" ) + { + action = newStationAction->currentItem(); + script = newStationScript->text(); + } + else + { + qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); + return; + } + + qDebug( "going to perform action %d (script='%s')", action, (const char*) script ); + + /* + + if ( sound == "Ignore" ) return; + else if ( sound == "Touch" ) ODevice::inst()->touchSound(); + else if ( sound == "Key" ) ODevice::inst()->keySound(); + else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); + + */ +} + + void WellenreiterConfigWindow::load() { #ifdef Q_WS_X11 @@ -290,6 +366,13 @@ void WellenreiterConfigWindow::load() lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); openTree->setChecked( c->readBoolEntry( "openTree", true ) ); disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); + newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) ); + newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); + newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) ); + newClientScript->setText( c->readEntry( "newClientScript", "" ) ); + newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) ); + newStationScript->setText( c->readEntry( "newStationScript", "" ) ); + synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand c->setGroup( "GPS" ); enableGPS->setChecked( c->readBoolEntry( "use", false ) ); @@ -333,6 +416,12 @@ void WellenreiterConfigWindow::save() c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); c->writeEntry( "openTree", openTree->isChecked() ); c->writeEntry( "disablePM", disablePM->isChecked() ); + c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); + c->writeEntry( "newNetworkScript", newNetworkScript->text() ); + c->writeEntry( "newClientAction", newClientAction->currentItem() ); + c->writeEntry( "newClientScript", newClientScript->text() ); + c->writeEntry( "newStationAction", newStationAction->currentItem() ); + c->writeEntry( "newStationScript", newStationScript->text() ); c->setGroup( "GPS" ); c->writeEntry( "use", enableGPS->isChecked() ); diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h index 80b4d2b..b082331 100644 --- a/noncore/net/wellenreiter/gui/configwindow.h +++ b/noncore/net/wellenreiter/gui/configwindow.h @@ -57,9 +57,16 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase public slots: void changedDeviceType(int); + void changedNetworkAction(int t); + void changedClientAction(int t); + void changedStationAction(int t); void getCaptureFileNameClicked(); void performAutodetection(); void channelAllClicked(int); + void performAction( const QString& ); + + protected: + void synchronizeActionsAndScripts(); protected: QMap _devicetype; diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index 31f95ce..b814427 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp @@ -58,23 +58,23 @@ GpsLocation GPS::position() const QString str; stream.readRawBytes( &buf[0], 7 ); - float lat = -111.111; + float lat = -111; stream >> lat; stream.skipWhiteSpace(); - float lon = -111.111; + float lon = -111; stream >> lon; stream.readRawBytes( &buf[0], 200 ); // read and discard the stuff until EOF return GpsLocation( lat, lon ); } } - return GpsLocation( -111.111, -111.111 ); + return GpsLocation( -111, -111 ); } QString GpsLocation::dmsPosition() const { - if ( _latitude == -111.111 || _longitude == -111.11 ) + if ( _latitude == -111 || _longitude == -111 ) return "N/A"; if ( _latitude == 0.0 && _longitude == 0.0 ) return "NULL"; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index d89c71f..470646d 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -26,11 +26,8 @@ #ifdef QWS #include -#include -using namespace Opie; #endif - #ifdef QWS #include #else @@ -421,8 +418,10 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS #ifdef DEBUG qDebug( "creating scanlist item" ); #endif - if ( WellenreiterConfigWindow::instance() && type == "network" ) - playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); + + if ( WellenreiterConfigWindow::instance() ) + WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here + decorateItem( type, essid, macaddr, wep, channel, signal ); } @@ -539,17 +538,6 @@ void MScanListItem::setLocation( const QString& location ) } -void MScanListItem::playSound( const QString& sound ) const -{ - #ifdef QWS - if ( sound == "Ignore" ) return; - else if ( sound == "Touch" ) ODevice::inst()->touchSound(); - else if ( sound == "Key" ) ODevice::inst()->keySound(); - else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); - #endif -} - - void MScanListItem::receivedBeacon() { _beacons++; diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 6cd8fc0..42f35c2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -109,9 +109,6 @@ class MScanListItem: public OListViewItem virtual void serializeTo( QDataStream& s ) const; virtual void serializeFrom( QDataStream& s ); - protected: - void playSound( const QString& ) const; - private: QString _type; QString _essid; diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 45d7142..25632f3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -181,13 +181,13 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* } OWaveLanManagementSSID* ssid = static_cast( p->child( "802.11 SSID" ) ); - QString essid = ssid ? ssid->ID() : QString(""); + QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString(""); OWaveLanManagementDS* ds = static_cast( p->child( "802.11 DS" ) ); int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast( p->child( "802.11" ) ); - GpsLocation loc( -111.111, -111.111 ); + GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) { // TODO: add check if GPS is working!? @@ -216,7 +216,7 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro if ( control->controlType() == "Acknowledge" ) { - netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111.111, -111.111 ) ); + netView()->addNewItem( "adhoc", "???", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); } else { @@ -260,7 +260,7 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd from = data->sourceAddress(); to = data->destinationAddress(); - netView()->addNewItem( "station", "", from, false, -1, 0, GpsLocation( -111.111, -111.111 ) ); + netView()->addNewItem( "station", "", from, false, -1, 0, GpsLocation( -111, -111 ) ); } diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control index 18bac98..1d8c482 100644 --- a/noncore/net/wellenreiter/opie-wellenreiter.control +++ b/noncore/net/wellenreiter/opie-wellenreiter.control @@ -5,6 +5,6 @@ Section: opie/applications Maintainer: Michael 'Mickey' Lauer Architecture: arm Version: 1.0.2-$SUB_VERSION -Depends: libqpe1, libpcap0 (0.7.2), libopiecore2, libopienet2, libopieui2 +Depends: libqpe1, libpcap0 (0.7.2), libopiecore2, libopienet2 (>=1.8.3), libopieui2 Description: A WaveLAN Network Monitor A WaveLAN Network Monitor/Sniffer for the Opie Environment. -- cgit v0.9.0.2