summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp59
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp13
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp2
3 files changed, 72 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 8d4ef57..03da135 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -22,2 +22,16 @@
+#include <qmessagebox.h>
+#include <qstringlist.h>
+
+// ==> OProcess
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qregexp.h>
+#include <qtextstream.h>
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
int main( int argc, char **argv )
@@ -36,2 +50,47 @@ int main( int argc, char **argv )
#endif
+
+ a.processEvents(); // show the window before doing the safety checks
+ int result = -1;
+
+ // root check
+ if ( getuid() )
+ {
+ qWarning( "Wellenreiter: trying to run as non-root!" );
+ result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", "You have started Wellenreiter II\n"
+ "as non-root. You will have\nonly limited functionality.\nProceed anyway?",
+ QMessageBox::Yes, QMessageBox::No );
+ if ( result == QMessageBox::No ) return -1;
+ }
+
+ // dhcp check - NOT HERE! This really belongs as a static member to OProcess
+ // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
+
+ QString line;
+ QDir d = QDir( "/proc" );
+ QStringList dirs = d.entryList( QDir::Dirs );
+ QStringList::Iterator it;
+ for ( it = dirs.begin(); it != dirs.end(); ++it )
+ {
+ //qDebug( "next entry: %s", (const char*) *it );
+ QFile file( "/proc/"+*it+"/cmdline" );
+ file.open( IO_ReadOnly );
+ if ( !file.isOpen() ) continue;
+ QTextStream t( &file );
+ line = t.readLine();
+ //qDebug( "cmdline = %s", (const char*) line );
+ if ( line.contains( "dhcp" ) ) break;
+ }
+ if ( line.contains( "dhcp" ) )
+ {
+ qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
+ result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", "You have a dhcp client running.\n"
+ "This can severly limit scanning!\nShould I kill it for you?",
+ QMessageBox::Yes, QMessageBox::No );
+ if ( result == QMessageBox::Yes )
+ {
+ if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
+ qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) );
+ }
+ }
+
a.exec();
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index be2a86e..b4b6aa3 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -37,2 +37,3 @@ using namespace Opie;
#include <qmessagebox.h>
+#include <qregexp.h>
#include <qspinbox.h>
@@ -327,3 +328,7 @@ void Wellenreiter::startClicked()
{
- pcap->open( interface, configwindow->captureFileName->text() );
+ QString dumpname( configwindow->captureFileName->text() );
+ dumpname.append( '-' );
+ dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
+ dumpname.append( ".wellenreiter" );
+ pcap->open( interface, dumpname );
}
@@ -367,2 +372,8 @@ void Wellenreiter::startClicked()
emit( startedSniffing() );
+ if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
+ else
+ {
+ assert( parent() );
+ ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." );
+ }
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index 245b9fc..9745069 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -133,3 +133,3 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
- TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stats" ) );
+ TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );