-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 14f251a..405eda8 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -376,32 +376,34 @@ void Wellenreiter::startClicked() | |||
376 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | 376 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); |
377 | return; | 377 | return; |
378 | } | 378 | } |
379 | 379 | ||
380 | // configure device | 380 | // configure device |
381 | ONetwork* net = ONetwork::instance(); | 381 | ONetwork* net = ONetwork::instance(); |
382 | 382 | ||
383 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces | 383 | // TODO: check if interface is wireless and support sniffing for non-wireless interfaces |
384 | 384 | ||
385 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! | 385 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless! |
386 | 386 | ||
387 | // bring device UP | 387 | // bring device UP |
388 | iface->setUp( true ); | 388 | if ( cardtype != DEVTYPE_FILE ) |
389 | if ( !iface->isUp() ) | ||
390 | { | 389 | { |
391 | QMessageBox::warning( this, "Wellenreiter II", | 390 | iface->setUp( true ); |
392 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | 391 | if ( !iface->isUp() ) |
393 | return; | 392 | { |
393 | QMessageBox::warning( this, "Wellenreiter II", | ||
394 | tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) ); | ||
395 | return; | ||
396 | } | ||
394 | } | 397 | } |
395 | |||
396 | // set monitor mode | 398 | // set monitor mode |
397 | bool usePrism = configwindow->usePrismHeader(); | 399 | bool usePrism = configwindow->usePrismHeader(); |
398 | 400 | ||
399 | switch ( cardtype ) | 401 | switch ( cardtype ) |
400 | { | 402 | { |
401 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 403 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
402 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 404 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
403 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 405 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
404 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 406 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
405 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 407 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
406 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 408 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
407 | default: assert( 0 ); // shouldn't reach this | 409 | default: assert( 0 ); // shouldn't reach this |
@@ -445,26 +447,26 @@ void Wellenreiter::startClicked() | |||
445 | else | 447 | else |
446 | { | 448 | { |
447 | pcap->open( interface ); | 449 | pcap->open( interface ); |
448 | } | 450 | } |
449 | } | 451 | } |
450 | else | 452 | else |
451 | { | 453 | { |
452 | pcap->open( QFile( interface ) ); | 454 | pcap->open( QFile( interface ) ); |
453 | } | 455 | } |
454 | 456 | ||
455 | if ( !pcap->isOpen() ) | 457 | if ( !pcap->isOpen() ) |
456 | { | 458 | { |
457 | QMessageBox::warning( this, "Wellenreiter II", | 459 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
458 | tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); | 460 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
459 | return; | 461 | return; |
460 | } | 462 | } |
461 | 463 | ||
462 | // set capturer to non-blocking mode | 464 | // set capturer to non-blocking mode |
463 | pcap->setBlocking( false ); | 465 | pcap->setBlocking( false ); |
464 | 466 | ||
465 | // start channel hopper | 467 | // start channel hopper |
466 | if ( cardtype != DEVTYPE_FILE ) | 468 | if ( cardtype != DEVTYPE_FILE ) |
467 | { | 469 | { |
468 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | 470 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); |
469 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | 471 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window |
470 | } | 472 | } |