summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-01-04 17:18:59 (UTC)
committer mickeyl <mickeyl>2003-01-04 17:18:59 (UTC)
commit68400748895ca7c54ad312afdfe830150d53a801 (patch) (unidiff)
treeef9e4c85fb8aac71b613af9766e5ca6c4bd58f51
parent059caec066275d75501471a49c5465fe4def59cf (diff)
downloadopie-68400748895ca7c54ad312afdfe830150d53a801.zip
opie-68400748895ca7c54ad312afdfe830150d53a801.tar.gz
opie-68400748895ca7c54ad312afdfe830150d53a801.tar.bz2
Try to gracefully shut down the card after sniffing... this is a temporary
hack until the colleagues implement this in libwellenreiter...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/README27
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp26
2 files changed, 41 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/README b/noncore/net/wellenreiter/README
index c04d30c..af2e611 100644
--- a/noncore/net/wellenreiter/README
+++ b/noncore/net/wellenreiter/README
@@ -1,76 +1,89 @@
1/*************************************************************************/ 1/*************************************************************************/
2/* W e l l e n r e i t e r I I */ 2/* W e l l e n r e i t e r I I */
3/* =============================== */ 3/* =============================== */
4/* */ 4/* */
5/* Version: Opie-ALPHA */ 5 /* Version: Opie-ALPHA-January */
6/*************************************************************************/ 6/*************************************************************************/
7 7
8-------------------------------------------------- 8--------------------------------------------------
9Release Notes for Opie-ALPHA Version December 2002 9Release Notes for Opie-ALPHA Version January 2002
10-------------------------------------------------- 10--------------------------------------------------
11 11
12===================== 12=====================
13= Supported Devices = 13= Supported Devices =
14===================== 14=====================
15 15
16* low-level orinoco_cs-based (including prism2 and spectrum_cs) 16* low-level orinoco_cs-based (including prism2 and spectrum_cs)
17 17
18* Supported Interfaces: wlan0 (yes, I know this is hardcoded and
19 lame, but we're in a hurry and this can be configured soon...)
20
21===================== 18=====================
22= Build = 19= Build =
23===================== 20=====================
24 21
25To compile Wellenreiter within the Opie build environment, add the 22To compile Wellenreiter within the Opie build environment, add the
26following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' 23following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS='
27 24
28noncore/net/wellenreiter/libwellenreiter \ 25noncore/net/wellenreiter/libwellenreiter \
29noncore/net/wellenreiter/daemon \ 26noncore/net/wellenreiter/daemon \
30noncore/net/wellenreiter/contrib/orinoco_hopper \ 27noncore/net/wellenreiter/contrib/orinoco_hopper \
31noncore/net/wellenreiter/gui 28noncore/net/wellenreiter/gui
32 29
33./configure and rebuild. Note that you need libpcap in your toolchain. 30./configure and rebuild. Note that you need libpcap in your toolchain.
34 31
32To compile Wellenreiter within the OZ build environment, add the
33following lines to $OPIEDIR/packages
34CONFIG_WELLENREITER noncore/net/wellenreiter/libwellenreiter libwellenreiter.pro
35CONFIG_WELLENREITER noncore/net/wellenreiter/daemon daemon.pro
36CONFIG_WELLENREITER noncore/net/wellenreiter/gui gui.pro
37CONFIG_WELLENREITER noncore/net/wellenreiter/contrib/orinoco_hopper orinoco_hopper.pro
38
39make -f Makefile.test clean-configs
40cd <BUILDROOT>
41make SUBDIRS=packages/opie package
42
35===================== 43=====================
36= Install = 44= Install =
37===================== 45=====================
38 46
39Alternatively, you can use our precompiled ipk. Get it from 47Alternatively, you can use our precompiled ipk. Get it from
40http://opie.net.wox.org/elan/current. You will also need libpcap. 48http://opie.net.wox.org/wellenreiter/current/. This also includes a recent libpcap.
41 49
42===================== 50=====================
43= Run = 51= Run =
44===================== 52=====================
45 53
54There are two possible modes: <Manual> and <Automatic>. I suggest, you
55start with the <Automatic> Mode. This works just using the "Start"
56and "Stop" Pushbuttons in the Wellenreiter GUI. If this doesn't work,
57then use the following strategy:
58
461. Place card in monitor mode. This is device dependent. 591. Place card in monitor mode. This is device dependent.
47 60
48 Caution: Don't do this while you're logged in via ssh 61 Caution: Don't do this while you're logged in via ssh
49 or otherwise using the wireless interface - your connection 62 or otherwise using the wireless interface - your connection
50 will freeze: The card can't be used normally when sniffing! 63 will freeze: The card can't be used normally when sniffing!
51 64
52 For most orinoco-based cards this can be done using 65 For most orinoco-based cards this can be done using either
53 'iwpriv <interface> 2' or 'iwpriv <interface> 2 1'. 66 'iwpriv <interface> 2' or 'iwpriv <interface> 2 1'.
54 67
55 You can check if this works, by calling 'ifconfig <interface>'. 68 You can check if this works, by calling 'ifconfig <interface>'.
56 If you see 'Protocol: UNSPEC' and an unusual long MAC-Address, 69 If you see 'Protocol: UNSPEC' and an unusual long MAC-Address,
57 then your card has been successfully set to the monitor mode. 70 then your card has been successfully set to the monitor mode.
58 71
592. Start a channel hopper. A wireless card has several channels 722. Start a channel hopper. A wireless card has several channels
60 (e.g. radio frequencies) here it can listen for beacons. 73 (e.g. radio frequencies) here it can listen for beacons.
61 Beacons are management data frames from other stations. 74 Beacons are management data frames from other stations.
62 Remember, this is radio transmission, so the card has to be 75 Remember, this is radio transmission, so the card has to be
63 "tuned" to a certain channel to be able to receive the beacons. 76 "tuned" to a certain channel to be able to receive the beacons.
64 77
65 In order to scan the complete frequency spectrum and thus be able 78 In order to scan the complete frequency spectrum and thus be able
66 to detect all available stations, you have to 'hop' through the 79 to detect all available stations, you have to 'hop' through the
67 channels frequently. You can do this manually (e.g. with 'iwconfig') 80 channels frequently. You can do this manually (e.g. with 'iwconfig')
68 [hahaha] or you can use a channel hopper. 81 [hahaha] or you can use a channel hopper.
69 82
70 For convenience, the current Wellenreiter Alpha comes with a 83 For convenience, the current Wellenreiter Alpha comes with a
71 channel hopper for Orinoco-based cards. Start this via 84 channel hopper for Orinoco-based cards. Start this via
72 orinoco_hopper <interface>. 85 orinoco_hopper <interface>.
73 86
743. Start the Wellenreiter sniffing daemon: wellenreiterd. 873. Start the Wellenreiter sniffing daemon: wellenreiterd.
75 88
764. Start the Wellenreiter GUI and sniff like hell. Don't press the button 894. Start the Wellenreiter GUI and sniff like hell. Don't press the button
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index b22c5cc..4ee9a35 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -91,49 +91,49 @@ Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl )
91 #endif 91 #endif
92 92
93 // 93 //
94 // setup socket for daemon communication, register socket notifier 94 // setup socket for daemon communication, register socket notifier
95 // 95 //
96 96
97 // struct sockaddr_in sockaddr; 97 // struct sockaddr_in sockaddr;
98 daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr ); 98 daemon_fd = wl_setupsock( GUIADDR, GUIPORT, sockaddr );
99 if ( daemon_fd == -1 ) 99 if ( daemon_fd == -1 )
100 { 100 {
101 logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); 101 logwindow->log( "(E) Couldn't get file descriptor for commsocket." );
102 } 102 }
103 else 103 else
104 { 104 {
105 int flags; 105 int flags;
106 flags = fcntl( daemon_fd, F_GETFL, 0 ); 106 flags = fcntl( daemon_fd, F_GETFL, 0 );
107 fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK ); 107 fcntl( daemon_fd, F_SETFL, flags | O_NONBLOCK );
108 QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent ); 108 QSocketNotifier *sn = new QSocketNotifier( daemon_fd, QSocketNotifier::Read, parent );
109 connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) ); 109 connect( sn, SIGNAL( activated( int ) ), this, SLOT( dataReceived() ) );
110 } 110 }
111 111
112 // setup GUI 112 // setup GUI
113 113
114 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); 114 connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
115 button->setEnabled( false ); 115 // button->setEnabled( false );
116 netview->setColumnWidthMode( 1, QListView::Manual ); 116 netview->setColumnWidthMode( 1, QListView::Manual );
117 117
118 if ( manufacturerdb ) 118 if ( manufacturerdb )
119 netview->setManufacturerDB( manufacturerdb ); 119 netview->setManufacturerDB( manufacturerdb );
120 120
121} 121}
122 122
123Wellenreiter::~Wellenreiter() 123Wellenreiter::~Wellenreiter()
124{ 124{
125 // no need to delete child widgets, Qt does it all for us 125 // no need to delete child widgets, Qt does it all for us
126 126
127 delete manufacturerdb; 127 delete manufacturerdb;
128} 128}
129 129
130void Wellenreiter::handleMessage() 130void Wellenreiter::handleMessage()
131{ 131{
132 // FIXME: receive message and handle it 132 // FIXME: receive message and handle it
133 133
134 qDebug( "received message from daemon." ); 134 qDebug( "received message from daemon." );
135 135
136 /*char buffer[10000]; 136 /*char buffer[10000];
137 memset( &buffer, 0, sizeof( buffer ) );*/ 137 memset( &buffer, 0, sizeof( buffer ) );*/
138 138
139 char buffer[WL_SOCKBUF]; 139 char buffer[WL_SOCKBUF];
@@ -214,79 +214,95 @@ void Wellenreiter::dataReceived()
214void Wellenreiter::buttonClicked() 214void Wellenreiter::buttonClicked()
215{ 215{
216 /* 216 /*
217 // add some test stations, so that we can see if the GUI part works 217 // add some test stations, so that we can see if the GUI part works
218 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); 218 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 );
219 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); 219 addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 );
220 addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); 220 addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 );
221 addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); 221 addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
222 addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); 222 addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
223 */ 223 */
224 224
225 225
226 if ( daemonRunning ) 226 if ( daemonRunning )
227 { 227 {
228 daemonRunning = false; 228 daemonRunning = false;
229 229
230 logwindow->log( "(i) Daemon has been stopped." ); 230 logwindow->log( "(i) Daemon has been stopped." );
231 button->setText( "Start Scanning" ); 231 button->setText( "Start Scanning" );
232 232
233 // Stop daemon - ugly for now... later better 233 // Stop daemon - ugly for now... later better
234 234
235 system( "killall orinoco_hopper" ); 235 system( "killall orinoco_hopper" );
236 system( "killall wellenreiterd" ); 236 system( "killall wellenreiterd" );
237 237
238 // FIXME: reset the card trying to get into a usable state again 238 // get configuration from config window
239 239
240 // for now, just message the user 240 const QString& interface = configwindow->interfaceName->currentText();
241 const QString& cardtype = configwindow->deviceType->currentText();
242 const QString& interval = configwindow->hopInterval->cleanText();
243
244 // reset the card trying to get into a usable state again
245
246 QString cmdline;
247 cmdline.sprintf( "iwpriv %s monitor 1", (const char*) interface );
248 system( cmdline );
249 cmdline.sprintf( "iwpriv %s monitor 1 6", (const char*) interface );
250 system( cmdline );
251 cmdline.sprintf( "ifconfig %s -promisc", (const char*) interface );
252 system( cmdline );
253 cmdline.sprintf( "killall -14 dhcpcd" );
254 system( cmdline );
255 cmdline.sprintf( "killall -10 udhcpc" );
256
257 // message the user
241 258
242 QMessageBox::information( this, "Wellenreiter/Opie", "You should reset your\ndevice before using it again." ); 259 QMessageBox::information( this, "Wellenreiter/Opie", "Your wireless card\nshould now be usable again." );
243 } 260 }
244 261
245 else 262 else
246 { 263 {
247 264
248 logwindow->log( "(i) Daemon has been started." ); 265 logwindow->log( "(i) Daemon has been started." );
249 daemonRunning = true; 266 daemonRunning = true;
250 button->setText( "Stop Scanning" ); 267 button->setText( "Stop Scanning" );
251 268
252 // get configuration from config window 269 // get configuration from config window
253 270
254 const QString& interface = configwindow->interfaceName->currentText(); 271 const QString& interface = configwindow->interfaceName->currentText();
255 const QString& cardtype = configwindow->deviceType->currentText(); 272 const QString& cardtype = configwindow->deviceType->currentText();
256 const QString& interval = configwindow->hopInterval->cleanText(); 273 const QString& interval = configwindow->hopInterval->cleanText();
257 274
258 if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) ) 275 if ( ( interface == "<select>" ) || ( cardtype == "<select>" ) )
259 { 276 {
260 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." ); 277 QMessageBox::information( this, "Wellenreiter/Opie", "You must configure your\ndevice before scanning." );
261 return; 278 return;
262 } 279 }
263 280
264 // set interface into monitor mode 281 // set interface into monitor mode
265 /* Global::Execute definitely does not work very well with non-gui stuff! :( */ 282 /* Global::Execute definitely does not work very well with non-gui stuff! :( */
266 283
267 QString cmdline; 284 QString cmdline;
268
269 cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface ); 285 cmdline.sprintf( "iwpriv %s monitor 2", (const char*) interface );
270 system( cmdline ); 286 system( cmdline );
271 cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface ); 287 cmdline.sprintf( "iwpriv %s monitor 2 1", (const char*) interface );
272 system( cmdline ); 288 system( cmdline );
273 289
274 // start channel hopper 290 // start channel hopper
275 291
276 cmdline = "orinoco_hopper "; 292 cmdline = "orinoco_hopper ";
277 cmdline += interface; 293 cmdline += interface;
278 cmdline += " -i "; 294 cmdline += " -i ";
279 cmdline += interval; 295 cmdline += interval;
280 cmdline += " &"; 296 cmdline += " &";
281 qDebug( "execute: %s", (const char*) cmdline ); 297 qDebug( "execute: %s", (const char*) cmdline );
282 system( cmdline ); 298 system( cmdline );
283 qDebug( "done" ); 299 qDebug( "done" );
284 300
285 // start daemon 301 // start daemon
286 302
287 cmdline = "wellenreiterd "; 303 cmdline = "wellenreiterd ";
288 cmdline += interface; 304 cmdline += interface;
289 cmdline += " 3"; 305 cmdline += " 3";
290 cmdline += " &"; 306 cmdline += " &";
291 307
292 qDebug( "execute: %s", (const char*) cmdline ); 308 qDebug( "execute: %s", (const char*) cmdline );