summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui8
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp17
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp9
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h1
6 files changed, 45 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index 422826a..590ca92 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -92,48 +92,52 @@
92 </property> 92 </property>
93 <property stdset="1"> 93 <property stdset="1">
94 <name>text</name> 94 <name>text</name>
95 <string>Driver:</string> 95 <string>Driver:</string>
96 </property> 96 </property>
97 </widget> 97 </widget>
98 <widget row="2" column="0" rowspan="1" colspan="4" > 98 <widget row="2" column="0" rowspan="1" colspan="4" >
99 <class>QCheckBox</class> 99 <class>QCheckBox</class>
100 <property stdset="1"> 100 <property stdset="1">
101 <name>name</name> 101 <name>name</name>
102 <cstring>prismHeader</cstring> 102 <cstring>prismHeader</cstring>
103 </property> 103 </property>
104 <property stdset="1"> 104 <property stdset="1">
105 <name>text</name> 105 <name>text</name>
106 <string>Use additional PRISM header</string> 106 <string>Use additional PRISM header</string>
107 </property> 107 </property>
108 </widget> 108 </widget>
109 <widget row="6" column="0" rowspan="1" colspan="4" > 109 <widget row="6" column="0" rowspan="1" colspan="4" >
110 <class>QGroupBox</class> 110 <class>QGroupBox</class>
111 <property stdset="1"> 111 <property stdset="1">
112 <name>name</name> 112 <name>name</name>
113 <cstring>GroupBox1</cstring> 113 <cstring>GroupBox1</cstring>
114 </property> 114 </property>
115 <property stdset="1"> 115 <property stdset="1">
116 <name>enabled</name>
117 <bool>false</bool>
118 </property>
119 <property stdset="1">
116 <name>title</name> 120 <name>title</name>
117 <string>Scan on channel</string> 121 <string>Scan on channel</string>
118 </property> 122 </property>
119 <property> 123 <property>
120 <name>layoutMargin</name> 124 <name>layoutMargin</name>
121 </property> 125 </property>
122 <property> 126 <property>
123 <name>layoutSpacing</name> 127 <name>layoutSpacing</name>
124 </property> 128 </property>
125 <grid> 129 <grid>
126 <property stdset="1"> 130 <property stdset="1">
127 <name>margin</name> 131 <name>margin</name>
128 <number>4</number> 132 <number>4</number>
129 </property> 133 </property>
130 <property stdset="1"> 134 <property stdset="1">
131 <name>spacing</name> 135 <name>spacing</name>
132 <number>2</number> 136 <number>2</number>
133 </property> 137 </property>
134 <widget row="1" column="1" > 138 <widget row="1" column="1" >
135 <class>QCheckBox</class> 139 <class>QCheckBox</class>
136 <property stdset="1"> 140 <property stdset="1">
137 <name>name</name> 141 <name>name</name>
138 <cstring>channel6</cstring> 142 <cstring>channel6</cstring>
139 </property> 143 </property>
@@ -438,48 +442,52 @@
438 <property stdset="1"> 442 <property stdset="1">
439 <name>minValue</name> 443 <name>minValue</name>
440 <number>100</number> 444 <number>100</number>
441 </property> 445 </property>
442 <property stdset="1"> 446 <property stdset="1">
443 <name>lineStep</name> 447 <name>lineStep</name>
444 <number>100</number> 448 <number>100</number>
445 </property> 449 </property>
446 <property stdset="1"> 450 <property stdset="1">
447 <name>value</name> 451 <name>value</name>
448 <number>1000</number> 452 <number>1000</number>
449 </property> 453 </property>
450 <property> 454 <property>
451 <name>whatsThis</name> 455 <name>whatsThis</name>
452 <string>Choose the channel hop interval.</string> 456 <string>Choose the channel hop interval.</string>
453 </property> 457 </property>
454 </widget> 458 </widget>
455 <widget row="5" column="0" rowspan="1" colspan="4" > 459 <widget row="5" column="0" rowspan="1" colspan="4" >
456 <class>QCheckBox</class> 460 <class>QCheckBox</class>
457 <property stdset="1"> 461 <property stdset="1">
458 <name>name</name> 462 <name>name</name>
459 <cstring>adaptiveHopping</cstring> 463 <cstring>adaptiveHopping</cstring>
460 </property> 464 </property>
461 <property stdset="1"> 465 <property stdset="1">
466 <name>enabled</name>
467 <bool>false</bool>
468 </property>
469 <property stdset="1">
462 <name>text</name> 470 <name>text</name>
463 <string>Use Adaptive(TM) Hop Scheme</string> 471 <string>Use Adaptive(TM) Hop Scheme</string>
464 </property> 472 </property>
465 </widget> 473 </widget>
466 </grid> 474 </grid>
467 </widget> 475 </widget>
468 <widget> 476 <widget>
469 <class>QWidget</class> 477 <class>QWidget</class>
470 <property stdset="1"> 478 <property stdset="1">
471 <name>name</name> 479 <name>name</name>
472 <cstring>tab</cstring> 480 <cstring>tab</cstring>
473 </property> 481 </property>
474 <attribute> 482 <attribute>
475 <name>title</name> 483 <name>title</name>
476 <string>Capture</string> 484 <string>Capture</string>
477 </attribute> 485 </attribute>
478 <grid> 486 <grid>
479 <property stdset="1"> 487 <property stdset="1">
480 <name>margin</name> 488 <name>margin</name>
481 <number>5</number> 489 <number>5</number>
482 </property> 490 </property>
483 <property stdset="1"> 491 <property stdset="1">
484 <name>spacing</name> 492 <name>spacing</name>
485 <number>3</number> 493 <number>3</number>
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 96ebb3f..55a5260 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -25,75 +25,90 @@
25 25
26// ==> OProcess 26// ==> OProcess
27#include <qdir.h> 27#include <qdir.h>
28#include <qfileinfo.h> 28#include <qfileinfo.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31 31
32#include <errno.h> 32#include <errno.h>
33#include <signal.h> 33#include <signal.h>
34#include <string.h> 34#include <string.h>
35#include <unistd.h> 35#include <unistd.h>
36 36
37int main( int argc, char **argv ) 37int main( int argc, char **argv )
38{ 38{
39 #ifdef QWS 39 #ifdef QWS
40 OApplication a( argc, argv, "Wellenreiter II" ); 40 OApplication a( argc, argv, "Wellenreiter II" );
41 #else 41 #else
42 QApplication a( argc, argv ); 42 QApplication a( argc, argv );
43 #endif 43 #endif
44 WellenreiterMainWindow* w = new WellenreiterMainWindow(); 44 WellenreiterMainWindow* w = new WellenreiterMainWindow();
45 #ifdef QWS 45 #ifdef QWS
46 a.showMainWidget( w ); 46 a.showMainWidget( w );
47 #else 47 #else
48 a.setMainWidget( w ); 48 a.setMainWidget( w );
49 w->setCaption( "Wellenreiter II" );
49 w->show(); 50 w->show();
50 #endif 51 #endif
51 52
52 a.processEvents(); // show the window before doing the safety checks 53 a.processEvents(); // show the window before doing the safety checks
53 int result = -1; 54 int result = -1;
54 55
55 // root check 56 // root check
56 if ( getuid() ) 57 if ( getuid() )
57 { 58 {
58 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 59 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
59 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 60 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
60 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 61 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
61 QMessageBox::Yes, QMessageBox::No ); 62 QMessageBox::Yes, QMessageBox::No );
62 if ( result == QMessageBox::No ) return -1; 63 if ( result == QMessageBox::No ) return -1;
63 } 64 }
64 65
65 // dhcp check - NOT HERE! This really belongs as a static member to OProcess 66 // dhcp check - NOT HERE! This really belongs as a static member to OProcess
66 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... 67 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
67 68
69 static int killed = false;
70
68 QString line; 71 QString line;
69 QDir d = QDir( "/proc" ); 72 QDir d = QDir( "/proc" );
70 QStringList dirs = d.entryList( QDir::Dirs ); 73 QStringList dirs = d.entryList( QDir::Dirs );
71 QStringList::Iterator it; 74 QStringList::Iterator it;
72 for ( it = dirs.begin(); it != dirs.end(); ++it ) 75 for ( it = dirs.begin(); it != dirs.end(); ++it )
73 { 76 {
74 //qDebug( "next entry: %s", (const char*) *it ); 77 //qDebug( "next entry: %s", (const char*) *it );
75 QFile file( "/proc/"+*it+"/cmdline" ); 78 QFile file( "/proc/"+*it+"/cmdline" );
76 file.open( IO_ReadOnly ); 79 file.open( IO_ReadOnly );
77 if ( !file.isOpen() ) continue; 80 if ( !file.isOpen() ) continue;
78 QTextStream t( &file ); 81 QTextStream t( &file );
79 line = t.readLine(); 82 line = t.readLine();
80 //qDebug( "cmdline = %s", (const char*) line ); 83 //qDebug( "cmdline = %s", (const char*) line );
81 if ( line.contains( "dhcp" ) ) break; 84 if ( line.contains( "dhcp" ) ) break;
82 } 85 }
83 if ( line.contains( "dhcp" ) ) 86 if ( line.contains( "dhcp" ) )
84 { 87 {
85 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); 88 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
86 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" 89 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
87 "This can severly limit scanning!\nShould I kill it for you?" ), 90 "This can severly limit scanning!\nShould I kill it for you?" ),
88 QMessageBox::Yes, QMessageBox::No ); 91 QMessageBox::Yes, QMessageBox::No );
89 if ( result == QMessageBox::Yes ) 92 if ( result == QMessageBox::Yes )
90 { 93 {
91 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) 94 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
92 qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) ); 95 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
96 else
97 killed = true;
93 } 98 }
94 } 99 }
95 100
96 a.exec(); 101 a.exec();
102
103 if ( killed )
104 {
105 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
106 if ( result == QMessageBox::Yes )
107 {
108 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
109 }
110 }
111
97 delete w; 112 delete w;
98 return 0; 113 return 0;
99} 114}
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 7241f7a..3e36f5b 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -114,50 +114,51 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
114 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); 114 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) );
115 id = file->insertItem( tr( "&Load" ), fileLoad ); 115 id = file->insertItem( tr( "&Load" ), fileLoad );
116 file->insertItem( tr( "&Save" ), fileSave ); 116 file->insertItem( tr( "&Save" ), fileSave );
117 file->insertSeparator(); 117 file->insertSeparator();
118 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); 118 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
119 119
120 QPopupMenu* view = new QPopupMenu( mb ); 120 QPopupMenu* view = new QPopupMenu( mb );
121 view->insertItem( tr( "&Configure..." ) ); 121 view->insertItem( tr( "&Configure..." ) );
122 122
123 QPopupMenu* sniffer = new QPopupMenu( mb ); 123 QPopupMenu* sniffer = new QPopupMenu( mb );
124 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); 124 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) );
125 sniffer->insertSeparator(); 125 sniffer->insertSeparator();
126 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); 126 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) );
127 sniffer->setItemEnabled( startID, false ); 127 sniffer->setItemEnabled( startID, false );
128 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); 128 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) );
129 sniffer->setItemEnabled( stopID, false ); 129 sniffer->setItemEnabled( stopID, false );
130 130
131 QPopupMenu* demo = new QPopupMenu( mb ); 131 QPopupMenu* demo = new QPopupMenu( mb );
132 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); 132 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) );
133 133
134 id = mb->insertItem( tr( "&File" ), file ); 134 id = mb->insertItem( tr( "&File" ), file );
135 //id = mb->insertItem( tr( "&View" ), view ); 135 //id = mb->insertItem( tr( "&View" ), view );
136 //mb->setItemEnabled( id, false ); 136 //mb->setItemEnabled( id, false );
137 id = mb->insertItem( tr( "&Sniffer" ), sniffer ); 137 id = mb->insertItem( tr( "&Sniffer" ), sniffer );
138 //id = mb->insertItem( tr( "&Demo" ), demo ); 138
139 //mb->setItemEnabled( id, true ); 139 id = mb->insertItem( tr( "&Demo" ), demo );
140 mb->setItemEnabled( id, true );
140 141
141 #ifdef QWS 142 #ifdef QWS
142 mb->insertItem( startButton ); 143 mb->insertItem( startButton );
143 mb->insertItem( stopButton ); 144 mb->insertItem( stopButton );
144 mb->insertItem( c ); 145 mb->insertItem( c );
145 mb->insertItem( d ); 146 mb->insertItem( d );
146 #else // Qt3 changed the insertion order. It's now totally random :( 147 #else // Qt3 changed the insertion order. It's now totally random :(
147 mb->insertItem( d ); 148 mb->insertItem( d );
148 mb->insertItem( c ); 149 mb->insertItem( c );
149 mb->insertItem( stopButton ); 150 mb->insertItem( stopButton );
150 mb->insertItem( startButton ); 151 mb->insertItem( startButton );
151 #endif 152 #endif
152 153
153 updateToolButtonState(); 154 updateToolButtonState();
154 155
155 // setup status bar (for now only on X11) 156 // setup status bar (for now only on X11)
156 157
157 #ifndef QWS 158 #ifndef QWS
158 statusBar()->message( tr( "Ready." ) ); 159 statusBar()->message( tr( "Ready." ) );
159 #endif 160 #endif
160 161
161 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); 162 connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
162 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); 163 connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
163}; 164};
@@ -194,48 +195,50 @@ void WellenreiterMainWindow::updateToolButtonState()
194 menuBar()->setItemEnabled( startID, false ); 195 menuBar()->setItemEnabled( startID, false );
195 } 196 }
196} 197}
197 198
198 199
199void WellenreiterMainWindow::changedSniffingState() 200void WellenreiterMainWindow::changedSniffingState()
200{ 201{
201 startButton->setEnabled( !mw->sniffing ); 202 startButton->setEnabled( !mw->sniffing );
202 menuBar()->setItemEnabled( startID, !mw->sniffing ); 203 menuBar()->setItemEnabled( startID, !mw->sniffing );
203 stopButton->setEnabled( mw->sniffing ); 204 stopButton->setEnabled( mw->sniffing );
204 menuBar()->setItemEnabled( stopID, mw->sniffing ); 205 menuBar()->setItemEnabled( stopID, mw->sniffing );
205} 206}
206 207
207 208
208WellenreiterMainWindow::~WellenreiterMainWindow() 209WellenreiterMainWindow::~WellenreiterMainWindow()
209{ 210{
210 delete infoIconSet; 211 delete infoIconSet;
211 delete settingsIconSet; 212 delete settingsIconSet;
212 delete startIconSet; 213 delete startIconSet;
213 delete stopIconSet; 214 delete stopIconSet;
214}; 215};
215 216
216void WellenreiterMainWindow::demoAddStations() 217void WellenreiterMainWindow::demoAddStations()
217{ 218{
219 mw = 0;
220
218 mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); 221 mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 );
219 mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); 222 mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 );
220 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); 223 mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 );
221 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); 224 mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 );
222 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); 225 mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 );
223} 226}
224 227
225 228
226QString WellenreiterMainWindow::getFileName( bool save ) 229QString WellenreiterMainWindow::getFileName( bool save )
227{ 230{
228 QMap<QString, QStringList> map; 231 QMap<QString, QStringList> map;
229 map.insert( tr("All"), QStringList() ); 232 map.insert( tr("All"), QStringList() );
230 QStringList text; 233 QStringList text;
231 text << "text/*"; 234 text << "text/*";
232 map.insert( tr("Text"), text ); 235 map.insert( tr("Text"), text );
233 text << "*"; 236 text << "*";
234 map.insert( tr("All"), text ); 237 map.insert( tr("All"), text );
235 238
236 QString str; 239 QString str;
237 if ( save ) 240 if ( save )
238 { 241 {
239 #ifdef QWS 242 #ifdef QWS
240 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); 243 str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
241 #else 244 #else
@@ -338,24 +341,26 @@ void WellenreiterMainWindow::fileLoadSession()
338 } 341 }
339 } 342 }
340} 343}
341 344
342void WellenreiterMainWindow::fileNew() 345void WellenreiterMainWindow::fileNew()
343{ 346{
344 mw->netView()->clear(); 347 mw->netView()->clear();
345 mw->logWindow()->clear(); 348 mw->logWindow()->clear();
346 mw->hexWindow()->clear(); 349 mw->hexWindow()->clear();
347} 350}
348 351
349void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 352void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
350{ 353{
351 if ( mw->isDaemonRunning() ) 354 if ( mw->isDaemonRunning() )
352 { 355 {
353 QMessageBox::warning( this, "Wellenreiter/Opie", 356 QMessageBox::warning( this, "Wellenreiter/Opie",
354 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); 357 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
355 e->ignore(); 358 e->ignore();
356 } 359 }
357 else 360 else
358 { 361 {
359 QMainWindow::closeEvent( e ); 362 QMainWindow::closeEvent( e );
360 } 363 }
361} 364}
365
366
diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp
index f4b45d0..daca095 100644
--- a/noncore/net/wellenreiter/gui/protolistview.cpp
+++ b/noncore/net/wellenreiter/gui/protolistview.cpp
@@ -63,49 +63,49 @@ ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f
63 addProtocol( "802.11 Data" ); 63 addProtocol( "802.11 Data" );
64 addProtocol( "IP" ); 64 addProtocol( "IP" );
65 addProtocol( "ARP" ); 65 addProtocol( "ARP" );
66 addProtocol( "UDP" ); 66 addProtocol( "UDP" );
67 addProtocol( "TCP" ); 67 addProtocol( "TCP" );
68} 68}
69 69
70 70
71ProtocolListView::~ProtocolListView() 71ProtocolListView::~ProtocolListView()
72{ 72{
73} 73}
74 74
75 75
76void ProtocolListView::addProtocol( const QString& name ) 76void ProtocolListView::addProtocol( const QString& name )
77{ 77{
78 QHBox* hbox = new QHBox( vbox ); 78 QHBox* hbox = new QHBox( vbox );
79 new QCheckBox( name, hbox, (const char*) name ); 79 new QCheckBox( name, hbox, (const char*) name );
80 80
81 if ( parse ) 81 if ( parse )
82 { 82 {
83 QComboBox* combo = new QComboBox( hbox, (const char*) name ); 83 QComboBox* combo = new QComboBox( hbox, (const char*) name );
84 #ifdef QWS 84 #ifdef QWS
85 combo->setFixedWidth( 75 ); 85 combo->setFixedWidth( 75 );
86 #endif 86 #endif
87 combo->insertItem( "Ignore" ); 87 combo->insertItem( "Pass" );
88 combo->insertItem( "Discard!" ); 88 combo->insertItem( "Discard!" );
89 combo->insertItem( "TouchSound" ); 89 combo->insertItem( "TouchSound" );
90 combo->insertItem( "AlarmSound" ); 90 combo->insertItem( "AlarmSound" );
91 combo->insertItem( "KeySound" ); 91 combo->insertItem( "KeySound" );
92 combo->insertItem( "LedOn" ); 92 combo->insertItem( "LedOn" );
93 combo->insertItem( "LedOff" ); 93 combo->insertItem( "LedOff" );
94 combo->insertItem( "LogMessage" ); 94 combo->insertItem( "LogMessage" );
95 combo->insertItem( "MessageBox" ); 95 combo->insertItem( "MessageBox" );
96 } 96 }
97 else 97 else
98 { 98 {
99 QComboBox* combo = new QComboBox( hbox, (const char*) name ); 99 QComboBox* combo = new QComboBox( hbox, (const char*) name );
100 #ifdef QWS 100 #ifdef QWS
101 combo->setFixedWidth( 75 ); 101 combo->setFixedWidth( 75 );
102 #endif 102 #endif
103 combo->insertItem( "Pass" ); 103 combo->insertItem( "Pass" );
104 combo->insertItem( "Discard!" ); 104 combo->insertItem( "Discard!" );
105 } 105 }
106} 106}
107 107
108 108
109bool ProtocolListView::isProtocolChecked( const QString& name ) 109bool ProtocolListView::isProtocolChecked( const QString& name )
110{ 110{
111 QCheckBox* box = (QCheckBox*) child( (const char*) name ); 111 QCheckBox* box = (QCheckBox*) child( (const char*) name );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 965f6b0..4257be1 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -382,107 +382,114 @@ void Wellenreiter::stopClicked()
382 emit( stoppedSniffing() ); 382 emit( stoppedSniffing() );
383 383
384 // print out statistics 384 // print out statistics
385 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) 385 for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it )
386 statwindow->updateCounter( it.key(), it.data() ); 386 statwindow->updateCounter( it.key(), it.data() );
387} 387}
388 388
389 389
390void Wellenreiter::startClicked() 390void Wellenreiter::startClicked()
391{ 391{
392 // get configuration from config window 392 // get configuration from config window
393 393
394 const QString& interface = configwindow->interfaceName->currentText(); 394 const QString& interface = configwindow->interfaceName->currentText();
395 const int cardtype = configwindow->driverType(); 395 const int cardtype = configwindow->driverType();
396 const int interval = configwindow->hoppingInterval(); 396 const int interval = configwindow->hoppingInterval();
397 397
398 if ( ( interface == "" ) || ( cardtype == 0 ) ) 398 if ( ( interface == "" ) || ( cardtype == 0 ) )
399 { 399 {
400 QMessageBox::information( this, "Wellenreiter II", 400 QMessageBox::information( this, "Wellenreiter II",
401 tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); 401 tr( "Your device is not\nproperly configured. Please reconfigure!" ) );
402 return; 402 return;
403 } 403 }
404 404
405 // configure device 405 // configure device
406
407 ONetwork* net = ONetwork::instance(); 406 ONetwork* net = ONetwork::instance();
408 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 407 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
409 408
410 // set monitor mode 409 // bring device UP
410 iface->setUp( true );
411 if ( !iface->isUp() )
412 {
413 QMessageBox::warning( this, "Wellenreiter II",
414 tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
415 return;
416 }
411 417
418 // set monitor mode
412 bool usePrism = configwindow->usePrismHeader(); 419 bool usePrism = configwindow->usePrismHeader();
413 420
414 switch ( cardtype ) 421 switch ( cardtype )
415 { 422 {
416 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; 423 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
417 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; 424 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
418 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; 425 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
419 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; 426 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
420 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; 427 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
421 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; 428 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break;
422 default: assert( 0 ); // shouldn't reach this 429 default: assert( 0 ); // shouldn't reach this
423 } 430 }
424 431
425 // switch device into monitor mode 432 // switch device into monitor mode
426 if ( cardtype < DEVTYPE_FILE ) 433 if ( cardtype < DEVTYPE_FILE )
427 { 434 {
428 if ( cardtype != DEVTYPE_MANUAL ) 435 if ( cardtype != DEVTYPE_MANUAL )
429 iface->setMonitorMode( true ); 436 iface->setMonitorMode( true );
430 if ( !iface->monitorMode() ) 437 if ( !iface->monitorMode() )
431 { 438 {
432 QMessageBox::warning( this, "Wellenreiter II", 439 QMessageBox::warning( this, "Wellenreiter II",
433 tr( "Can't set device into monitor mode." ) ); 440 tr( "Can't set interface '%1' into monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) );
434 return; 441 return;
435 } 442 }
436 } 443 }
437 444
438 // open pcap and start sniffing 445 // open pcap and start sniffing
439 if ( cardtype != DEVTYPE_FILE ) 446 if ( cardtype != DEVTYPE_FILE )
440 { 447 {
441 pcap->open( interface ); 448 pcap->open( interface );
442 449
443 if ( configwindow->writeCaptureFile->isOn() ) 450 if ( configwindow->writeCaptureFile->isOn() )
444 { 451 {
445 QString dumpname( configwindow->captureFileName->text() ); 452 QString dumpname( configwindow->captureFileName->text() );
446 dumpname.append( '-' ); 453 dumpname.append( '-' );
447 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 454 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
448 dumpname.append( ".wellenreiter" ); 455 dumpname.append( ".wellenreiter" );
449 pcap->openDumpFile( dumpname ); 456 pcap->openDumpFile( dumpname );
450 } 457 }
451 else 458 else
452 { 459 {
453 pcap->open( interface ); 460 pcap->open( interface );
454 } 461 }
455 } 462 }
456 else 463 else
457 { 464 {
458 pcap->open( QFile( interface ) ); 465 pcap->open( QFile( interface ) );
459 } 466 }
460 467
461 if ( !pcap->isOpen() ) 468 if ( !pcap->isOpen() )
462 { 469 {
463 QMessageBox::warning( this, "Wellenreiter II", 470 QMessageBox::warning( this, "Wellenreiter II",
464 tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); 471 tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) ));
465 return; 472 return;
466 } 473 }
467 474
468 // set capturer to non-blocking mode 475 // set capturer to non-blocking mode
469 pcap->setBlocking( false ); 476 pcap->setBlocking( false );
470 477
471 // start channel hopper 478 // start channel hopper
472 if ( cardtype != DEVTYPE_FILE ) 479 if ( cardtype != DEVTYPE_FILE )
473 iface->setChannelHopping( 1000 ); //use interval from config window 480 iface->setChannelHopping( 1000 ); //use interval from config window
474 481
475 if ( cardtype != DEVTYPE_FILE ) 482 if ( cardtype != DEVTYPE_FILE )
476 { 483 {
477 // connect socket notifier and start channel hopper 484 // connect socket notifier and start channel hopper
478 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 485 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
479 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 486 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
480 } 487 }
481 else 488 else
482 { 489 {
483 // start timer for reading packets 490 // start timer for reading packets
484 startTimer( 100 ); 491 startTimer( 100 );
485 } 492 }
486 493
487 logwindow->log( "(i) Started Scanning." ); 494 logwindow->log( "(i) Started Scanning." );
488 sniffing = true; 495 sniffing = true;
@@ -509,24 +516,25 @@ void Wellenreiter::timerEvent( QTimerEvent* )
509 receivePacket( p ); 516 receivePacket( p );
510 delete p; 517 delete p;
511 } 518 }
512} 519}
513 520
514 521
515void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) 522void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
516{ 523{
517 if ( action == "TouchSound" ) 524 if ( action == "TouchSound" )
518 ODevice::inst()->touchSound(); 525 ODevice::inst()->touchSound();
519 else if ( action == "AlarmSound" ) 526 else if ( action == "AlarmSound" )
520 ODevice::inst()->alarmSound(); 527 ODevice::inst()->alarmSound();
521 else if ( action == "KeySound" ) 528 else if ( action == "KeySound" )
522 ODevice::inst()->keySound(); 529 ODevice::inst()->keySound();
523 else if ( action == "LedOn" ) 530 else if ( action == "LedOn" )
524 ODevice::inst()->setLedState( Led_Mail, Led_On ); 531 ODevice::inst()->setLedState( Led_Mail, Led_On );
525 else if ( action == "LedOff" ) 532 else if ( action == "LedOff" )
526 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 533 ODevice::inst()->setLedState( Led_Mail, Led_Off );
527 else if ( action == "LogMessage" ) 534 else if ( action == "LogMessage" )
528 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 535 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
529 else if ( action == "MessageBox" ) 536 else if ( action == "MessageBox" )
530 QMessageBox::information ( this, "Notification!", 537 QMessageBox::information ( this, "Notification!",
531 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 538 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
532} 539}
540
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 37e692c..d776492 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -27,48 +27,49 @@ class QTimerEvent;
27class QPixmap; 27class QPixmap;
28class OPacket; 28class OPacket;
29class OWaveLanManagementPacket; 29class OWaveLanManagementPacket;
30class OWaveLanDataPacket; 30class OWaveLanDataPacket;
31class OPacketCapturer; 31class OPacketCapturer;
32class OWirelessNetworkInterface; 32class OWirelessNetworkInterface;
33class ManufacturerDB; 33class ManufacturerDB;
34class WellenreiterConfigWindow; 34class WellenreiterConfigWindow;
35class MLogWindow; 35class MLogWindow;
36class MHexWindow; 36class MHexWindow;
37 37
38class Wellenreiter : public WellenreiterBase { 38class Wellenreiter : public WellenreiterBase {
39 Q_OBJECT 39 Q_OBJECT
40 40
41 public: 41 public:
42 Wellenreiter( QWidget* parent = 0 ); 42 Wellenreiter( QWidget* parent = 0 );
43 ~Wellenreiter(); 43 ~Wellenreiter();
44 44
45 void setConfigWindow( WellenreiterConfigWindow* cw ); 45 void setConfigWindow( WellenreiterConfigWindow* cw );
46 MScanListView* netView() const { return netview; }; 46 MScanListView* netView() const { return netview; };
47 MLogWindow* logWindow() const { return logwindow; }; 47 MLogWindow* logWindow() const { return logwindow; };
48 MHexWindow* hexWindow() const { return hexwindow; }; 48 MHexWindow* hexWindow() const { return hexwindow; };
49 bool isDaemonRunning() const { return sniffing; }; 49 bool isDaemonRunning() const { return sniffing; };
50 50
51 public:
51 bool sniffing; 52 bool sniffing;
52 53
53 protected: 54 protected:
54 virtual void timerEvent( QTimerEvent* ); 55 virtual void timerEvent( QTimerEvent* );
55 56
56 public slots: 57 public slots:
57 void channelHopped(int); 58 void channelHopped(int);
58 void receivePacket(OPacket*); 59 void receivePacket(OPacket*);
59 void startClicked(); 60 void startClicked();
60 void stopClicked(); 61 void stopClicked();
61 62
62 signals: 63 signals:
63 void startedSniffing(); 64 void startedSniffing();
64 void stoppedSniffing(); 65 void stoppedSniffing();
65 66
66 private: 67 private:
67 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon ); 68 void handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon );
68 void handleData( OPacket* p, OWaveLanDataPacket* data ); 69 void handleData( OPacket* p, OWaveLanDataPacket* data );
69 void handleNotification( OPacket* p ); 70 void handleNotification( OPacket* p );
70 void doAction( const QString& action, const QString& protocol, OPacket* p ); 71 void doAction( const QString& action, const QString& protocol, OPacket* p );
71 QObject* childIfToParse( OPacket* p, const QString& protocol ); 72 QObject* childIfToParse( OPacket* p, const QString& protocol );
72 bool checkDumpPacket( OPacket* p ); 73 bool checkDumpPacket( OPacket* p );
73 74
74 private: 75 private: