summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/wellenreiter.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp94
1 files changed, 60 insertions, 34 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 3372883..5c10c3b 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -223,24 +223,24 @@ void Wellenreiter::stopClicked()
223{ 223{
224 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 224 if ( iface )
225 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 225 {
226 iface->setChannelHopping(); // stop hopping channels 226 disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
227 disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
228 iface->setChannelHopping(); // stop hopping channels
229 }
230 else
231 killTimers();
232
227 pcap->close(); 233 pcap->close();
228 sniffing = false; 234 sniffing = false;
229 #ifdef QWS
230 oApp->setTitle();
231 #else
232 qApp->mainWidget()->setCaption( "Wellenreiter II" );
233 #endif
234 235
235 // get interface name from config window 236 if ( iface )
236 const QString& interface = configwindow->interfaceName->currentText(); 237 {
237 ONetwork* net = ONetwork::instance(); 238 // switch off monitor mode
238 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 239 iface->setMonitorMode( false );
240 // switch off promisc flag
241 iface->setPromiscuousMode( false );
239 242
240 // switch off monitor mode 243 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
241 iface->setMonitorMode( false ); 244 }
242 // switch off promisc flag
243 iface->setPromiscuousMode( false );
244 245
245 system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess
246 logwindow->log( "(i) Stopped Scanning." ); 246 logwindow->log( "(i) Stopped Scanning." );
@@ -299,17 +299,21 @@ void Wellenreiter::startClicked()
299 { 299 {
300 case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; 300 case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
301 case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; 301 case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
302 case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; 302 case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
303 case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; 303 case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
304 default: 304 case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); break;
305 QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); 305 case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break;
306 default: assert( 0 ); // shouldn't reach this
306 } 307 }
307 308
308 if ( cardtype > 0 && cardtype < 5 ) 309 // switch device into monitor mode
309 iface->setMonitorMode( true ); 310 if ( cardtype < DEVTYPE_FILE )
310
311 if ( !iface->monitorMode() )
312 { 311 {
313 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); 312 if ( cardtype != DEVTYPE_MANUAL )
314 return; 313 iface->setMonitorMode( true );
314 if ( !iface->monitorMode() )
315 {
316 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
317 return;
318 }
315 } 319 }
@@ -317,3 +321,6 @@ void Wellenreiter::startClicked()
317 // open pcap and start sniffing 321 // open pcap and start sniffing
318 pcap->open( interface ); 322 if ( cardtype != DEVTYPE_FILE )
323 pcap->open( interface );
324 else
325 pcap->open( QFile( interface ) );
319 326
@@ -329,7 +336,16 @@ void Wellenreiter::startClicked()
329 // start channel hopper 336 // start channel hopper
330 iface->setChannelHopping( 1000 ); //use interval from config window 337 if ( cardtype != DEVTYPE_FILE )
338 iface->setChannelHopping( 1000 ); //use interval from config window
331 339
332 // connect 340 if ( cardtype != DEVTYPE_FILE )
333 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 341 {
334 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 342 // connect socket notifier and start channel hopper
343 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
344 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
345 }
346 else
347 {
348 // start timer for reading packets
349 startTimer( 100 );
350 }
335 351
@@ -339 +355,11 @@ void Wellenreiter::startClicked()
339} 355}
356
357
358void Wellenreiter::timerEvent( QTimerEvent* )
359{
360 qDebug( "Wellenreiter::timerEvent()" );
361 OPacket* p = pcap->next();
362 receivePacket( p );
363 delete p;
364}
365