-rw-r--r-- | libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index f1966c1..ebd3b5f 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp @@ -104,129 +104,129 @@ public: printf( "Interface status is already promisc - good.\n" ); // connect a monitoring strategy to the interface if ( driver == "orinoco" ) new OOrinocoMonitoringInterface( wiface, false ); else if ( driver == "hostap" ) new OHostAPMonitoringInterface( wiface, false ); else if ( driver == "wlan-ng" ) new OWlanNGMonitoringInterface( wiface, false ); else { printf( "Unknown driver. Exiting\n" ); exit( -1 ); } // enable monitoring mode printf( "Enabling monitor mode...\n" ); wiface->setMode( "monitor" ); // open a packet capturer cap = new OPacketCapturer(); cap->open( interface ); if ( !cap->isOpen() ) { printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); exit( -1 ); } // set capturer to non-blocking mode cap->setBlocking( false ); // start channel hopper //wiface->setChannelHopping( 1000 ); // connect connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); // timer startTimer( 1000 ); } ~Wellenreiter() {}; public slots: virtual void timerEvent(QTimerEvent* e) { wiface->setChannel( channel++ ); if ( channel == 14 ) channel = 1; } void receivePacket(OPacket* p) { if (!p) { printf( "(empty packet received)\n" ); return; } OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); if ( beacon ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); - QString essid = ssid ? ssid->ID() : "<unknown>"; + QString essid = ssid ? ssid->ID() : QString::fromLatin1( "<unknown>" ); if ( stations.find( essid ) ) stations[essid]->beacons++; else { printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); stations.insert( essid, new Station( "unknown", wiface->channel(), ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); } return; } OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" ); if ( data ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) { printf( "FromDS: '%s' -> '%s' via '%s'\n", (const char*) wlan->macAddress3().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress2().toString(true) ); } else if ( !wlan->fromDS() && wlan->toDS() ) { printf( "ToDS: '%s' -> '%s' via '%s'\n", (const char*) wlan->macAddress2().toString(true), (const char*) wlan->macAddress3().toString(true), (const char*) wlan->macAddress1().toString(true) ); } else if ( wlan->fromDS() && wlan->toDS() ) { printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n", (const char*) wlan->macAddress4().toString(true), (const char*) wlan->macAddress3().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress2().toString(true) ); } else { printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n", (const char*) wlan->macAddress2().toString(true), (const char*) wlan->macAddress1().toString(true), (const char*) wlan->macAddress3().toString(true) ); } return; } } private: OPacketCapturer* cap; OWirelessNetworkInterface* wiface; int channel; }; int main( int argc, char** argv ) { Wellenreiter w( argc, argv ); w.exec(); return 0; } |