author | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-07 23:04:55 (UTC) |
commit | cfb7335c5b65a79f5817b393e5a8b3345558f220 (patch) (side-by-side diff) | |
tree | a8d2d2bcc0bd29a6aac7fec7325f058f148d466e | |
parent | c4d6574e85f74d6086c1709ecf0d117df7417222 (diff) | |
download | opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.zip opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.gz opie-cfb7335c5b65a79f5817b393e5a8b3345558f220.tar.bz2 |
A bunch of miscellaneous changes and improvements. read the ChangeLog :)
Oh and it's WIP - not everything mentioned there works already. Will soon, though.
-rw-r--r-- | noncore/net/wellenreiter/ChangeLog | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/TODO | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 287 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 103 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 7 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gps.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/opie-wellenreiter.control | 2 |
10 files changed, 357 insertions, 91 deletions
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,26 +1,31 @@ 2004-??-?? Michael Lauer <mickey@Vanille.de> + * 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 * 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. 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 @@ -1,35 +1,38 @@ - beep over headphone / customizable - add configuration for scrollback buffer in hex window and log window - implement beacon stripping (the first beacon is enough to detect a new network - further beacons just blow up the capture file) - 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 - new station - <whatever> event - adaptive hopping scheme ! - display interface capabilities - enable sniffing in wired networks - enable multiple packet sources - infrared - bluetooth - usb? - define packet structure in a metalanguage and generate the actual parsing code (hmmm) - pester the ethereal folks to settle for an application independant 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 @@ -1,39 +1,39 @@ <!DOCTYPE UI><UI> <class>WellenreiterConfigBase</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>WellenreiterConfigBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>303</width> - <height>343</height> + <width>250</width> + <height>371</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Wellenreiter II COnfiguration Dialog</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" > <class>QTabWidget</class> <property stdset="1"> @@ -685,53 +685,53 @@ </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>UI</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> - <number>6</number> + <number>5</number> </property> <property stdset="1"> <name>spacing</name> - <number>6</number> + <number>3</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>lookupVendor</cstring> </property> <property stdset="1"> <name>text</name> <string>Lookup MAC vendor names</string> </property> </widget> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>openTree</cstring> </property> <property stdset="1"> <name>text</name> <string>Open Tree On New Station</string> </property> </widget> <widget> @@ -753,116 +753,293 @@ <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox4_2</cstring> </property> <property stdset="1"> <name>enabled</name> - <bool>false</bool> + <bool>true</bool> </property> <property stdset="1"> <name>title</name> - <string>Action On Detecting</string> + <string>Action on detecting a new</string> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> - <number>11</number> + <number>3</number> </property> <property stdset="1"> <name>spacing</name> - <number>6</number> + <number>0</number> </property> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>New Wireless Station</string> - </property> - </widget> <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>New Network</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>newNetwork</cstring> - </property> - </widget> - <widget row="1" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>newWirelessStation</cstring> - </property> - </widget> - <widget row="2" column="1" > - <class>QComboBox</class> + <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> - <cstring>newStation</cstring> + <cstring>Layout6</cstring> </property> - </widget> - <widget row="2" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> + <property> + <name>layoutMargin</name> </property> - <property stdset="1"> - <name>text</name> - <string>New Station</string> + <property> + <name>layoutSpacing</name> </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>2</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget row="4" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Wired Station:</string> + </property> + </widget> + <widget row="0" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1_3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Network:</string> + </property> + </widget> + <widget row="2" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newClientAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="3" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newClientScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + <widget row="2" column="0" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Wireless Station:</string> + </property> + </widget> + <widget row="4" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newStationAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + </widget> + <widget row="0" column="1" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><Ignore></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Alarm</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Play Click</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Blink LED</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Run Script</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>newNetworkAction</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>editable</name> + <bool>false</bool> + </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newNetworkScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + <widget row="5" column="0" rowspan="1" colspan="2" > + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>newStationScript</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>true</bool> + </property> + </widget> + </grid> </widget> </grid> </widget> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Intrusion</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>6</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> 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 @@ -1,104 +1,111 @@ /********************************************************************** ** 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 "configwindow.h" #include "mainwindow.h" +/* OPIE */ +#include <opie2/onetwork.h> +#ifdef QWS +#include <opie2/oapplication.h> +#include <opie2/oconfig.h> +#endif + /* QT */ #include <qapplication.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qfile.h> #include <qlineedit.h> #include <qlayout.h> #include <qmap.h> #include <qpushbutton.h> +#include <qtabwidget.h> #include <qtoolbutton.h> #include <qspinbox.h> #include <qtextstream.h> -/* OPIE */ -#include <opie2/onetwork.h> - -#ifdef QWS -#include <opie2/oapplication.h> -#include <opie2/oconfig.h> -#endif WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) :WellenreiterConfigBase( parent, name, true, f ) { _devicetype[ "cisco" ] = DEVTYPE_CISCO; _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; _devicetype[ "<file>" ] = DEVTYPE_FILE; // gather possible interface names from ONetwork ONetwork* net = ONetwork::instance(); ONetwork::InterfaceIterator it = net->iterator(); while ( it.current() ) { if ( it.current()->isWireless() ) interfaceName->insertItem( it.current()->name() ); ++it; } load(); #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here QPushButton* okButton = new QPushButton( "ok", this ); okButton->show(); WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); #endif 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 ); }; WellenreiterConfigWindow::~WellenreiterConfigWindow() { save(); } void WellenreiterConfigWindow::performAutodetection() { //TODO: insert modal splash screen here // and sleep a second, so that it looks // like we're actually doing something fancy... ;-) qDebug( "WellenreiterConfigWindow::performAutodetection()" ); // try to guess device type QFile m( "/proc/modules" ); if ( m.open( IO_ReadOnly ) ) { int devicetype(0); QString line; QTextStream modules( &m ); @@ -164,48 +171,78 @@ bool WellenreiterConfigWindow::isChannelChecked( int channel ) const case 12: return channel12->isOn(); case 13: return channel13->isOn(); case 14: return channel14->isOn(); } } void WellenreiterConfigWindow::changedDeviceType(int t) { if ( t != DEVTYPE_FILE ) return; QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); if ( !name.isEmpty() && QFile::exists( name ) ) { interfaceName->insertItem( name ); interfaceName->setCurrentItem( interfaceName->count()-1 ); } else { deviceType->setCurrentItem( _guess ); } } +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); qDebug( "name = %s", (const char*) name ); if ( !name.isEmpty() ) { captureFileName->setText( name ); } } void WellenreiterConfigWindow::channelAllClicked(int state) { bool b = state; channel1->setChecked( b ); channel2->setChecked( b ); channel3->setChecked( b ); channel4->setChecked( b ); channel5->setChecked( b ); channel6->setChecked( b ); channel7->setChecked( b ); channel8->setChecked( b ); channel9->setChecked( b ); channel10->setChecked( b ); @@ -214,48 +251,87 @@ void WellenreiterConfigWindow::channelAllClicked(int state) channel13->setChecked( b ); channel14->setChecked( b ); } bool WellenreiterConfigWindow::useGPS() const { return enableGPS->isChecked(); } const QString WellenreiterConfigWindow::gpsHost() const { return useGPS() ? gpsdHost->currentText() : QString::null; } int WellenreiterConfigWindow::gpsPort() const { bool ok; return useGPS() ? gpsdPort->value() : -1; } +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 #warning Persistent Configuration not yet implemented for standalone X11 build performAutodetection(); #else qDebug( "loading configuration settings..." ); /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); QString interface = c->readEntry( "name", "<none>" ); if ( interface != "<none>" ) { #if QT_VERSION < 300 interfaceName->insertItem( interface, 0 ); interfaceName->setCurrentItem( 0 ); #else interfaceName->setCurrentText( interface ); #endif @@ -269,79 +345,92 @@ void WellenreiterConfigWindow::load() break; } } #else deviceType->setCurrentText( device ); #endif } else { performAutodetection(); } prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); c->setGroup( "Capture" ); captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); c->setGroup( "UI" ); 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 ) ); #if QT_VERSION < 300 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); gpsdHost->setCurrentItem( 0 ); #else gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); #endif gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); startGPS->setChecked( c->readBoolEntry( "start", false ) ); commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); #endif } void WellenreiterConfigWindow::save() { #ifdef Q_WS_X11 #warning Persistent Configuration not yet implemented for standalone X11 build #else qDebug( "saving configuration settings..." ); /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ OConfig* c = oApp->config(); c->setGroup( "Interface" ); c->writeEntry( "name", interfaceName->currentText() ); c->writeEntry( "type", deviceType->currentText() ); c->writeEntry( "prism", prismHeader->isChecked() ); c->writeEntry( "hop", hopChannels->isChecked() ); c->writeEntry( "interval", hopInterval->value() ); c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); c->setGroup( "Capture" ); c->writeEntry( "filename", captureFileName->text() ); c->setGroup( "UI" ); 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() ); c->writeEntry( "host", gpsdHost->currentText() ); c->writeEntry( "port", gpsdPort->value() ); c->writeEntry( "start", startGPS->isChecked() ); c->writeEntry( "command", commandGPS->text() ); c->write(); #endif } 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 @@ -36,36 +36,43 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase Q_OBJECT public: WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); ~WellenreiterConfigWindow(); int driverType() const; const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; static WellenreiterConfigWindow* instance() { return _instance; }; int hoppingInterval() const; bool usePrismHeader() const; bool isChannelChecked( int ) const; bool useGPS() const; const QString gpsHost() const; int gpsPort() const; void save(); void load(); 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<QString, int> _devicetype; static WellenreiterConfigWindow* _instance; int _guess; }; #endif 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 @@ -37,65 +37,65 @@ GPS::~GPS() bool GPS::open( const QString& host, int port ) { _socket->connectToHost( host, port ); } GpsLocation GPS::position() const { char buf[256]; int result = _socket->writeBlock( "p\r\n", 3 ); _socket->flush(); if ( result ) { int numAvail = _socket->bytesAvailable(); qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); if ( numAvail ) { QTextStream stream( _socket ); 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"; /* compute latitude */ QString dms = "N"; if ( _latitude >= 0 ) dms.append( "+" ); int trunc = int( _latitude ); float rest = _latitude - trunc; float minf = rest * 60; int minutes = int( minf ); rest = minf - minutes; int seconds = int( rest * 60 ); dms.append( QString::number( trunc ) ); dms.append( "° " ); dms.append( QString::number( ::abs( minutes ) ) ); dms.append( "' " ); dms.append( QString::number( ::abs( seconds ) ) ); dms.append( "'' " ); 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 @@ -5,53 +5,50 @@ ** ** 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> -#include <opie/odevice.h> -using namespace Opie; #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 ); @@ -400,50 +397,52 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in { 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, QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) :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() && 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 ); } MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, 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 ); } const QString& MScanListItem::essid() const { if ( type == "network" ) return _essid; else return ( (MScanListItem*) parent() )->essid(); } OListViewItem* MScanListItem::childFactory() { return new MScanListItem( this ); @@ -518,49 +517,38 @@ void MScanListItem::decorateItem( QString type, QString essid, QString 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::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++; #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 6cd8fc0..42f35c2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -88,51 +88,48 @@ class MScanListItem: public OListViewItem virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); 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 ); - protected: - void playSound( const QString& ) const; - 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 ); } 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 @@ -160,128 +160,128 @@ void Wellenreiter::handleNotification( OPacket* p ) 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>"); + 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, -111.111 ); + 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, -111.111 ) ); + netView()->addNewItem( "adhoc", "???", 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, -111.111 ) ); + 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 ) { 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 @@ -1,10 +1,10 @@ Package: opie-wellenreiter Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop Priority: optional Section: opie/applications Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> 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. |