summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui52
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp20
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h4
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp48
-rw-r--r--noncore/net/wellenreiter/gui/gps.h19
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp40
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
7 files changed, 153 insertions, 32 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index c1da98d..d9a0aea 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -314,2 +314,6 @@
314 </property> 314 </property>
315 <property stdset="1">
316 <name>editable</name>
317 <bool>false</bool>
318 </property>
315 <property> 319 <property>
@@ -1022,3 +1026,3 @@
1022 <name>name</name> 1026 <name>name</name>
1023 <cstring>ComboBox8</cstring> 1027 <cstring>gpsdHost</cstring>
1024 </property> 1028 </property>
@@ -1052,3 +1056,3 @@
1052 <name>name</name> 1056 <name>name</name>
1053 <cstring>SpinBox2</cstring> 1057 <cstring>gpsdPort</cstring>
1054 </property> 1058 </property>
@@ -1074,6 +1078,10 @@
1074 <widget> 1078 <widget>
1075 <class>QCheckBox</class> 1079 <class>QLineEdit</class>
1076 <property stdset="1"> 1080 <property stdset="1">
1077 <name>name</name> 1081 <name>name</name>
1078 <cstring>enableGPS</cstring> 1082 <cstring>commandGPS</cstring>
1083 </property>
1084 <property stdset="1">
1085 <name>enabled</name>
1086 <bool>false</bool>
1079 </property> 1087 </property>
@@ -1083,5 +1091,5 @@
1083 <x>10</x> 1091 <x>10</x>
1084 <y>10</y> 1092 <y>110</y>
1085 <width>199</width> 1093 <width>210</width>
1086 <height>21</height> 1094 <height>22</height>
1087 </rect> 1095 </rect>
@@ -1090,3 +1098,3 @@
1090 <name>text</name> 1098 <name>text</name>
1091 <string>Enable GPS logging w/ gpsd</string> 1099 <string>gpsd -p /dev/ttyS3 -s 57600</string>
1092 </property> 1100 </property>
@@ -1097,3 +1105,3 @@
1097 <name>name</name> 1105 <name>name</name>
1098 <cstring>startGPS</cstring> 1106 <cstring>enableGPS</cstring>
1099 </property> 1107 </property>
@@ -1103,4 +1111,4 @@
1103 <x>10</x> 1111 <x>10</x>
1104 <y>80</y> 1112 <y>10</y>
1105 <width>171</width> 1113 <width>199</width>
1106 <height>21</height> 1114 <height>21</height>
@@ -1110,3 +1118,3 @@
1110 <name>text</name> 1118 <name>text</name>
1111 <string>Start gpsd on localhost</string> 1119 <string>Enable GPS logging w/ gpsd</string>
1112 </property> 1120 </property>
@@ -1114,10 +1122,6 @@
1114 <widget> 1122 <widget>
1115 <class>QLineEdit</class> 1123 <class>QCheckBox</class>
1116 <property stdset="1"> 1124 <property stdset="1">
1117 <name>name</name> 1125 <name>name</name>
1118 <cstring>commandGPS</cstring> 1126 <cstring>startGPS</cstring>
1119 </property>
1120 <property stdset="1">
1121 <name>enabled</name>
1122 <bool>false</bool>
1123 </property> 1127 </property>
@@ -1127,5 +1131,5 @@
1127 <x>10</x> 1131 <x>10</x>
1128 <y>110</y> 1132 <y>80</y>
1129 <width>210</width> 1133 <width>171</width>
1130 <height>22</height> 1134 <height>21</height>
1131 </rect> 1135 </rect>
@@ -1134,3 +1138,3 @@
1134 <name>text</name> 1138 <name>text</name>
1135 <string>gpsd -p /dev/ttyS3 -s 57600</string> 1139 <string>Start gpsd on localhost</string>
1136 </property> 1140 </property>
@@ -1209,3 +1213,3 @@
1209 <signal>toggled(bool)</signal> 1213 <signal>toggled(bool)</signal>
1210 <receiver>ComboBox8</receiver> 1214 <receiver>gpsdHost</receiver>
1211 <slot>setEnabled(bool)</slot> 1215 <slot>setEnabled(bool)</slot>
@@ -1215,3 +1219,3 @@
1215 <signal>toggled(bool)</signal> 1219 <signal>toggled(bool)</signal>
1216 <receiver>SpinBox2</receiver> 1220 <receiver>gpsdPort</receiver>
1217 <slot>setEnabled(bool)</slot> 1221 <slot>setEnabled(bool)</slot>
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 11394d7..a331925 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -189,4 +189,22 @@ void WellenreiterConfigWindow::channelAllClicked(int state)
189 channel13->setChecked( b ); 189 channel13->setChecked( b );
190 channel14->setChecked( b ); 190 channel14->setChecked( b );
191} 191}
192 192
193
194bool WellenreiterConfigWindow::useGPS() const
195{
196 return enableGPS->isChecked();
197}
198
199
200const QString WellenreiterConfigWindow::gpsHost() const
201{
202 return useGPS() ? gpsdHost->currentText() : QString::null;
203}
204
205
206int WellenreiterConfigWindow::gpsPort() const
207{
208 bool ok;
209 return useGPS() ? gpsdPort->value() : -1;
210}
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 32dc840..8f160b1 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -48,2 +48,6 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
48 48
49 bool useGPS() const;
50 const QString gpsHost() const;
51 int gpsPort() const;
52
49 public slots: 53 public slots:
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp
index c3bff53..4a24647 100644
--- a/noncore/net/wellenreiter/gui/gps.cpp
+++ b/noncore/net/wellenreiter/gui/gps.cpp
@@ -17 +17,49 @@
17 17
18GPS::GPS( QObject* parent, const char * name )
19 :QObject( parent, name )
20{
21 qDebug( "GPS::GPS()" );
22 _socket = new QSocket( this, "gpsd commsock" );
23}
24
25
26GPS::~GPS()
27{
28 qDebug( "GPS::~GPS()" );
29}
30
31
32bool GPS::open( const QString& host, int port )
33{
34 _socket->connectToHost( host, port );
35}
36
37
38float GPS::latitude() const
39{
40 char buf[256];
41
42 int result = _socket->writeBlock( "p\r\n", 3 );
43 if ( result )
44 {
45 qDebug( "GPS write succeeded" );
46 _socket->waitForMore( 20 );
47 if ( _socket->canReadLine() )
48 {
49
50 int num = _socket->readLine( &buf[0], sizeof buf );
51 if ( num )
52 {
53 qDebug( "GPS got line: %s", &buf );
54 return 0.0;
55 }
56 }
57 }
58 return -1.0;
59}
60
61
62float GPS::longitute() const
63{
64}
65
diff --git a/noncore/net/wellenreiter/gui/gps.h b/noncore/net/wellenreiter/gui/gps.h
index e7c3dce..ad0b6de 100644
--- a/noncore/net/wellenreiter/gui/gps.h
+++ b/noncore/net/wellenreiter/gui/gps.h
@@ -18,2 +18,21 @@
18 18
19#include <qobject.h>
20#include <qsocket.h>
21
22class GPS : public QObject
23{
24 Q_OBJECT
25
26 public:
27 GPS( QObject* parent = 0, const char * name = "GPS" );
28 ~GPS();
29
30 bool open( const QString& host = "localhost", int port = 2947 );
31 float latitude() const;
32 float longitute() const;
33
34 private:
35 QSocket* _socket;
36};
37
19#endif // GPS_H 38#endif // GPS_H
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 96733ff..c03debb 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -17,2 +17,3 @@
17 17
18#include "gps.h"
18#include "wellenreiter.h" 19#include "wellenreiter.h"
@@ -87,2 +88,4 @@ Wellenreiter::Wellenreiter( QWidget* parent )
87 pcap = new OPacketCapturer(); 88 pcap = new OPacketCapturer();
89
90 gps = new GPS( this );
88} 91}
@@ -169,2 +172,10 @@ void Wellenreiter::handleBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
169 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); 172 OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
173
174 if ( configwindow->enableGPS->isChecked() )
175 {
176 qDebug( "Wellenreiter::gathering GPS data..." );
177 float lat = gps->latitude();
178 qDebug( "Wellenreiter::GPS data received is ( %f , %f )", lat, 0.0 );
179 }
180
170 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 ); 181 netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0 );
@@ -240,3 +251,3 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
240 // if so, do what the user requested (protocolAction), e.g. pass or discard 251 // if so, do what the user requested (protocolAction), e.g. pass or discard
241 if ( !configwindow->writeCaptureFile->isOn() ) 252 if ( !configwindow->writeCaptureFile->isChecked() )
242 return false; 253 return false;
@@ -359,3 +370,6 @@ void Wellenreiter::startClicked()
359 ONetwork* net = ONetwork::instance(); 370 ONetwork* net = ONetwork::instance();
360 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); 371
372 // TODO: check if interface is wireless and support sniffing for non-wireless interfaces
373
374 iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless!
361 375
@@ -391,5 +405,6 @@ void Wellenreiter::startClicked()
391 { 405 {
392 QMessageBox::warning( this, "Wellenreiter II", 406 if ( QMessageBox::warning( this, "Wellenreiter II",
393 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) ); 407 tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
394 return; 408 tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
409 return;
395 } 410 }
@@ -397,2 +412,9 @@ void Wellenreiter::startClicked()
397 412
413 // open GPS device
414 if ( configwindow->enableGPS->isChecked() )
415 {
416 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
417 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
418 }
419
398 // open pcap and start sniffing 420 // open pcap and start sniffing
@@ -402,5 +424,6 @@ void Wellenreiter::startClicked()
402 424
403 if ( configwindow->writeCaptureFile->isOn() ) 425 if ( configwindow->writeCaptureFile->isChecked() )
404 { 426 {
405 QString dumpname( configwindow->captureFileName->text() ); 427 QString dumpname( configwindow->captureFileName->text() );
428 if ( dumpname.isEmpty() ) dumpname = "captureFile";
406 dumpname.append( '-' ); 429 dumpname.append( '-' );
@@ -432,3 +455,6 @@ void Wellenreiter::startClicked()
432 if ( cardtype != DEVTYPE_FILE ) 455 if ( cardtype != DEVTYPE_FILE )
433 iface->setChannelHopping( 1000 ); //use interval from config window 456 {
457 logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
458 iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
459 }
434 460
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index e1062df..43f6f99 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -35,2 +35,3 @@ class MLogWindow;
35class MHexWindow; 35class MHexWindow;
36class GPS;
36 37
@@ -83,2 +84,3 @@ class Wellenreiter : public WellenreiterBase {
83 WellenreiterConfigWindow* configwindow; 84 WellenreiterConfigWindow* configwindow;
85 GPS* gps;
84 86