author | mickeyl <mickeyl> | 2003-04-05 23:08:46 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-05 23:08:46 (UTC) |
commit | b7682f160fafe69bfd47dcfb1c88f2ac2b1afaf5 (patch) (unidiff) | |
tree | 68c5a0c5da88fff94582d2e6a072d8e9bbeaaf30 | |
parent | 6a949f685bd3fb50f810ad603eaafdb57720077c (diff) | |
download | opie-b7682f160fafe69bfd47dcfb1c88f2ac2b1afaf5.zip opie-b7682f160fafe69bfd47dcfb1c88f2ac2b1afaf5.tar.gz opie-b7682f160fafe69bfd47dcfb1c88f2ac2b1afaf5.tar.bz2 |
- correct beacon bug (off-by-one)
- display hex dump per packet in hex window
- allow saving hex window contents
-rw-r--r-- | noncore/net/wellenreiter/gui/hexwindow.cpp | 10 | ||||
-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, 38 insertions, 6 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 @@ | |||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "hexwindow.h" | 16 | #include "hexwindow.h" |
17 | #include <qmultilineedit.h> | 17 | #include <qmultilineedit.h> |
18 | 18 | ||
19 | MHexWindow::MHexWindow( QWidget * parent, const char * name, WFlags f ) | 19 | MHexWindow::MHexWindow( QWidget * parent, const char * name, WFlags f ) |
20 | :QVBox( parent, name, f ) | 20 | :QVBox( parent, name, f ) |
21 | { | 21 | { |
22 | ledit = new QMultiLineEdit( this ); | 22 | ledit = new QMultiLineEdit( this ); |
23 | 23 | ledit->setFont( QFont( "fixed", 10 ) ); | |
24 | |||
24 | // FIXME: Set properties( font, read-only, etc...) | 25 | // FIXME: Set properties( font, read-only, etc...) |
25 | 26 | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | void MHexWindow::log( QString text ) | 29 | void MHexWindow::log( QString text ) |
29 | { | 30 | { |
30 | 31 | ||
31 | ledit->append( text ); | 32 | ledit->append( text ); |
32 | 33 | ||
33 | }; | 34 | }; |
34 | 35 | ||
36 | const QString MHexWindow::getLog() const | ||
37 | { | ||
38 | return ledit->text(); | ||
39 | } | ||
40 | |||
35 | void MHexWindow::clear() | 41 | void MHexWindow::clear() |
36 | { | 42 | { |
37 | ledit->clear(); | 43 | ledit->clear(); |
38 | } | 44 | } |
39 | 45 | ||
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 @@ | |||
19 | #include <qvbox.h> | 19 | #include <qvbox.h> |
20 | 20 | ||
21 | class QString; | 21 | class QString; |
22 | class QMultiLineEdit; | 22 | class QMultiLineEdit; |
23 | 23 | ||
24 | class MHexWindow: public QVBox | 24 | class MHexWindow: public QVBox |
25 | { | 25 | { |
26 | 26 | ||
27 | public: | 27 | public: |
28 | MHexWindow( QWidget * parent = 0, const char * name = "MHexWindow", WFlags f = 0 ); | 28 | MHexWindow( QWidget * parent = 0, const char * name = "MHexWindow", WFlags f = 0 ); |
29 | 29 | ||
30 | void log( QString text ); | 30 | void log( QString text ); |
31 | const QString getLog() const; | ||
31 | void clear(); | 32 | void clear(); |
32 | 33 | ||
33 | protected: | 34 | protected: |
34 | QMultiLineEdit* ledit; | 35 | QMultiLineEdit* ledit; |
35 | 36 | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | #endif | 39 | #endif |
39 | 40 | ||
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 | |||
98 | #endif | 98 | #endif |
99 | d->setIconSet( *settingsIconSet ); | 99 | d->setIconSet( *settingsIconSet ); |
100 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 100 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
101 | 101 | ||
102 | // setup menu bar | 102 | // setup menu bar |
103 | 103 | ||
104 | int id; | 104 | int id; |
105 | 105 | ||
106 | QMenuBar* mb = menuBar(); | 106 | QMenuBar* mb = menuBar(); |
107 | 107 | ||
108 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 108 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
109 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); | 109 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); |
110 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); | 110 | fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); |
111 | fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); | ||
111 | 112 | ||
112 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 113 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
113 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); | 114 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); |
114 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 115 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
115 | 116 | ||
116 | QPopupMenu* file = new QPopupMenu( mb ); | 117 | QPopupMenu* file = new QPopupMenu( mb ); |
117 | file->insertItem( "&New", this, SLOT( fileNew() ) ); | 118 | file->insertItem( "&New", this, SLOT( fileNew() ) ); |
118 | id = file->insertItem( "&Load", fileLoad ); | 119 | id = file->insertItem( "&Load", fileLoad ); |
119 | file->insertItem( "&Save", fileSave ); | 120 | file->insertItem( "&Save", fileSave ); |
120 | file->insertSeparator(); | 121 | file->insertSeparator(); |
121 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | 122 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); |
122 | 123 | ||
@@ -271,24 +272,44 @@ void WellenreiterMainWindow::fileSaveSession() | |||
271 | QDataStream t( &f ); | 272 | QDataStream t( &f ); |
272 | t << *mw->netView(); | 273 | t << *mw->netView(); |
273 | f.close(); | 274 | f.close(); |
274 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 275 | qDebug( "Saved session to file '%s'", (const char*) fname ); |
275 | } | 276 | } |
276 | else | 277 | else |
277 | { | 278 | { |
278 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 279 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); |
279 | } | 280 | } |
280 | } | 281 | } |
281 | } | 282 | } |
282 | 283 | ||
284 | void WellenreiterMainWindow::fileSaveHex() | ||
285 | { | ||
286 | QString fname = getFileName( true ); | ||
287 | if ( !fname.isEmpty() ) | ||
288 | { | ||
289 | QFile f( fname ); | ||
290 | if ( f.open(IO_WriteOnly) ) | ||
291 | { | ||
292 | QTextStream t( &f ); | ||
293 | t << mw->hexWindow()->getLog(); | ||
294 | f.close(); | ||
295 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | ||
296 | } | ||
297 | else | ||
298 | { | ||
299 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | |||
283 | void WellenreiterMainWindow::fileLoadSession() | 304 | void WellenreiterMainWindow::fileLoadSession() |
284 | { | 305 | { |
285 | QString fname = getFileName( false ); | 306 | QString fname = getFileName( false ); |
286 | if ( !fname.isEmpty() ) | 307 | if ( !fname.isEmpty() ) |
287 | { | 308 | { |
288 | QFile f( fname ); | 309 | QFile f( fname ); |
289 | if ( f.open(IO_ReadOnly) ) | 310 | if ( f.open(IO_ReadOnly) ) |
290 | { | 311 | { |
291 | QDataStream t( &f ); | 312 | QDataStream t( &f ); |
292 | t >> *mw->netView(); | 313 | t >> *mw->netView(); |
293 | f.close(); | 314 | f.close(); |
294 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 315 | 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 | |||
44 | QToolButton* startStopButton; | 44 | QToolButton* startStopButton; |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | virtual void closeEvent( QCloseEvent* ); | 47 | virtual void closeEvent( QCloseEvent* ); |
48 | 48 | ||
49 | private: | 49 | private: |
50 | QString getFileName( bool save ); | 50 | QString getFileName( bool save ); |
51 | 51 | ||
52 | public slots: | 52 | public slots: |
53 | void showConfigure(); | 53 | void showConfigure(); |
54 | void demoAddStations(); | 54 | void demoAddStations(); |
55 | void fileSaveLog(); | 55 | void fileSaveLog(); |
56 | void fileSaveHex(); | ||
56 | void fileSaveSession(); | 57 | void fileSaveSession(); |
57 | void fileLoadSession(); | 58 | void fileLoadSession(); |
58 | void fileNew(); | 59 | void fileNew(); |
59 | }; | 60 | }; |
60 | 61 | ||
61 | #endif | 62 | #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; | |||
185 | const int col_ap = 2; | 185 | const int col_ap = 2; |
186 | const int col_channel = 3; | 186 | const int col_channel = 3; |
187 | const int col_wep = 4; | 187 | const int col_wep = 4; |
188 | const int col_traffic = 5; | 188 | const int col_traffic = 5; |
189 | const int col_manuf = 6; | 189 | const int col_manuf = 6; |
190 | const int col_firstseen = 7; | 190 | const int col_firstseen = 7; |
191 | const int col_lastseen = 8; | 191 | const int col_lastseen = 8; |
192 | 192 | ||
193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 193 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
194 | bool wep, int channel, int signal ) | 194 | bool wep, int channel, int signal ) |
195 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 195 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
196 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 196 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
197 | _channel( channel ), _signal( signal ), _beacons( 0 ) | 197 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
198 | { | 198 | { |
199 | qDebug( "creating scanlist item" ); | 199 | qDebug( "creating scanlist item" ); |
200 | if ( WellenreiterConfigWindow::instance() && type == "networks" ) | 200 | if ( WellenreiterConfigWindow::instance() && type == "networks" ) |
201 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 201 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
202 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 202 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
203 | } | 203 | } |
204 | 204 | ||
205 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 205 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
206 | bool wep, int channel, int signal ) | 206 | bool wep, int channel, int signal ) |
207 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 207 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
208 | { | 208 | { |
209 | qDebug( "creating scanlist item" ); | 209 | qDebug( "creating scanlist item" ); |
@@ -265,25 +265,25 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
265 | setText( col_channel, QString::number( channel ) ); | 265 | setText( col_channel, QString::number( channel ) ); |
266 | 266 | ||
267 | setText( col_firstseen, QTime::currentTime().toString() ); | 267 | setText( col_firstseen, QTime::currentTime().toString() ); |
268 | //setText( col_lastseen, QTime::currentTime().toString() ); | 268 | //setText( col_lastseen, QTime::currentTime().toString() ); |
269 | 269 | ||
270 | listView()->triggerUpdate(); | 270 | listView()->triggerUpdate(); |
271 | 271 | ||
272 | this->type = type; | 272 | this->type = type; |
273 | _type = type; | 273 | _type = type; |
274 | _essid = essid; | 274 | _essid = essid; |
275 | _macaddr = macaddr; | 275 | _macaddr = macaddr; |
276 | _channel = channel; | 276 | _channel = channel; |
277 | _beacons = 0; | 277 | _beacons = 1; |
278 | _signal = 0; | 278 | _signal = 0; |
279 | } | 279 | } |
280 | 280 | ||
281 | 281 | ||
282 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 282 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
283 | { | 283 | { |
284 | setText( col_manuf, manufacturer ); | 284 | setText( col_manuf, manufacturer ); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | void MScanListItem::playSound( const QString& sound ) const | 288 | void MScanListItem::playSound( const QString& sound ) const |
289 | { | 289 | { |
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() | |||
101 | 101 | ||
102 | delete manufacturerdb; | 102 | delete manufacturerdb; |
103 | delete pcap; | 103 | delete pcap; |
104 | } | 104 | } |
105 | 105 | ||
106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
107 | { | 107 | { |
108 | configwindow = cw; | 108 | configwindow = cw; |
109 | } | 109 | } |
110 | 110 | ||
111 | void Wellenreiter::receivePacket(OPacket* p) | 111 | void Wellenreiter::receivePacket(OPacket* p) |
112 | { | 112 | { |
113 | hexWindow()->log( p->dump( 8 ) ); | ||
114 | |||
113 | // check if we received a beacon frame | 115 | // check if we received a beacon frame |
114 | // static_cast is justified here | 116 | // static_cast is justified here |
115 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 117 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
116 | if ( !beacon ) return; | 118 | if ( !beacon ) return; |
117 | QString type; | 119 | QString type; |
118 | 120 | ||
119 | //FIXME: Can stations in ESS mode can be distinguished from APs? | 121 | //FIXME: Can stations in ESS mode can be distinguished from APs? |
120 | //FIXME: Apparently yes, but not by listening to beacons, because | 122 | //FIXME: Apparently yes, but not by listening to beacons, because |
121 | //FIXME: they simply don't send beacons in infrastructure mode. | 123 | //FIXME: they simply don't send beacons in infrastructure mode. |
122 | //FIXME: so we also have to listen to data packets | 124 | //FIXME: so we also have to listen to data packets |
123 | 125 | ||
124 | if ( beacon->canIBSS() ) | 126 | if ( beacon->canIBSS() ) |
@@ -152,24 +154,25 @@ void Wellenreiter::startStopClicked() | |||
152 | 154 | ||
153 | // get interface name from config window | 155 | // get interface name from config window |
154 | const QString& interface = configwindow->interfaceName->currentText(); | 156 | const QString& interface = configwindow->interfaceName->currentText(); |
155 | ONetwork* net = ONetwork::instance(); | 157 | ONetwork* net = ONetwork::instance(); |
156 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 158 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
157 | 159 | ||
158 | // switch off monitor mode | 160 | // switch off monitor mode |
159 | iface->setMonitorMode( false ); | 161 | iface->setMonitorMode( false ); |
160 | // switch off promisc flag | 162 | // switch off promisc flag |
161 | iface->setPromiscuousMode( false ); | 163 | iface->setPromiscuousMode( false ); |
162 | 164 | ||
163 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 165 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
166 | logwindow->log( "(i) Stopped Scanning." ); | ||
164 | 167 | ||
165 | // message the user | 168 | // message the user |
166 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | 169 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); |
167 | } | 170 | } |
168 | 171 | ||
169 | else | 172 | else |
170 | { | 173 | { |
171 | // get configuration from config window | 174 | // get configuration from config window |
172 | 175 | ||
173 | const QString& interface = configwindow->interfaceName->currentText(); | 176 | const QString& interface = configwindow->interfaceName->currentText(); |
174 | const int cardtype = configwindow->daemonDeviceType(); | 177 | const int cardtype = configwindow->daemonDeviceType(); |
175 | const int interval = configwindow->daemonHopInterval(); | 178 | const int interval = configwindow->daemonHopInterval(); |
@@ -213,22 +216,22 @@ void Wellenreiter::startStopClicked() | |||
213 | return; | 216 | return; |
214 | } | 217 | } |
215 | 218 | ||
216 | // set capturer to non-blocking mode | 219 | // set capturer to non-blocking mode |
217 | pcap->setBlocking( false ); | 220 | pcap->setBlocking( false ); |
218 | 221 | ||
219 | // start channel hopper | 222 | // start channel hopper |
220 | iface->setChannelHopping( 1000 ); //use interval from config window | 223 | iface->setChannelHopping( 1000 ); //use interval from config window |
221 | 224 | ||
222 | // connect | 225 | // connect |
223 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 226 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
224 | 227 | ||
225 | logwindow->log( "(i) Daemon has been started." ); | 228 | logwindow->log( "(i) Started Scanning." ); |
226 | #ifdef QWS | 229 | #ifdef QWS |
227 | oApp->setTitle( "Scanning ..." ); | 230 | oApp->setTitle( "Scanning ..." ); |
228 | #else | 231 | #else |
229 | qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); | 232 | qApp->mainWidget()->setCaption( "Wellenreiter II / Scanning ..." ); |
230 | #endif | 233 | #endif |
231 | sniffing = true; | 234 | sniffing = true; |
232 | 235 | ||
233 | } | 236 | } |
234 | } | 237 | } |