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) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui310
-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.cpp15
4 files changed, 229 insertions, 113 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
@@ -10,10 +10,10 @@
<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>
@@ -24,18 +24,18 @@
</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>
@@ -82,27 +82,9 @@
</property>
</widget>
</hbox>
</widget>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout7</cstring>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>2</number>
- </property>
- <widget row="0" column="0" >
+ <widget row="1" column="0" rowspan="1" colspan="2" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>interfaceName</cstring>
@@ -115,24 +97,9 @@
<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>
- <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="1" column="0" >
+ <widget row="2" column="0" rowspan="1" colspan="2" >
<class>QComboBox</class>
<item>
<property>
<name>text</name>
@@ -188,23 +155,8 @@
<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>
@@ -233,9 +185,9 @@
<name>whatsThis</name>
<string>Choose the channel hop interval.</string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget row="3" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel3_3</cstring>
@@ -248,9 +200,9 @@
<name>text</name>
<string>Hop Interval</string>
</property>
</widget>
- <widget row="1" column="1" >
+ <widget row="2" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel2_3</cstring>
@@ -263,9 +215,9 @@
<name>text</name>
<string>Device Type</string>
</property>
</widget>
- <widget row="0" column="1" >
+ <widget row="1" column="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
@@ -278,90 +230,50 @@
<name>text</name>
<string>Interface Name</string>
</property>
</widget>
- </grid>
- </widget>
- <widget>
- <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>
+ <widget row="5" column="0" >
<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>
+ <cstring>TextLabel1_5</cstring>
</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>
+ <string>Fake MAC:</string>
</property>
</widget>
- </hbox>
- </widget>
- <widget>
- <class>QCheckBox</class>
+ <widget row="5" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
<property stdset="1">
<name>name</name>
- <cstring>groupNetworks</cstring>
+ <cstring>MAC</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Group Detected Networks</string>
+ <string>44:44:44:44:44:44</string>
</property>
</widget>
- <widget>
+ <widget row="4" column="0" rowspan="1" colspan="3" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>enableActivity</cstring>
+ <cstring>activeScanning</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
<property stdset="1">
<name>text</name>
- <string>Enable Activity Display</string>
+ <string>Active Scanning (caution!)</string>
</property>
</widget>
- <widget>
+ <widget row="10" column="0" rowspan="1" colspan="3" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout5</cstring>
@@ -460,7 +372,183 @@
</property>
</widget>
</grid>
</widget>
- </vbox>
+ <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>writeCaptureFile</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Write Capture File</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>getCaptureFileName</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>...</string>
+ </property>
+ </widget>
+ </hbox>
+ </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>
+ <spacer row="6" column="2" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <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 row="9" 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>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_4</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>CaptureFile:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>captureFileName</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </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
@@ -20,11 +20,13 @@
/* 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 */
@@ -84,8 +86,9 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
WellenreiterConfigWindow::_instance = this;
connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
+ connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
};
int WellenreiterConfigWindow::daemonDeviceType()
@@ -111,9 +114,9 @@ int WellenreiterConfigWindow::daemonHopInterval()
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 );
}
@@ -123,4 +126,15 @@ void WellenreiterConfigWindow::changedDeviceType(int t)
}
}
+
+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
@@ -44,8 +44,9 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
static WellenreiterConfigWindow* instance() { return _instance; };
public slots:
void changedDeviceType(int);
+ void getCaptureFileNameClicked();
protected:
QMap<QString, int> _devicetype;
static WellenreiterConfigWindow* _instance;
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
@@ -29,11 +29,13 @@ using namespace Opie;
#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>
@@ -319,11 +321,22 @@ void Wellenreiter::startClicked()
}
// open pcap and start sniffing
if ( cardtype != DEVTYPE_FILE )
+ {
+ 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 ) ));