-rw-r--r-- | noncore/net/wellenreiter/gui/hexwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/hexwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 23 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 5 |
6 files changed, 36 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/hexwindow.cpp b/noncore/net/wellenreiter/gui/hexwindow.cpp index a3022f4..8b17285 100644 --- a/noncore/net/wellenreiter/gui/hexwindow.cpp +++ b/noncore/net/wellenreiter/gui/hexwindow.cpp @@ -11,29 +11,35 @@ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "hexwindow.h" #include <qmultilineedit.h> MHexWindow::MHexWindow( QWidget * parent, const char * name, WFlags f ) :QVBox( parent, name, f ) { ledit = new QMultiLineEdit( this ); + ledit->setFont( QFont( "fixed", 10 ) ); // FIXME: Set properties( font, read-only, etc...) }; void MHexWindow::log( QString text ) { ledit->append( text ); }; +const QString MHexWindow::getLog() const +{ + return ledit->text(); +} + void MHexWindow::clear() { ledit->clear(); } diff --git a/noncore/net/wellenreiter/gui/hexwindow.h b/noncore/net/wellenreiter/gui/hexwindow.h index 2618b8c..f2f870c 100644 --- a/noncore/net/wellenreiter/gui/hexwindow.h +++ b/noncore/net/wellenreiter/gui/hexwindow.h @@ -19,21 +19,22 @@ #include <qvbox.h> class QString; class QMultiLineEdit; class MHexWindow: public QVBox { public: MHexWindow( QWidget * parent = 0, const char * name = "MHexWindow", WFlags f = 0 ); void log( QString text ); + const QString getLog() const; void clear(); protected: QMultiLineEdit* ledit; }; #endif diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 8e0164f..69d2b3a 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -98,25 +98,26 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n #endif d->setIconSet( *settingsIconSet ); connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); // setup menu bar int id; QMenuBar* mb = menuBar(); QPopupMenu* fileSave = new QPopupMenu( mb ); fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); - fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); + fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); + fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); QPopupMenu* fileLoad = new QPopupMenu( mb ); fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); QPopupMenu* file = new QPopupMenu( mb ); file->insertItem( "&New", this, SLOT( fileNew() ) ); id = file->insertItem( "&Load", fileLoad ); file->insertItem( "&Save", fileSave ); file->insertSeparator(); file->insertItem( "&Exit", qApp, SLOT( quit() ) ); @@ -271,24 +272,44 @@ void WellenreiterMainWindow::fileSaveSession() QDataStream t( &f ); t << *mw->netView(); f.close(); qDebug( "Saved session to file '%s'", (const char*) fname ); } else { qDebug( "Problem saving session to file '%s'", (const char*) fname ); } } } +void WellenreiterMainWindow::fileSaveHex() +{ + QString fname = getFileName( true ); + if ( !fname.isEmpty() ) + { + QFile f( fname ); + if ( f.open(IO_WriteOnly) ) + { + QTextStream t( &f ); + t << mw->hexWindow()->getLog(); + f.close(); + qDebug( "Saved hex log to file '%s'", (const char*) fname ); + } + else + { + qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); + } + } +} + void WellenreiterMainWindow::fileLoadSession() { QString fname = getFileName( false ); if ( !fname.isEmpty() ) { QFile f( fname ); if ( f.open(IO_ReadOnly) ) { QDataStream t( &f ); t >> *mw->netView(); f.close(); qDebug( "Loaded session from file '%s'", (const char*) fname ); diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index e06a60c..1b08c5b 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h @@ -44,18 +44,19 @@ class WellenreiterMainWindow: public QMainWindow QToolButton* startStopButton; protected: virtual void closeEvent( QCloseEvent* ); private: QString getFileName( bool save ); public slots: void showConfigure(); void demoAddStations(); void fileSaveLog(); + void fileSaveHex(); void fileSaveSession(); void fileLoadSession(); void fileNew(); }; #endif diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index a006a3c..34c69f5 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -185,25 +185,25 @@ const int col_sig = 1; const int col_ap = 2; const int col_channel = 3; const int col_wep = 4; const int col_traffic = 5; const int col_manuf = 6; const int col_firstseen = 7; const int col_lastseen = 8; MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), - _channel( channel ), _signal( signal ), _beacons( 0 ) + _channel( channel ), _signal( signal ), _beacons( 1 ) { qDebug( "creating scanlist item" ); if ( WellenreiterConfigWindow::instance() && type == "networks" ) playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); decorateItem( type, essid, macaddr, wep, channel, signal ); } MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) { qDebug( "creating scanlist item" ); @@ -265,25 +265,25 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, setText( col_channel, QString::number( channel ) ); setText( col_firstseen, QTime::currentTime().toString() ); //setText( col_lastseen, QTime::currentTime().toString() ); listView()->triggerUpdate(); this->type = type; _type = type; _essid = essid; _macaddr = macaddr; _channel = channel; - _beacons = 0; + _beacons = 1; _signal = 0; } void MScanListItem::setManufacturer( const QString& manufacturer ) { setText( col_manuf, manufacturer ); } void MScanListItem::playSound( const QString& sound ) const { diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index d80a6e6..aa33158 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -101,24 +101,26 @@ Wellenreiter::~Wellenreiter() delete manufacturerdb; delete pcap; } void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) { configwindow = cw; } void Wellenreiter::receivePacket(OPacket* p) { + hexWindow()->log( p->dump( 8 ) ); + // check if we received a beacon frame // static_cast is justified here OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); if ( !beacon ) return; QString type; //FIXME: Can stations in ESS mode can be distinguished from APs? //FIXME: Apparently yes, but not by listening to beacons, because //FIXME: they simply don't send beacons in infrastructure mode. //FIXME: so we also have to listen to data packets if ( beacon->canIBSS() ) @@ -152,24 +154,25 @@ void Wellenreiter::startStopClicked() // get interface name from config window const QString& interface = configwindow->interfaceName->currentText(); ONetwork* net = ONetwork::instance(); iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // switch off monitor mode iface->setMonitorMode( false ); // switch off promisc flag iface->setPromiscuousMode( false ); system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess + logwindow->log( "(i) Stopped Scanning." ); // message the user QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); } else { // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->daemonDeviceType(); const int interval = configwindow->daemonHopInterval(); @@ -213,22 +216,22 @@ void Wellenreiter::startStopClicked() return; } // set capturer to non-blocking mode pcap->setBlocking( false ); // start channel hopper iface->setChannelHopping( 1000 ); //use interval from config window // connect connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); - logwindow->log( "(i) Daemon has been started." ); + logwindow->log( "(i) Started Scanning." ); #ifdef QWS oApp->setTitle( "Scanning ..." ); #else qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); #endif sniffing = true; } } |