summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-10 17:26:35 (UTC)
committer mickeyl <mickeyl>2003-04-10 17:26:35 (UTC)
commit61eb255cc85160f7bb35602bbc10771be4da8708 (patch) (side-by-side diff)
treeb66826f283d0ba41d3e27a44b8a0d63a7abc1238
parent1064aea74c5dd7b3d4f87e483bd85f3fac0cf03c (diff)
downloadopie-61eb255cc85160f7bb35602bbc10771be4da8708.zip
opie-61eb255cc85160f7bb35602bbc10771be4da8708.tar.gz
opie-61eb255cc85160f7bb35602bbc10771be4da8708.tar.bz2
New Feature: Write a capture file for later dissection with tcpdump-compatible tools!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui512
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp17
4 files changed, 331 insertions, 215 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index 3ece270..ba4de32 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -1,466 +1,554 @@
<!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>220</width>
- <height>306</height>
+ <width>236</width>
+ <height>342</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>6</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>1</number>
+ <number>5</number>
</property>
- <widget>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>Sniffer</string>
</property>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line9</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
</hbox>
</widget>
- <widget>
- <class>QLayoutWidget</class>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout7</cstring>
+ <cstring>interfaceName</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property>
- <name>layoutSpacing</name>
+ <name>whatsThis</name>
+ <string>Choose the interface used for sniffing.</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;select&gt;</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>cisco</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>wlan-ng</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>hostap</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>orinoco</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;manual&gt;</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>&lt;file&gt;</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>deviceType</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>whatsThis</name>
+ <string>Choose the type of driver used for sniffing.</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>hopInterval</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>suffix</name>
+ <string> ms</string>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>2000</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>100</number>
+ </property>
+ <property stdset="1">
+ <name>lineStep</name>
+ <number>100</number>
+ </property>
+ <property>
+ <name>whatsThis</name>
+ <string>Choose the channel hop interval.</string>
+ </property>
+ </widget>
+ <widget row="3" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Hop Interval</string>
+ </property>
+ </widget>
+ <widget row="2" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Device Type</string>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Interface Name</string>
+ </property>
+ </widget>
+ <widget row="5" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_5</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Fake MAC:</string>
+ </property>
+ </widget>
+ <widget row="5" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>MAC</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>44:44:44:44:44:44</string>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="3" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>activeScanning</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Active Scanning (caution!)</string>
+ </property>
+ </widget>
+ <widget row="10" column="0" rowspan="1" colspan="3" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>2</number>
+ <number>6</number>
</property>
- <widget row="0" column="0" >
- <class>QComboBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>interfaceName</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property>
- <name>whatsThis</name>
- <string>Choose the interface used for sniffing.</string>
- </property>
- </widget>
- <widget row="4" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
+ <widget row="0" column="1" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>activeScanning</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
+ <cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Active Scanning (caution!)</string>
+ <string>sound on new net</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
- <string>&lt;select&gt;</string>
+ <string>Ignore</string>
</property>
</item>
<item>
<property>
<name>text</name>
- <string>cisco</string>
+ <string>Touch</string>
</property>
</item>
<item>
<property>
<name>text</name>
- <string>wlan-ng</string>
+ <string>Key</string>
</property>
</item>
<item>
<property>
<name>text</name>
- <string>hostap</string>
+ <string>Alarm</string>
</property>
</item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>beaconSound</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QComboBox</class>
<item>
<property>
<name>text</name>
- <string>orinoco</string>
+ <string>Ignore</string>
</property>
</item>
<item>
<property>
<name>text</name>
- <string>&lt;manual&gt;</string>
+ <string>Touch</string>
</property>
</item>
<item>
<property>
<name>text</name>
- <string>&lt;file&gt;</string>
+ <string>Key</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Alarm</string>
</property>
</item>
<property stdset="1">
<name>name</name>
- <cstring>deviceType</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property>
- <name>whatsThis</name>
- <string>Choose the type of driver used for sniffing.</string>
- </property>
- </widget>
- <widget row="3" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>additionalInfo</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Gather Additional Info</string>
- </property>
- </widget>
- <widget row="2" column="0" >
- <class>QSpinBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>hopInterval</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>suffix</name>
- <string> ms</string>
- </property>
- <property stdset="1">
- <name>maxValue</name>
- <number>2000</number>
- </property>
- <property stdset="1">
- <name>minValue</name>
- <number>100</number>
- </property>
- <property stdset="1">
- <name>lineStep</name>
- <number>100</number>
- </property>
- <property>
- <name>whatsThis</name>
- <string>Choose the channel hop interval.</string>
+ <cstring>netSound</cstring>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="1" column="1" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel3_3</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <cstring>TextLabel1_3</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Hop Interval</string>
+ <string>sound on beacon</string>
</property>
</widget>
- <widget row="1" column="1" >
- <class>QLabel</class>
+ </grid>
+ </widget>
+ <widget row="8" column="0" rowspan="1" colspan="3" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel2_3</cstring>
+ <cstring>writeCaptureFile</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Device Type</string>
+ <string>Write Capture File</string>
</property>
</widget>
- <widget row="0" column="1" >
- <class>QLabel</class>
+ <widget>
+ <class>QToolButton</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_2</cstring>
+ <cstring>getCaptureFileName</cstring>
</property>
<property stdset="1">
<name>enabled</name>
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Interface Name</string>
+ <string>...</string>
</property>
</widget>
- </grid>
+ </hbox>
</widget>
- <widget>
+ <widget row="7" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
<property>
<name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_2_2</cstring>
</property>
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>1</vsizetype>
</sizepolicy>
</property>
<property stdset="1">
<name>text</name>
<string>GUI</string>
</property>
</widget>
<widget>
<class>Line</class>
<property stdset="1">
<name>name</name>
<cstring>Line9_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
</widget>
</hbox>
</widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
+ <spacer row="6" column="2" >
+ <property>
<name>name</name>
- <cstring>groupNetworks</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
+ <cstring>Spacer1</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Group Detected Networks</string>
+ <name>orientation</name>
+ <enum>Vertical</enum>
</property>
- </widget>
- <widget>
- <class>QCheckBox</class>
<property stdset="1">
- <name>name</name>
- <cstring>enableActivity</cstring>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
- <property stdset="1">
- <name>enabled</name>
- <bool>false</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Enable Activity Display</string>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
</property>
- </widget>
- <widget>
+ </spacer>
+ <widget row="9" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout5</cstring>
+ <cstring>Layout7</cstring>
</property>
- <grid>
+ <hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget row="0" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>TextLabel1_4</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>sound on new net</string>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Ignore</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Touch</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Key</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Alarm</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>beaconSound</cstring>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Ignore</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Touch</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Key</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Alarm</string>
- </property>
- </item>
- <property stdset="1">
- <name>name</name>
- <cstring>netSound</cstring>
+ <string>CaptureFile:</string>
</property>
</widget>
- <widget row="1" column="1" >
- <class>QLabel</class>
+ <widget>
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel1_3</cstring>
+ <cstring>captureFileName</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>sound on beacon</string>
+ <name>enabled</name>
+ <bool>false</bool>
</property>
</widget>
- </grid>
+ </hbox>
</widget>
- </vbox>
+ </grid>
</widget>
+<connections>
+ <connection>
+ <sender>writeCaptureFile</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>getCaptureFileName</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>activeScanning</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>MAC</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>writeCaptureFile</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>captureFileName</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
</UI>
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 4aca526..716618e 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,126 +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.
**
**********************************************************************/
/* LOCAL */
#include "configwindow.h"
#include "mainwindow.h"
/* QT */
#include <qapplication.h>
#include <qcombobox.h>
#include <qfile.h>
+#include <qlineedit.h>
#include <qlayout.h>
#include <qmap.h>
#include <qpushbutton.h>
+#include <qtoolbutton.h>
#include <qspinbox.h>
#include <qtextstream.h>
/* OPIE */
#include <opie2/onetwork.h>
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;
}
// try to guess device type
QFile m( "/proc/modules" );
if ( m.open( IO_ReadOnly ) )
{
int devicetype(0);
QString line;
QTextStream modules( &m );
while( !modules.atEnd() && !devicetype )
{
modules >> line;
if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
}
if ( devicetype )
{
deviceType->setCurrentItem( devicetype );
_guess = devicetype;
qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
}
}
#ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
QPushButton* okButton = new QPushButton( "ok", this );
okButton->show();
Layout5_2->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( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
};
int WellenreiterConfigWindow::daemonDeviceType()
{
QString name = deviceType->currentText();
if ( _devicetype.contains( name ) )
{
return _devicetype[name];
}
else
{
return 0;
}
};
int WellenreiterConfigWindow::daemonHopInterval()
{
return hopInterval->cleanText().toInt();
}
void WellenreiterConfigWindow::changedDeviceType(int t)
{
if ( t != DEVTYPE_FILE ) return;
QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
- if ( !name.isNull() && QFile::exists( name ) )
+ if ( !name.isEmpty() && QFile::exists( name ) )
{
interfaceName->insertItem( name );
interfaceName->setCurrentItem( interfaceName->count()-1 );
}
else
{
deviceType->setCurrentItem( _guess );
}
}
+
+void WellenreiterConfigWindow::getCaptureFileNameClicked()
+{
+ QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
+ qDebug( "name = %s", (const char*) name );
+ if ( !name.isEmpty() )
+ {
+ captureFileName->setText( name );
+ }
+}
+
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 7df1a80..c7c70a6 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,56 +1,57 @@
/**********************************************************************
** 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 WELLENREITERCONFIGWINDOW_H
#define WELLENREITERCONFIGWINDOW_H
#include "configbase.h"
#include <qmap.h>
#include <qcombobox.h>
#include <qstring.h>
const int DEVTYPE_SELECT = 0;
const int DEVTYPE_CISCO = 1;
const int DEVTYPE_WLAN_NG = 2;
const int DEVTYPE_HOSTAP = 3;
const int DEVTYPE_ORINOCO = 4;
const int DEVTYPE_MANUAL = 5;
const int DEVTYPE_FILE = 6;
class WellenreiterConfigWindow;
class WellenreiterConfigWindow : public WellenreiterConfigBase
{
Q_OBJECT
public:
WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
int daemonDeviceType();
int daemonHopInterval();
const QString soundOnNetwork() const { return netSound->currentText(); };
const QString soundOnBeacon() const { return beaconSound->currentText(); };
static WellenreiterConfigWindow* instance() { return _instance; };
public slots:
void changedDeviceType(int);
+ void getCaptureFileNameClicked();
protected:
QMap<QString, int> _devicetype;
static WellenreiterConfigWindow* _instance;
int _guess;
};
#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 5c10c3b..be2a86e 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -1,131 +1,133 @@
/**********************************************************************
** 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.
**
***********************************************************************/
// Opie
#ifdef QWS
#include <opie/odevice.h>
using namespace Opie;
#endif
#ifdef QWS
#include <opie2/oapplication.h>
#else
#include <qapplication.h>
#endif
#include <opie2/onetwork.h>
#include <opie2/opcap.h>
// Qt
+#include <qcheckbox.h>
+#include <qcombobox.h>
#include <qpushbutton.h>
+#include <qlineedit.h>
#include <qmessagebox.h>
-#include <qcombobox.h>
#include <qspinbox.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>
// Local
#include "wellenreiter.h"
#include "scanlist.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "configwindow.h"
#include "statwindow.h"
#include "manufacturers.h"
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
{
//
// construct manufacturer database
//
QString manufile;
#ifdef QWS
manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
#else
manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
#endif
manufacturerdb = new ManufacturerDB( manufile );
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
// setup GUI
netview->setColumnWidthMode( 1, QListView::Manual );
if ( manufacturerdb )
netview->setManufacturerDB( manufacturerdb );
pcap = new OPacketCapturer();
}
Wellenreiter::~Wellenreiter()
{
// no need to delete child widgets, Qt does it all for us
delete manufacturerdb;
delete pcap;
}
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 );
@@ -227,139 +229,150 @@ void Wellenreiter::stopClicked()
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->setMonitorMode( false );
// 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", "Your wireless card\nshould now be usable again." );
sniffing = false;
emit( stoppedSniffing() );
// print out statistics
statwindow->log( "-----------------------------------------" );
statwindow->log( "- Wellenreiter II Capturing Statistic -" );
statwindow->log( "-----------------------------------------" );
statwindow->log( "Packet Type | Receive Count" );
for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
{
QString left;
left.sprintf( "%s", (const char*) it.key() );
left = left.leftJustify( 20 );
left.append( '|' );
QString right;
right.sprintf( "%d", it.data() );
right = right.rightJustify( 7 );
statwindow->log( left + right );
}
}
void Wellenreiter::startClicked()
{
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
const int cardtype = configwindow->daemonDeviceType();
const int interval = configwindow->daemonHopInterval();
if ( ( interface == "" ) || ( cardtype == 0 ) )
{
QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
return;
}
// configure device
ONetwork* net = ONetwork::instance();
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
// set monitor mode
switch ( cardtype )
{
case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", "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->setMonitorMode( true );
if ( !iface->monitorMode() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
return;
}
}
// open pcap and start sniffing
if ( cardtype != DEVTYPE_FILE )
- pcap->open( interface );
+ {
+ if ( configwindow->writeCaptureFile->isEnabled() )
+ {
+ pcap->open( interface, configwindow->captureFileName->text() );
+ }
+ else
+ {
+ pcap->open( interface );
+ }
+ }
else
+ {
pcap->open( QFile( interface ) );
+ }
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
if ( cardtype != DEVTYPE_FILE )
iface->setChannelHopping( 1000 ); //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;
emit( startedSniffing() );
}
void Wellenreiter::timerEvent( QTimerEvent* )
{
qDebug( "Wellenreiter::timerEvent()" );
OPacket* p = pcap->next();
receivePacket( p );
delete p;
}