-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 17 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
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 | |||
@@ -104,24 +104,28 @@ | |||
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> |
@@ -450,24 +454,28 @@ | |||
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> |
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 | |||
@@ -37,63 +37,78 @@ | |||
37 | int main( int argc, char **argv ) | 37 | int 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 | |||
@@ -126,26 +126,27 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
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 |
@@ -206,24 +207,26 @@ void WellenreiterMainWindow::changedSniffingState() | |||
206 | 207 | ||
207 | 208 | ||
208 | WellenreiterMainWindow::~WellenreiterMainWindow() | 209 | WellenreiterMainWindow::~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 | ||
216 | void WellenreiterMainWindow::demoAddStations() | 217 | void 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 | ||
226 | QString WellenreiterMainWindow::getFileName( bool save ) | 229 | QString 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() ); |
@@ -350,12 +353,14 @@ void 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 | |||
@@ -75,25 +75,25 @@ ProtocolListView::~ProtocolListView() | |||
75 | 75 | ||
76 | void ProtocolListView::addProtocol( const QString& name ) | 76 | void 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 ); |
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 | |||
@@ -394,52 +394,59 @@ void Wellenreiter::startClicked() | |||
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() ); |
@@ -452,25 +459,25 @@ void Wellenreiter::startClicked() | |||
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 | { |
@@ -521,12 +528,13 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa | |||
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 | |||
@@ -39,24 +39,25 @@ class 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: |