-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 322 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 13 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
4 files changed, 179 insertions, 159 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui index 4fc8ea1..2c335df 100644 --- a/noncore/net/wellenreiter/gui/configbase.ui +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -1,110 +1,110 @@ <!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>286</width> - <height>345</height> + <width>303</width> + <height>343</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"> <name>name</name> <cstring>tab</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Interface</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> - <number>11</number> + <number>6</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout7</cstring> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="1" > <class>QComboBox</class> <item> <property> <name>text</name> <string><select></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> @@ -661,247 +661,251 @@ <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Parse</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>5</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" > <class>ProtocolListView</class> <property stdset="1"> <name>name</name> <cstring>parsePackets</cstring> </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>11</number> + <number>6</number> </property> <property stdset="1"> <name>spacing</name> <number>6</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> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>disablePM</cstring> </property> <property stdset="1"> <name>text</name> <string>Disable Power Management</string> </property> </widget> <spacer> <property> <name>name</name> <cstring>Spacer3</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> <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox4_2</cstring> </property> <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> <name>title</name> <string>Action On Detecting</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</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> <property stdset="1"> <name>name</name> <cstring>newStation</cstring> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>New Station</string> </property> </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>11</number> + <number>6</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" > <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>GroupBox3</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>title</name> <string>Link Level</string> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="0" 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="1" column="0" rowspan="1" colspan="2" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>sendProbeRequests</cstring> </property> <property stdset="1"> <name>text</name> <string>Send proble requests</string> @@ -1021,256 +1025,268 @@ <widget row="0" column="1" > <class>QComboBox</class> <item> <property> <name>text</name> <string>192.168.125.1</string> </property> </item> <item> <property> <name>text</name> <string><automatic></string> </property> </item> <property stdset="1"> <name>name</name> <cstring>fakeIP</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>editable</name> <bool>true</bool> </property> <property stdset="1"> <name>currentItem</name> <number>0</number> </property> </widget> </grid> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>GPS</string> </attribute> - <widget> - <class>QLayoutWidget</class> + <grid> <property stdset="1"> - <name>name</name> - <cstring>Layout1</cstring> + <name>margin</name> + <number>5</number> </property> <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>40</y> - <width>216</width> - <height>27</height> - </rect> + <name>spacing</name> + <number>4</number> </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> + <widget row="0" column="0" > + <class>QLayoutWidget</class> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>name</name> + <cstring>Layout6</cstring> </property> - <widget> - <class>QLabel</class> + <vbox> <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_4</cstring> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>text</name> - <string>Host</string> + <name>spacing</name> + <number>6</number> </property> - </widget> - <widget> - <class>QComboBox</class> - <item> - <property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>enableGPS</cstring> + </property> + <property stdset="1"> <name>text</name> - <string>localhost</string> + <string>Enable GPS logging w/ gpsd</string> </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>gpsdHost</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>editable</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>currentItem</name> - <number>0</number> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>:</string> - </property> - </widget> - <widget> - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>gpsdPort</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>maxValue</name> - <number>65535</number> - </property> - <property stdset="1"> - <name>minValue</name> - <number>1024</number> - </property> - <property stdset="1"> - <name>value</name> - <number>2947</number> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>commandGPS</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>110</y> - <width>210</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>gpsd -p /dev/ttyS3 -s 57600</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>enableGPS</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>10</y> - <width>199</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Enable GPS logging w/ gpsd</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>startGPS</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>10</x> - <y>80</y> - <width>171</width> - <height>21</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Start gpsd on localhost</string> - </property> - </widget> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout1</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>Host</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>localhost</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>gpsdHost</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>editable</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>currentItem</name> + <number>0</number> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2_2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>:</string> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>gpsdPort</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>65535</number> + </property> + <property stdset="1"> + <name>minValue</name> + <number>1024</number> + </property> + <property stdset="1"> + <name>value</name> + <number>2947</number> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>startGPS</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Start gpsd on localhost</string> + </property> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>commandGPS</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>text</name> + <string>gpsd -p /dev/ttyS3 -s 57600</string> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer4_2</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> + </vbox> + </widget> + </grid> </widget> </widget> </grid> </widget> <customwidgets> <customwidget> <class>ProtocolListView</class> <header location="local">protolistview.h</header> <sizehint> <width>100</width> <height>100</height> </sizehint> <container>0</container> <sizepolicy> <hordata>3</hordata> <verdata>3</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> <connections> <connection> <sender>hopChannels</sender> <signal>toggled(bool)</signal> <receiver>hopInterval</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>hopChannels</sender> <signal>toggled(bool)</signal> <receiver>TextLabel1</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>enableActiveScanning</sender> <signal>toggled(bool)</signal> <receiver>GroupBox3</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>enableActiveScanning</sender> <signal>toggled(bool)</signal> diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index bb46dd7..ca9851c 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -377,162 +377,165 @@ static const char* CAP_hostname = "www.vanille.de"; #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> void WellenreiterMainWindow::uploadSession() { QLineEdit* from; QLineEdit* location; QLineEdit* comments; QPushButton* accept; QPushButton* reject; QDialog* d = new QDialog( 0, "session upload", true ); d->setCaption( tr( "Upload Session" ) ); QGridLayout* g = new QGridLayout( d, 4, 2, 3 ); g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 ); g->addWidget( from = new QLineEdit( d ), 0, 1 ); g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 ); g->addWidget( location = new QLineEdit( d ), 1, 1 ); g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 ); g->addWidget( comments = new QLineEdit( d ), 2, 1 ); g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 ); g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); accept->setDefault( true ); accept->setAutoDefault( true ); from->setText( "WL II User" ); location->setText( "WL II Location" ); comments->setText( "No Comments." ); connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); int result = d->exec(); if ( !result ) { qDebug( "Session upload cancelled :(" ); return; } qDebug( "Starting upload..." ); struct sockaddr_in raddr; struct hostent *rhost_info; int sock = -1; bool ok = false; rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); if ( rhost_info ) { - if ( !QFile::exists( "/var/log/dump.wellenreiter" ) ) + + + if ( !QFile::exists( mw->captureFileName() ) ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile doesn't exist</p>") ); + QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) ); return; } - QFile f( "/var/log/dump.wellenreiter" ); + QFile f( mw->captureFileName() ); if ( !f.open( IO_ReadOnly ) ) { - QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile</p>") ); + QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) ); return; } int content_length = f.size(); ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); raddr.sin_family = rhost_info-> h_addrtype; raddr.sin_port = htons ( 80 ); sock = ::socket( AF_INET, SOCK_STREAM, 0 ); if ( sock >= 0 ) { if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { QString header; QString content; QString preambel; header = "" "POST /projects/capturedump.spy HTTP/1.1\r\n" "Host: www.vanille.de\r\n" "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031010 Galeon/1.3.10\r\n" "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n" "Accept-Language: en\r\n" "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n" "Accept-Charset: us-ascii,utf-8;q=0.7,*;q=0.7\r\n" "Keep-Alive: 300\r\n" "Connection: keep-alive\r\n" "Referer: http://www.vanille.de/projects/capturedump.spy\r\n" "Content-Type: multipart/form-data; boundary=---------------------------97267758015830030481215568065\r\n" "Content-Length: %1\r\n" "\r\n"; content = "" "-----------------------------97267758015830030481215568065\r\n" "Content-Disposition: form-data; name=\"Name\"\r\n" "\r\n" "%1\r\n" "-----------------------------97267758015830030481215568065\r\n" "Content-Disposition: form-data; name=\"Location\"\r\n" "\r\n" "%2\r\n" "-----------------------------97267758015830030481215568065\r\n" "Content-Disposition: form-data; name=\"Comments\"\r\n" "\r\n" "%3\r\n" "-----------------------------97267758015830030481215568065\r\n" - "Content-Disposition: form-data; name=\"upfile\"; filename=\"/var/log/dump.wellenreiter\"\r\n" + "Content-Disposition: form-data; name=\"upfile\"; filename=\"%4\"\r\n" "Content-Type: application/octet-stream\r\n" "\r\n"; preambel = "" "\r\n-----------------------------97267758015830030481215568065--\r\n"; content = content.arg( from->text().isEmpty() ? QString( "Anonymous Wellenreiter II User" ) : from->text() ); content = content.arg( location->text().isEmpty() ? QString( "Anonymous Wellenreiter II Location" ) : location->text() ); content = content.arg( comments->text().isEmpty() ? QString( "Anonymous Wellenreiter II Comments" ) : comments->text() ); + content = content.arg( mw->captureFileName() ); header = header.arg( QString::number( content.length() + f.size() + preambel.length() ) ); // write header const char* ascii = header.latin1(); uint ascii_len = ::strlen( ascii ); ::write ( sock, ascii, ascii_len ); // write fixed content ascii = content.latin1(); ascii_len = ::strlen( ascii ); ::write ( sock, ascii, ascii_len ); // write variable content char ch; while ( !f.atEnd() ) { f.readBlock( &ch, 1 ); ::write ( sock, &ch, 1 ); } // write preambel ascii = preambel.latin1(); ascii_len = ::strlen( ascii ); ::write ( sock, ascii, ascii_len ); // done! ok = true; } } ::close ( sock ); } if ( ok ) QMessageBox::information( 0, tr( "Success" ), QString ( "<p>%1</p>" ).arg( tr( "Capture Dump was uploaded to %1" ) ).arg( CAP_hostname ) ); else QMessageBox::warning( 0, tr( "Error" ), QString ( "<p>%1</p>" ).arg ( tr( "Connection to %1 failed" ) ).arg( CAP_hostname ) ); } diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index ec89f1e..9255a6d 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -462,97 +462,96 @@ void Wellenreiter::startClicked() // bring device UP if ( cardtype != DEVTYPE_FILE ) { iface->setUp( true ); if ( !iface->isUp() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); return; } } // set monitor mode bool usePrism = configwindow->usePrismHeader(); switch ( cardtype ) { case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; default: assert( 0 ); // shouldn't reach this } // switch device into monitor mode if ( cardtype < DEVTYPE_FILE ) { if ( cardtype != DEVTYPE_MANUAL ) iface->setMode( "monitor" ); if ( iface->mode() != "monitor" ) { if ( QMessageBox::warning( this, "Wellenreiter II", tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) return; } } // open GPS device if ( configwindow->enableGPS->isChecked() ) { qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); } // open pcap and start sniffing - QString dumpname; if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? { dumpname = configwindow->captureFileName->text(); if ( dumpname.isEmpty() ) dumpname = "captureFile"; dumpname.append( '-' ); dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); dumpname.append( ".wellenreiter" ); } else // write it anyway ;) { dumpname = "/var/log/dump.wellenreiter"; } if ( cardtype != DEVTYPE_FILE ) pcap->open( interface ); else pcap->open( QFile( interface ) ); qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); pcap->openDumpFile( dumpname ); if ( !pcap->isOpen() ) { QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); return; } // set capturer to non-blocking mode pcap->setBlocking( false ); // start channel hopper if ( cardtype != DEVTYPE_FILE ) { logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window } if ( cardtype != DEVTYPE_FILE ) { // connect socket notifier and start channel hopper connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); } else { // start timer for reading packets startTimer( 100 ); diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index d882500..58dd1fd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -6,97 +6,99 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #ifndef WELLENREITER_H #define WELLENREITER_H #include "wellenreiterbase.h" #ifdef QWS #include <opie/odevice.h> using namespace Opie; #endif class QTimerEvent; class QPixmap; class OPacket; class OWaveLanManagementPacket; class OWaveLanDataPacket; class OEthernetPacket; class OARPPacket; class OMacAddress; class OIPPacket; class OPacketCapturer; class OWirelessNetworkInterface; class WellenreiterConfigWindow; class MLogWindow; class MHexWindow; class GPS; class Wellenreiter : public WellenreiterBase { Q_OBJECT public: Wellenreiter( QWidget* parent = 0 ); ~Wellenreiter(); void setConfigWindow( WellenreiterConfigWindow* cw ); MScanListView* netView() const { return netview; }; MLogWindow* logWindow() const { return logwindow; }; MHexWindow* hexWindow() const { return hexwindow; }; bool isDaemonRunning() const { return sniffing; }; + QString captureFileName() const { return dumpname; }; public: bool sniffing; protected: virtual void timerEvent( QTimerEvent* ); public slots: void initialTimer(); void channelHopped(int); void receivePacket(OPacket*); void startClicked(); void stopClicked(); void joinNetwork(const QString&,const QString&,int,const QString&); signals: void startedSniffing(); void stoppedSniffing(); private: void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); void handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ); void handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ); void handleARPData( OPacket* p, OARPPacket* arp, OMacAddress& from, OMacAddress& to ); void handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& from, OMacAddress& to ); void handleNotification( OPacket* p ); void doAction( const QString& action, const QString& protocol, OPacket* p ); QObject* childIfToParse( OPacket* p, const QString& protocol ); bool checkDumpPacket( OPacket* p ); private: #ifdef QWS OSystem _system; // Opie Operating System identifier #endif + QString dumpname; OWirelessNetworkInterface* iface; OPacketCapturer* pcap; WellenreiterConfigWindow* configwindow; GPS* gps; //void readConfig(); //void writeConfig(); }; #endif |