summaryrefslogtreecommitdiff
Unidiff
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
@@ -7,34 +7,93 @@
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>
24#include <qstringlist.h>
25
26// ==> OProcess
27#include <qdir.h>
28#include <qfileinfo.h>
29#include <qregexp.h>
30#include <qtextstream.h>
31
32#include <errno.h>
33#include <signal.h>
34#include <string.h>
35#include <unistd.h>
36
23int main( int argc, char **argv ) 37int main( int argc, char **argv )
24{ 38{
25 #ifdef QWS 39 #ifdef QWS
26 OApplication a( argc, argv, "Wellenreiter II" ); 40 OApplication a( argc, argv, "Wellenreiter II" );
27 #else 41 #else
28 QApplication a( argc, argv ); 42 QApplication a( argc, argv );
29 #endif 43 #endif
30 WellenreiterMainWindow* w = new WellenreiterMainWindow(); 44 WellenreiterMainWindow* w = new WellenreiterMainWindow();
31 #ifdef QWS 45 #ifdef QWS
32 a.showMainWidget( w ); 46 a.showMainWidget( w );
33 #else 47 #else
34 a.setMainWidget( w ); 48 a.setMainWidget( w );
35 w->show(); 49 w->show();
36 #endif 50 #endif
51
52 a.processEvents(); // show the window before doing the safety checks
53 int result = -1;
54
55 // root check
56 if ( getuid() )
57 {
58 qWarning( "Wellenreiter: trying to run as non-root!" );
59 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", "You have started Wellenreiter II\n"
60 "as non-root. You will have\nonly limited functionality.\nProceed anyway?",
61 QMessageBox::Yes, QMessageBox::No );
62 if ( result == QMessageBox::No ) return -1;
63 }
64
65 // dhcp check - NOT HERE! This really belongs as a static member to OProcess
66 // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
67
68 QString line;
69 QDir d = QDir( "/proc" );
70 QStringList dirs = d.entryList( QDir::Dirs );
71 QStringList::Iterator it;
72 for ( it = dirs.begin(); it != dirs.end(); ++it )
73 {
74 //qDebug( "next entry: %s", (const char*) *it );
75 QFile file( "/proc/"+*it+"/cmdline" );
76 file.open( IO_ReadOnly );
77 if ( !file.isOpen() ) continue;
78 QTextStream t( &file );
79 line = t.readLine();
80 //qDebug( "cmdline = %s", (const char*) line );
81 if ( line.contains( "dhcp" ) ) break;
82 }
83 if ( line.contains( "dhcp" ) )
84 {
85 qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
86 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", "You have a dhcp client running.\n"
87 "This can severly limit scanning!\nShould I kill it for you?",
88 QMessageBox::Yes, QMessageBox::No );
89 if ( result == QMessageBox::Yes )
90 {
91 if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
92 qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) );
93 }
94 }
95
37 a.exec(); 96 a.exec();
38 delete w; 97 delete w;
39 return 0; 98 return 0;
40} 99}
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
@@ -22,32 +22,33 @@ using namespace Opie;
22 22
23#ifdef QWS 23#ifdef QWS
24#include <opie2/oapplication.h> 24#include <opie2/oapplication.h>
25#else 25#else
26#include <qapplication.h> 26#include <qapplication.h>
27#endif 27#endif
28#include <opie2/onetwork.h> 28#include <opie2/onetwork.h>
29#include <opie2/opcap.h> 29#include <opie2/opcap.h>
30 30
31// Qt 31// Qt
32 32
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <qregexp.h>
38#include <qspinbox.h> 39#include <qspinbox.h>
39#include <qtoolbutton.h> 40#include <qtoolbutton.h>
40#include <qmainwindow.h> 41#include <qmainwindow.h>
41 42
42// Standard 43// Standard
43 44
44#include <assert.h> 45#include <assert.h>
45#include <errno.h> 46#include <errno.h>
46#include <unistd.h> 47#include <unistd.h>
47#include <string.h> 48#include <string.h>
48#include <sys/types.h> 49#include <sys/types.h>
49#include <stdlib.h> 50#include <stdlib.h>
50 51
51// Local 52// Local
52 53
53#include "wellenreiter.h" 54#include "wellenreiter.h"
@@ -312,33 +313,37 @@ void Wellenreiter::startClicked()
312 if ( cardtype < DEVTYPE_FILE ) 313 if ( cardtype < DEVTYPE_FILE )
313 { 314 {
314 if ( cardtype != DEVTYPE_MANUAL ) 315 if ( cardtype != DEVTYPE_MANUAL )
315 iface->setMonitorMode( true ); 316 iface->setMonitorMode( true );
316 if ( !iface->monitorMode() ) 317 if ( !iface->monitorMode() )
317 { 318 {
318 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); 319 QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." );
319 return; 320 return;
320 } 321 }
321 } 322 }
322 323
323 // open pcap and start sniffing 324 // open pcap and start sniffing
324 if ( cardtype != DEVTYPE_FILE ) 325 if ( cardtype != DEVTYPE_FILE )
325 { 326 {
326 if ( configwindow->writeCaptureFile->isEnabled() ) 327 if ( configwindow->writeCaptureFile->isEnabled() )
327 { 328 {
328 pcap->open( interface, configwindow->captureFileName->text() ); 329 QString dumpname( configwindow->captureFileName->text() );
330 dumpname.append( '-' );
331 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
332 dumpname.append( ".wellenreiter" );
333 pcap->open( interface, dumpname );
329 } 334 }
330 else 335 else
331 { 336 {
332 pcap->open( interface ); 337 pcap->open( interface );
333 } 338 }
334 } 339 }
335 else 340 else
336 { 341 {
337 pcap->open( QFile( interface ) ); 342 pcap->open( QFile( interface ) );
338 } 343 }
339 344
340 if ( !pcap->isOpen() ) 345 if ( !pcap->isOpen() )
341 { 346 {
342 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); 347 QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
343 return; 348 return;
344 } 349 }
@@ -352,27 +357,33 @@ void Wellenreiter::startClicked()
352 357
353 if ( cardtype != DEVTYPE_FILE ) 358 if ( cardtype != DEVTYPE_FILE )
354 { 359 {
355 // connect socket notifier and start channel hopper 360 // connect socket notifier and start channel hopper
356 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 361 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
357 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 362 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
358 } 363 }
359 else 364 else
360 { 365 {
361 // start timer for reading packets 366 // start timer for reading packets
362 startTimer( 100 ); 367 startTimer( 100 );
363 } 368 }
364 369
365 logwindow->log( "(i) Started Scanning." ); 370 logwindow->log( "(i) Started Scanning." );
366 sniffing = true; 371 sniffing = true;
367 emit( startedSniffing() ); 372 emit( startedSniffing() );
373 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
374 else
375 {
376 assert( parent() );
377 ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." );
378 }
368} 379}
369 380
370 381
371void Wellenreiter::timerEvent( QTimerEvent* ) 382void Wellenreiter::timerEvent( QTimerEvent* )
372{ 383{
373 qDebug( "Wellenreiter::timerEvent()" ); 384 qDebug( "Wellenreiter::timerEvent()" );
374 OPacket* p = pcap->next(); 385 OPacket* p = pcap->next();
375 receivePacket( p ); 386 receivePacket( p );
376 delete p; 387 delete p;
377} 388}
378 389
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
@@ -118,33 +118,33 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
118 TextLabel1_4_2->setFont( TextLabel1_4_2_font ); 118 TextLabel1_4_2->setFont( TextLabel1_4_2_font );
119 TextLabel1_4_2->setText( tr( "<p align=center>\n" 119 TextLabel1_4_2->setText( tr( "<p align=center>\n"
120"<hr>\n" 120"<hr>\n"
121"Max Moser<br>\n" 121"Max Moser<br>\n"
122"Martin J. Muench<br>\n" 122"Martin J. Muench<br>\n"
123"Michael Lauer<br><hr>\n" 123"Michael Lauer<br><hr>\n"
124"<b>www.remote-exploit.org</b>\n" 124"<b>www.remote-exploit.org</b>\n"
125"</p>" ) ); 125"</p>" ) );
126 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) ); 126 TextLabel1_4_2->setAlignment( int( QLabel::AlignCenter ) );
127 127
128 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 ); 128 aboutLayout->addWidget( TextLabel1_4_2, 1, 0 );
129 129
130#ifdef QWS 130#ifdef QWS
131 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) ); 131 TabWidget->addTab( ap, "wellenreiter/networks", tr( "Nets" ) );
132 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) ); 132 TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
133 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) ); 133 TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
134 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stats" ) ); 134 TabWidget->addTab( statwindow, "wellenreiter/stat", tr( "Stat" ) );
135 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) ); 135 TabWidget->addTab( about, "wellenreiter/about", tr( "About" ) );
136#else 136#else
137 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) ); 137 TabWidget->addTab( ap, /* "wellenreiter/networks", */ tr( "Networks" ) );
138 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) ); 138 TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
139 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) ); 139 TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
140 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) ); 140 TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) );
141 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) ); 141 TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
142#endif 142#endif
143 WellenreiterBaseLayout->addWidget( TabWidget ); 143 WellenreiterBaseLayout->addWidget( TabWidget );
144 144
145#ifdef QWS 145#ifdef QWS
146 TabWidget->setCurrentTab( tr( "Nets" ) ); 146 TabWidget->setCurrentTab( tr( "Nets" ) );
147#endif 147#endif
148 148
149} 149}
150 150