summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-05 23:37:19 (UTC)
committer mickeyl <mickeyl>2004-01-05 23:37:19 (UTC)
commit4b272b07b86e4dce14ab71054a3741fa9ad33572 (patch) (unidiff)
tree381bf51d8e3258cbd15d36815b13dcfcac33845c
parentfa6a2e24a70be69724387355970814c0fb63701d (diff)
downloadopie-4b272b07b86e4dce14ab71054a3741fa9ad33572.zip
opie-4b272b07b86e4dce14ab71054a3741fa9ad33572.tar.gz
opie-4b272b07b86e4dce14ab71054a3741fa9ad33572.tar.bz2
add -nocheck command line option
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/ChangeLog1
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp101
2 files changed, 60 insertions, 42 deletions
diff --git a/noncore/net/wellenreiter/ChangeLog b/noncore/net/wellenreiter/ChangeLog
index 55e13fc..755ed76 100644
--- a/noncore/net/wellenreiter/ChangeLog
+++ b/noncore/net/wellenreiter/ChangeLog
@@ -1,72 +1,73 @@
1 2004-??-?? Michael Lauer <mickey@Vanille.de> 1 2004-??-?? Michael Lauer <mickey@Vanille.de>
2 2
3 * Added command line option "-nocheck" to skip non-root and dhcp tests
3 * Improved the speed reading the manufacturer list 4 * Improved the speed reading the manufacturer list
4 * GPS coordinates are now presented in the DMS (as opposed to decimal) format 5 * GPS coordinates are now presented in the DMS (as opposed to decimal) format
5 6
6 2003-12-18 Michael Lauer <mickey@Vanille.de> 7 2003-12-18 Michael Lauer <mickey@Vanille.de>
7 8
8 * Released as Version 1.0.2 (Development Snapshot) 9 * Released as Version 1.0.2 (Development Snapshot)
9 * Added automatic uploading of capture files to "The Capture Dump" site at 10 * Added automatic uploading of capture files to "The Capture Dump" site at
10 http://www.Vanille.de/projects/capturedump.spy 11 http://www.Vanille.de/projects/capturedump.spy
11 * Initial reading of the manufacturer database happens now in background 12 * Initial reading of the manufacturer database happens now in background
12 * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now. 13 * Removed deprecated setMonitorMode() API ==> Use setMode( "monitor" ) now.
13 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that 14 The monitor mode now tries to use the standard IW_MODE_MONITOR first. If that
14 doesn't work, it falls back to using the proprietary iwpriv commands 15 doesn't work, it falls back to using the proprietary iwpriv commands
15 16
16 2003-11-30 Michael Lauer <mickey@Vanille.de> 17 2003-11-30 Michael Lauer <mickey@Vanille.de>
17 18
18 * Released as Version 1.0.1 (Development Snapshot) 19 * Released as Version 1.0.1 (Development Snapshot)
19 * Fixed ARP decoding for wired networks. 20 * Fixed ARP decoding for wired networks.
20 Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol. 21 Interestingly, 802.11 encapsulates these in IP packets, while wired ethernet just tags the type_of_protocol.
21 * Added reading GPS data from a gps daemon. 22 * Added reading GPS data from a gps daemon.
22 * Started preparations for utilizing Wellenreiter II in wired networks. 23 * Started preparations for utilizing Wellenreiter II in wired networks.
23 * Implemented persistant configuration interface and retriggerable auto detection. 24 * Implemented persistant configuration interface and retriggerable auto detection.
24 * Added QCOP interface for talking to opie-networksettings. 25 * Added QCOP interface for talking to opie-networksettings.
25 * Added parsing of DHCP packets and detecting DHCP servers. 26 * Added parsing of DHCP packets and detecting DHCP servers.
26 * Overhauled the configuration window and started with the customizable event system. 27 * Overhauled the configuration window and started with the customizable event system.
27 * Added disabling the screensaver. 28 * Added disabling the screensaver.
28 * Added automatic opening and scrolling to the network tree if a new station appears. 29 * Added automatic opening and scrolling to the network tree if a new station appears.
29 30
30 2003-05-10 Michael Lauer <mickey@Vanille.de> 31 2003-05-10 Michael Lauer <mickey@Vanille.de>
31 32
32 * Released as Version 1.0 (Stable) 33 * Released as Version 1.0 (Stable)
33 * Added restarting the dhcp client if having killed it before. 34 * Added restarting the dhcp client if having killed it before.
34 * Decouple dump files from live capture to shift control over 'what' is dumped to applications. 35 * Decouple dump files from live capture to shift control over 'what' is dumped to applications.
35 36
36 2003-05-05 Michael Lauer <mickey@Vanille.de> 37 2003-05-05 Michael Lauer <mickey@Vanille.de>
37 38
38 * Released as Version 1.0-RC1 (Release Candidate) 39 * Released as Version 1.0-RC1 (Release Candidate)
39 * Fixed rare segfaults while sniffing and operating the GUI simultaenously. 40 * Fixed rare segfaults while sniffing and operating the GUI simultaenously.
40 * Parse more data packets and detect more participating stations. 41 * Parse more data packets and detect more participating stations.
41 * Added live graph window showing the signal strength on all channels. 42 * Added live graph window showing the signal strength on all channels.
42 * Added parsing ARP packets and identifying IP addresses of participating stations. 43 * Added parsing ARP packets and identifying IP addresses of participating stations.
43 * Added parsing with optionally enabled PRISM headers (signal strength). 44 * Added parsing with optionally enabled PRISM headers (signal strength).
44 45
45 2003-04-12 Michael Lauer <mickey@Vanille.de> 46 2003-04-12 Michael Lauer <mickey@Vanille.de>
46 47
47 * Released as Version 1.0 (Beta) 48 * Released as Version 1.0 (Beta)
48 * GUI enhancements in the Menubar and the Toolbar. 49 * GUI enhancements in the Menubar and the Toolbar.
49 * Improved keyboard handling. 50 * Improved keyboard handling.
50 * Added sanity checks for running Wellenreiter II as non-root or with dhcp clients in the background. 51 * Added sanity checks for running Wellenreiter II as non-root or with dhcp clients in the background.
51 * Add writing and replaying of libpcap compatible capture files. 52 * Add writing and replaying of libpcap compatible capture files.
52 53
53 2003-04-08 Michael Lauer <mickey@Vanille.de> 54 2003-04-08 Michael Lauer <mickey@Vanille.de>
54 55
55 * Released as Version 0.2 (Alpha) 56 * Released as Version 0.2 (Alpha)
56 * Closed memory leak in packet capturer. 57 * Closed memory leak in packet capturer.
57 * Fixed client stations appearing under essid as access points. 58 * Fixed client stations appearing under essid as access points.
58 * Fixed false WEP reporting in some cases. 59 * Fixed false WEP reporting in some cases.
59 * Started with inspecting data packages. 60 * Started with inspecting data packages.
60 * Add detecting associated client stations in infrastructural networks (if they transmit data). 61 * Add detecting associated client stations in infrastructural networks (if they transmit data).
61 * Worked around buggy hostap drivers writing past fixed-length-structures on arm. 62 * Worked around buggy hostap drivers writing past fixed-length-structures on arm.
62 * Added dynamic checking of available private ioctls. 63 * Added dynamic checking of available private ioctls.
63 * Added a saveable hex window for packet dissection. 64 * Added a saveable hex window for packet dissection.
64 65
65 2003-03-30 Michael Lauer <mickey@Vanille.de> 66 2003-03-30 Michael Lauer <mickey@Vanille.de>
66 67
67 * Released as Version 0.1 (Alpha) 68 * Released as Version 0.1 (Alpha)
68 69
69 2003-03-25 Michael Lauer <mickey@Vanille.de> 70 2003-03-25 Michael Lauer <mickey@Vanille.de>
70 71
71 * Rewrote Wellenreiter II from scratch - including the sniffing engine. 72 * Rewrote Wellenreiter II from scratch - including the sniffing engine.
72 * Beacon inspection works and finds ad-hoc networks and managed networks. 73 * Beacon inspection works and finds ad-hoc networks and managed networks.
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 55a5260..dd757b5 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -1,114 +1,131 @@
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#include "mainwindow.h" 16#include "mainwindow.h"
17#ifdef QWS 17#ifdef QWS
18#include <opie2/oapplication.h> 18#include <opie2/oapplication.h>
19#else 19#else
20#include <qapplication.h> 20#include <qapplication.h>
21#endif 21#endif
22 22
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qstringlist.h> 24#include <qstringlist.h>
25 25
26// ==> OProcess 26// ==> OProcess
27#include <qdir.h> 27#include <qdir.h>
28#include <qfileinfo.h> 28#include <qfileinfo.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31 31
32#include <errno.h> 32#include <errno.h>
33#include <signal.h> 33#include <signal.h>
34#include <string.h> 34#include <string.h>
35#include <unistd.h> 35#include <unistd.h>
36 36
37int main( int argc, char **argv ) 37int main( int argc, char **argv )
38{ 38{
39 #ifdef QWS 39 #ifdef QWS
40 OApplication a( argc, argv, "Wellenreiter II" ); 40 OApplication a( argc, argv, "Wellenreiter II" );
41 #else 41 #else
42 QApplication a( argc, argv ); 42 QApplication a( argc, argv );
43 #endif 43 #endif
44 WellenreiterMainWindow* w = new WellenreiterMainWindow(); 44 WellenreiterMainWindow* w = new WellenreiterMainWindow();
45 #ifdef QWS 45 #ifdef QWS
46 a.showMainWidget( w ); 46 a.showMainWidget( w );
47 #else 47 #else
48 a.setMainWidget( w ); 48 a.setMainWidget( w );
49 w->setCaption( "Wellenreiter II" ); 49 w->setCaption( "Wellenreiter II" );
50 w->show(); 50 w->show();
51 #endif 51 #endif
52 52
53 a.processEvents(); // show the window before doing the safety checks 53 a.processEvents(); // show the window before doing the safety checks
54 int result = -1; 54 int result = -1;
55 static int killed = false;
55 56
56 // root check 57 bool check = true;
57 if ( getuid() ) 58 for ( int i = 1; i < argc; ++i )
58 { 59 {
59 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 60 if ( !strcmp( "-nocheck", argv[i] ) )
60 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 61 {
61 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 62 qDebug( "-nocheck found" );
62 QMessageBox::Yes, QMessageBox::No ); 63 check = false;
63 if ( result == QMessageBox::No ) return -1; 64 break;
65 }
64 } 66 }
65 67
66 // dhcp check - NOT HERE! This really belongs as a static member to OProcess 68 if ( check )
67 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... 69 {
70 // root check
71 if ( getuid() )
72 {
73 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
74 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
75 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
76 QMessageBox::Yes, QMessageBox::No );
77 if ( result == QMessageBox::No ) return -1;
78 }
68 79
69 static int killed = false; 80 // dhcp check - NOT HERE! This really belongs as a static member to OProcess
81 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
70 82
71 QString line; 83 QString line;
72 QDir d = QDir( "/proc" ); 84 QDir d = QDir( "/proc" );
73 QStringList dirs = d.entryList( QDir::Dirs ); 85 QStringList dirs = d.entryList( QDir::Dirs );
74 QStringList::Iterator it; 86 QStringList::Iterator it;
75 for ( it = dirs.begin(); it != dirs.end(); ++it ) 87 for ( it = dirs.begin(); it != dirs.end(); ++it )
76 { 88 {
77 //qDebug( "next entry: %s", (const char*) *it ); 89 //qDebug( "next entry: %s", (const char*) *it );
78 QFile file( "/proc/"+*it+"/cmdline" ); 90 QFile file( "/proc/"+*it+"/cmdline" );
79 file.open( IO_ReadOnly ); 91 file.open( IO_ReadOnly );
80 if ( !file.isOpen() ) continue; 92 if ( !file.isOpen() ) continue;
81 QTextStream t( &file ); 93 QTextStream t( &file );
82 line = t.readLine(); 94 line = t.readLine();
83 //qDebug( "cmdline = %s", (const char*) line ); 95 //qDebug( "cmdline = %s", (const char*) line );
84 if ( line.contains( "dhcp" ) ) break; 96 if ( line.contains( "dhcp" ) ) break;
85 } 97 }
86 if ( line.contains( "dhcp" ) ) 98 if ( line.contains( "dhcp" ) )
87 {
88 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
89 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
90 "This can severly limit scanning!\nShould I kill it for you?" ),
91 QMessageBox::Yes, QMessageBox::No );
92 if ( result == QMessageBox::Yes )
93 { 99 {
94 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) 100 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
95 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 101 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
96 else 102 "This can severly limit scanning!\nShould I kill it for you?" ),
97 killed = true; 103 QMessageBox::Yes, QMessageBox::No );
104 if ( result == QMessageBox::Yes )
105 {
106 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
107 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
108 else
109 killed = true;
110 }
98 } 111 }
99 } 112 }
100 113
101 a.exec(); 114 a.exec();
102 115
103 if ( killed ) 116 if ( check )
104 { 117 {
105 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); 118
106 if ( result == QMessageBox::Yes ) 119 if ( killed )
107 { 120 {
108 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); 121 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
122 if ( result == QMessageBox::Yes )
123 {
124 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
125 }
109 } 126 }
110 }
111 127
112 delete w; 128 delete w;
129 }
113 return 0; 130 return 0;
114} 131}