-rw-r--r-- | noncore/net/wellenreiter/README | 27 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 26 |
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,86 +1,99 @@ | |||
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 | -------------------------------------------------- |
9 | Release Notes for Opie-ALPHA Version December 2002 | 9 | Release 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 | ||
25 | To compile Wellenreiter within the Opie build environment, add the | 22 | To compile Wellenreiter within the Opie build environment, add the |
26 | following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' | 23 | following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' |
27 | 24 | ||
28 | noncore/net/wellenreiter/libwellenreiter \ | 25 | noncore/net/wellenreiter/libwellenreiter \ |
29 | noncore/net/wellenreiter/daemon \ | 26 | noncore/net/wellenreiter/daemon \ |
30 | noncore/net/wellenreiter/contrib/orinoco_hopper \ | 27 | noncore/net/wellenreiter/contrib/orinoco_hopper \ |
31 | noncore/net/wellenreiter/gui | 28 | noncore/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 | ||
32 | To compile Wellenreiter within the OZ build environment, add the | ||
33 | following lines to $OPIEDIR/packages | ||
34 | CONFIG_WELLENREITER noncore/net/wellenreiter/libwellenreiter libwellenreiter.pro | ||
35 | CONFIG_WELLENREITER noncore/net/wellenreiter/daemon daemon.pro | ||
36 | CONFIG_WELLENREITER noncore/net/wellenreiter/gui gui.pro | ||
37 | CONFIG_WELLENREITER noncore/net/wellenreiter/contrib/orinoco_hopper orinoco_hopper.pro | ||
38 | |||
39 | make -f Makefile.test clean-configs | ||
40 | cd <BUILDROOT> | ||
41 | make SUBDIRS=packages/opie package | ||
42 | |||
35 | ===================== | 43 | ===================== |
36 | = Install = | 44 | = Install = |
37 | ===================== | 45 | ===================== |
38 | 46 | ||
39 | Alternatively, you can use our precompiled ipk. Get it from | 47 | Alternatively, you can use our precompiled ipk. Get it from |
40 | http://opie.net.wox.org/elan/current. You will also need libpcap. | 48 | http://opie.net.wox.org/wellenreiter/current/. This also includes a recent libpcap. |
41 | 49 | ||
42 | ===================== | 50 | ===================== |
43 | = Run = | 51 | = Run = |
44 | ===================== | 52 | ===================== |
45 | 53 | ||
54 | There are two possible modes: <Manual> and <Automatic>. I suggest, you | ||
55 | start with the <Automatic> Mode. This works just using the "Start" | ||
56 | and "Stop" Pushbuttons in the Wellenreiter GUI. If this doesn't work, | ||
57 | then use the following strategy: | ||
58 | |||
46 | 1. Place card in monitor mode. This is device dependent. | 59 | 1. 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 | ||
59 | 2. Start a channel hopper. A wireless card has several channels | 72 | 2. 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 | ||
74 | 3. Start the Wellenreiter sniffing daemon: wellenreiterd. | 87 | 3. Start the Wellenreiter sniffing daemon: wellenreiterd. |
75 | 88 | ||
76 | 4. Start the Wellenreiter GUI and sniff like hell. Don't press the button | 89 | 4. Start the Wellenreiter GUI and sniff like hell. Don't press the button |
77 | "Start Scan" yet, because it enables the demo mode and will crash the | 90 | "Start Scan" yet, because it enables the demo mode and will crash the |
78 | wellenreiterd daemon if running. | 91 | wellenreiterd daemon if running. |
79 | 92 | ||
80 | ===================== | 93 | ===================== |
81 | = Credits = | 94 | = Credits = |
82 | ===================== | 95 | ===================== |
83 | 96 | ||
84 | Sniffer: Max Moser <max@remote-exploit.org> | 97 | Sniffer: Max Moser <max@remote-exploit.org> |
85 | Communication and Protocol: Martin J. Muench <mjm@remote-exploit.org> | 98 | Communication and Protocol: Martin J. Muench <mjm@remote-exploit.org> |
86 | GUI: Michael Lauer <mickeyl@handhelds.org> | 99 | GUI: Michael Lauer <mickeyl@handhelds.org> |
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 | |||
@@ -1,297 +1,313 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
19 | #include <qmessagebox.h> | 19 | #include <qmessagebox.h> |
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qspinbox.h> | 21 | #include <qspinbox.h> |
22 | #include <qsocketnotifier.h> | 22 | #include <qsocketnotifier.h> |
23 | 23 | ||
24 | // Qtopia | 24 | // Qtopia |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | // Opie | 31 | // Opie |
32 | 32 | ||
33 | #ifdef QWS | 33 | #ifdef QWS |
34 | #include <opie/odevice.h> | 34 | #include <opie/odevice.h> |
35 | using namespace Opie; | 35 | using namespace Opie; |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | // Standard | 38 | // Standard |
39 | 39 | ||
40 | #include <assert.h> | 40 | #include <assert.h> |
41 | #include <errno.h> | 41 | #include <errno.h> |
42 | #include <unistd.h> | 42 | #include <unistd.h> |
43 | #include <string.h> | 43 | #include <string.h> |
44 | #include <sys/types.h> | 44 | #include <sys/types.h> |
45 | #include <sys/socket.h> | 45 | #include <sys/socket.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | 48 | ||
49 | // Local | 49 | // Local |
50 | 50 | ||
51 | #include "wellenreiter.h" | 51 | #include "wellenreiter.h" |
52 | #include "scanlist.h" | 52 | #include "scanlist.h" |
53 | #include "logwindow.h" | 53 | #include "logwindow.h" |
54 | #include "hexwindow.h" | 54 | #include "hexwindow.h" |
55 | #include "configwindow.h" | 55 | #include "configwindow.h" |
56 | 56 | ||
57 | #include "manufacturers.h" | 57 | #include "manufacturers.h" |
58 | 58 | ||
59 | #include <daemon/source/config.hh> | 59 | #include <daemon/source/config.hh> |
60 | #include <libwellenreiter/source/wl_types.hh> | 60 | #include <libwellenreiter/source/wl_types.hh> |
61 | #include <libwellenreiter/source/wl_sock.hh> | 61 | #include <libwellenreiter/source/wl_sock.hh> |
62 | #include <libwellenreiter/source/wl_proto.hh> | 62 | #include <libwellenreiter/source/wl_proto.hh> |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) |
65 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) | 65 | : WellenreiterBase( parent, name, fl ), daemonRunning( false ), manufacturerdb( 0 ) |
66 | { | 66 | { |
67 | 67 | ||
68 | // | 68 | // |
69 | // construct manufacturer database | 69 | // construct manufacturer database |
70 | // | 70 | // |
71 | 71 | ||
72 | QString manufile; | 72 | QString manufile; |
73 | #ifdef QWS | 73 | #ifdef QWS |
74 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 74 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
75 | #else | 75 | #else |
76 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); | 76 | manufile.sprintf( "/home/mickey/work/opie/share/wellenreiter/manufacturers.dat" ); |
77 | #endif | 77 | #endif |
78 | manufacturerdb = new ManufacturerDB( manufile ); | 78 | manufacturerdb = new ManufacturerDB( manufile ); |
79 | 79 | ||
80 | logwindow->log( "(i) Wellenreiter has been started." ); | 80 | logwindow->log( "(i) Wellenreiter has been started." ); |
81 | 81 | ||
82 | // | 82 | // |
83 | // detect operating system | 83 | // detect operating system |
84 | // | 84 | // |
85 | 85 | ||
86 | #ifdef QWS | 86 | #ifdef QWS |
87 | QString sys; | 87 | QString sys; |
88 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 88 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
89 | _system = ODevice::inst()->system(); | 89 | _system = ODevice::inst()->system(); |
90 | logwindow->log( sys ); | 90 | logwindow->log( sys ); |
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 | ||
123 | Wellenreiter::~Wellenreiter() | 123 | Wellenreiter::~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 | ||
130 | void Wellenreiter::handleMessage() | 130 | void 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]; |
140 | 140 | ||
141 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | 141 | // int result = #wl_recv( &daemon_fd, (char*) &buffer, sizeof(buffer) ); |
142 | 142 | ||
143 | /* | 143 | /* |
144 | 144 | ||
145 | struct sockaddr from; | 145 | struct sockaddr from; |
146 | socklen_t len; | 146 | socklen_t len; |
147 | 147 | ||
148 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); | 148 | int result = recvfrom( daemon_fd, &buffer, 8192, MSG_WAITALL, &from, &len ); |
149 | qDebug( "received %d from recv [%d bytes]", result, len ); | 149 | qDebug( "received %d from recv [%d bytes]", result, len ); |
150 | 150 | ||
151 | */ | 151 | */ |
152 | 152 | ||
153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); | 153 | int result = wl_recv( &daemon_fd, sockaddr, (char*) &buffer, WL_SOCKBUF ); |
154 | 154 | ||
155 | if ( result == -1 ) | 155 | if ( result == -1 ) |
156 | { | 156 | { |
157 | qDebug( "Warning: %s", strerror( errno ) ); | 157 | qDebug( "Warning: %s", strerror( errno ) ); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | 160 | ||
161 | int command = buffer[1] - 48; | 161 | int command = buffer[1] - 48; |
162 | 162 | ||
163 | /* | 163 | /* |
164 | typedef struct { | 164 | typedef struct { |
165 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | 165 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc |
166 | int ssid_len; Length of SSID | 166 | int ssid_len; Length of SSID |
167 | int channel; Channel | 167 | int channel; Channel |
168 | int wep; 1 = WEP enabled ; 0 = disabled | 168 | int wep; 1 = WEP enabled ; 0 = disabled |
169 | char mac[64]; MAC address of Accesspoint | 169 | char mac[64]; MAC address of Accesspoint |
170 | char bssid[128]; BSSID of Accesspoint | 170 | char bssid[128]; BSSID of Accesspoint |
171 | } wl_network_t; | 171 | } wl_network_t; |
172 | */ | 172 | */ |
173 | 173 | ||
174 | qDebug( "Recv result: %d", ( result ) ); | 174 | qDebug( "Recv result: %d", ( result ) ); |
175 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); | 175 | qDebug( "Sniffer sent: '%s'", (const char*) buffer ); |
176 | hexwindow->log( (const char*) &buffer ); | 176 | hexwindow->log( (const char*) &buffer ); |
177 | 177 | ||
178 | if ( command == NETFOUND ) /* new network found */ | 178 | if ( command == NETFOUND ) /* new network found */ |
179 | { | 179 | { |
180 | qDebug( "Sniffer said: new network found." ); | 180 | qDebug( "Sniffer said: new network found." ); |
181 | wl_network_t n; | 181 | wl_network_t n; |
182 | get_network_found( &n, (char*) &buffer ); | 182 | get_network_found( &n, (char*) &buffer ); |
183 | 183 | ||
184 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); | 184 | qDebug( "Sniffer said: net_type is %d.", n.net_type ); |
185 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); | 185 | qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); |
186 | 186 | ||
187 | //n.bssid[n.ssid_len] = "\0"; | 187 | //n.bssid[n.ssid_len] = "\0"; |
188 | 188 | ||
189 | QString type; | 189 | QString type; |
190 | 190 | ||
191 | if ( n.net_type == 1 ) | 191 | if ( n.net_type == 1 ) |
192 | type = "managed"; | 192 | type = "managed"; |
193 | else | 193 | else |
194 | type = "adhoc"; | 194 | type = "adhoc"; |
195 | 195 | ||
196 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); | 196 | netview->addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); |
197 | 197 | ||
198 | } | 198 | } |
199 | 199 | ||
200 | else | 200 | else |
201 | 201 | ||
202 | { | 202 | { |
203 | qDebug( "unknown sniffer command." ); | 203 | qDebug( "unknown sniffer command." ); |
204 | } | 204 | } |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | void Wellenreiter::dataReceived() | 208 | void Wellenreiter::dataReceived() |
209 | { | 209 | { |
210 | logwindow->log( "(d) Received data from daemon" ); | 210 | logwindow->log( "(d) Received data from daemon" ); |
211 | handleMessage(); | 211 | handleMessage(); |
212 | } | 212 | } |
213 | 213 | ||
214 | void Wellenreiter::buttonClicked() | 214 | void 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 ); |
293 | system( cmdline ); | 309 | system( cmdline ); |
294 | qDebug( "done" ); | 310 | qDebug( "done" ); |
295 | 311 | ||
296 | } | 312 | } |
297 | } | 313 | } |