summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/ChangeLog1
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp21
2 files changed, 20 insertions, 2 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,14 +1,15 @@
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
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
@@ -43,40 +43,52 @@ int main( int argc, char **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
57 bool check = true;
58 for ( int i = 1; i < argc; ++i )
59 {
60 if ( !strcmp( "-nocheck", argv[i] ) )
61 {
62 qDebug( "-nocheck found" );
63 check = false;
64 break;
65 }
66 }
67
68 if ( check )
69 {
56 // root check 70 // root check
57 if ( getuid() ) 71 if ( getuid() )
58 { 72 {
59 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 73 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
60 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 74 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
61 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 75 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
62 QMessageBox::Yes, QMessageBox::No ); 76 QMessageBox::Yes, QMessageBox::No );
63 if ( result == QMessageBox::No ) return -1; 77 if ( result == QMessageBox::No ) return -1;
64 } 78 }
65 79
66 // dhcp check - NOT HERE! This really belongs as a static member to OProcess 80 // dhcp check - NOT HERE! This really belongs as a static member to OProcess
67 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... 81 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
68 82
69 static int killed = false;
70
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();
@@ -88,27 +100,32 @@ int main( int argc, char **argv )
88 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); 100 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" 101 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?" ), 102 "This can severly limit scanning!\nShould I kill it for you?" ),
91 QMessageBox::Yes, QMessageBox::No ); 103 QMessageBox::Yes, QMessageBox::No );
92 if ( result == QMessageBox::Yes ) 104 if ( result == QMessageBox::Yes )
93 { 105 {
94 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) 106 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
95 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 107 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
96 else 108 else
97 killed = true; 109 killed = true;
98 } 110 }
99 } 111 }
112 }
100 113
101 a.exec(); 114 a.exec();
102 115
116 if ( check )
117 {
118
103 if ( killed ) 119 if ( killed )
104 { 120 {
105 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); 121 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
106 if ( result == QMessageBox::Yes ) 122 if ( result == QMessageBox::Yes )
107 { 123 {
108 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); 124 system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
109 } 125 }
110 } 126 }
111 127
112 delete w; 128 delete w;
129 }
113 return 0; 130 return 0;
114} 131}