author | mickeyl <mickeyl> | 2002-12-10 01:24:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-10 01:24:42 (UTC) |
commit | 448426777d9e35826898791d03b4bc71335427ff (patch) (side-by-side diff) | |
tree | dfc55fb0b22ea22e4b873da8b4329dc31f15ad8b | |
parent | 8641065755bbb1e2ff96e7fb964d4b0cd91c65b6 (diff) | |
download | opie-448426777d9e35826898791d03b4bc71335427ff.zip opie-448426777d9e35826898791d03b4bc71335427ff.tar.gz opie-448426777d9e35826898791d03b4bc71335427ff.tar.bz2 |
towards an alpha version
-rw-r--r-- | noncore/net/wellenreiter/README | 37 | ||||
-rw-r--r-- | noncore/net/wellenreiter/config.in | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in | 101 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c | 118 | ||||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o | bin | 0 -> 35856 bytes | |||
-rw-r--r-- | noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro | 11 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configbase.ui | 307 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 24 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/opie-wellenreiter.control | 2 |
13 files changed, 604 insertions, 11 deletions
diff --git a/noncore/net/wellenreiter/README b/noncore/net/wellenreiter/README new file mode 100644 index 0000000..4ed5c28 --- a/dev/null +++ b/noncore/net/wellenreiter/README @@ -0,0 +1,37 @@ +/*************************************************************************/ +/* W e l l e n r e i t e r I I */ +/* =============================== */ +/* */ +/* Version: Opie-ALPHA */ +/*************************************************************************/ + +Release Notes for Opie-ALPHA Version December 2002 +-------------------------------------------------- + += Supported Devices = + +* low-level orinoco_cs-based (including prism2 and spectrum_cs) + += Build = + +To compile Wellenreiter within the Opie build environment, add the +following directories to $OPIEDIR/Makefile, e.g. to 'NONAPPS=' + +noncore/net/wellenreiter/libwellenreiter \ +noncore/net/wellenreiter/daemon \ +noncore/net/wellenreiter/contrib/orinoco_hopper \ +noncore/net/wellenreiter/gui + +./configure and rebuild. + += Run = + +1. Place card in monitor mode: iwpriv <interface> 2 1 +2. Start $OPIEDIR/bin/orinoco_hopper <interface> +3. Start Wellenreiter + += Credits = + +Sniffer: Max Moser <max@remote-exploit.org> +Communication and Protocol: Martin J. Muench <mjm@remote-exploit.org> +GUI: Michael Lauer <mickeyl@handhelds.org> diff --git a/noncore/net/wellenreiter/config.in b/noncore/net/wellenreiter/config.in index d6b48d8..3c33b68 100644 --- a/noncore/net/wellenreiter/config.in +++ b/noncore/net/wellenreiter/config.in @@ -1,4 +1,4 @@ -# config #WELLENREITER +# config WELLENREITER # boolean "wellenreiter" # default "y" -# depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE +# depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBPCAP diff --git a/noncore/net/wellenreiter/contrib/.cvsignore b/noncore/net/wellenreiter/contrib/.cvsignore new file mode 100644 index 0000000..0e45b67 --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/.cvsignore @@ -0,0 +1,4 @@ +*.o +*~ +moc_* +Makefile.* diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore b/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore new file mode 100644 index 0000000..0e45b67 --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/.cvsignore @@ -0,0 +1,4 @@ +*.o +*~ +moc_* +Makefile.* diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in b/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in new file mode 100644 index 0000000..c542a59 --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/Makefile.in @@ -0,0 +1,101 @@ +############################################################################# + +####### Compiler, tools and options + +CXX = $(SYSCONF_CXX) $(QT_CXX_MT) +CXXFLAGS= $(SYSCONF_CXXFLAGS) +CC = $(SYSCONF_CC) $(QT_C_MT) +CFLAGS = $(SYSCONF_CFLAGS) +INCPATH = +LFLAGS = $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) +LIBS = $(SUBLIBS) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP) +MOC = $(SYSCONF_MOC) +UIC = $(SYSCONF_UIC) + +####### Target + +DESTDIR = $(OPIEDIR)/bin/ +VER_MAJ = 1 +VER_MIN = 0 +VER_PATCH = 0 +TARGET = orinoco_hopper +TARGET1 = lib$(TARGET).so.$(VER_MAJ) + +####### Files + +HEADERS = +SOURCES = orinoco_hopper.c +OBJECTS = orinoco_hopper.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = +OBJMOC = + + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(DESTDIR)$(TARGET) + +$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +moc: $(SRCMOC) + +tmake: + tmake orinoco_hopper.pro + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) + -rm -f *~ core + -rm -f allmoc.cpp + +####### Extension Modules + +listpromodules: + @echo + +listallmodules: + @echo + +listaddonpromodules: + @echo + +listaddonentmodules: + @echo + + +REQUIRES= + +####### Sub-libraries + + +###### Combined headers + + + +####### Compile + +orinoco_hopper.o: orinoco_hopper.c + + diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c new file mode 100644 index 0000000..78f0299 --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.c @@ -0,0 +1,118 @@ +/* orinoco_hopper.c + * orinoco wireless nic channel scanning utility + * + * By Snax <snax@shmoo.com> + * Copyright (c) 2002 Snax + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a copy of the GNU General Public License write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <signal.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/socket.h> +#include <linux/wireless.h> +#include <unistd.h> +#include <getopt.h> + +#ifndef SIOCIWFIRSTPRIV +#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE +#endif + +void changeChannel(int); +int setChannel( unsigned char channel ); + +int max = 11; +int mode = 2; +char dev[32]; + +void changeChannel(int x) { + static int chan = 0; + chan = (chan % max) + 1; + setChannel(chan); +} + +int setChannel( unsigned char channel ) +{ + int result = 0; + int fd; + struct iwreq ireq; //for Orinoco + int *ptr; + + /* get a socket */ + fd = socket(AF_INET, SOCK_STREAM, 0); + + if ( fd == -1 ) { + return -1; + } + ptr = (int *) ireq.u.name; + ptr[0] = mode; + ptr[1] = channel; + strcpy(ireq.ifr_ifrn.ifrn_name, dev); + result = ioctl( fd, SIOCIWFIRSTPRIV + 0x8, &ireq); + close(fd); + return result; +} + +void usage(char *cmd) { + fprintf(stderr, + "Usage: %s <iface> [-p] [-i <interval millisec>] [-n]\n -n = international channels\n -p = keep prism headers\n", cmd); + exit(1); +} + +int main (int argc, char *argv[]) +{ + struct itimerval tval; + int ms, r; + + //this will be the channel scanning interval, currently 0.2 sec + struct timeval interval = {0, 200000}; + + if (argc < 2) usage(argv[0]); + strncpy(dev, argv[1], 32); + dev[31] = 0; + + while (1) { + r = getopt(argc,argv,"i:np"); + if (r < 0) break; + switch (r) { + case 'n': + max = 14; + break; + case 'p': + mode = 1; + break; + case 'i': + ms = atoi(optarg); + interval.tv_sec = ms / 1000; + interval.tv_usec = (ms % 1000) * 1000; + break; + default: + usage(argv[0]); + } + } + + //this sets up the kchannel scanning stuff + signal(SIGALRM, changeChannel); + tval.it_interval = interval; + tval.it_value = interval; + setitimer(ITIMER_REAL, &tval, NULL); + while (1) pause(); + + return 0; +} + diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o Binary files differnew file mode 100644 index 0000000..dd90c62 --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.o diff --git a/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro new file mode 100644 index 0000000..a85520c --- a/dev/null +++ b/noncore/net/wellenreiter/contrib/orinoco_hopper/orinoco_hopper.pro @@ -0,0 +1,11 @@ +DESTDIR = $(OPIEDIR)/bin +TEMPLATE = app +CONFIG = warn_on debug +#CONFIG = warn_on release +HEADERS = +SOURCES = orinoco_hopper.c +INCLUDEPATH += +DEPENDPATH += +LIBS += +INTERFACES = +TARGET = orinoco_hopper diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui new file mode 100644 index 0000000..8f38252 --- a/dev/null +++ b/noncore/net/wellenreiter/gui/configbase.ui @@ -0,0 +1,307 @@ +<!DOCTYPE UI><UI> +<class>Form1</class> +<widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Form1</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>0</x> + <y>0</y> + <width>226</width> + <height>300</height> + </rect> + </property> + <property stdset="1"> + <name>caption</name> + <string>Form1</string> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox1</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Sniffer Options</string> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="0" column="0" > + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout1</cstring> + </property> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget row="2" column="0" > + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>hopInterval</cstring> + </property> + <property stdset="1"> + <name>suffix</name> + <string> ms</string> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>2000</number> + </property> + <property stdset="1"> + <name>minValue</name> + <number>100</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>100</number> + </property> + </widget> + <widget row="2" column="1" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel3</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Hop Interval</string> + </property> + </widget> + <widget row="0" column="0" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><select></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>eth0</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>eth1</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>wlan0</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>wlan1</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>wifi0</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>wifi1</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>interfaceName</cstring> + </property> + </widget> + <widget row="0" column="1" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Interface Name</string> + </property> + </widget> + <widget row="1" column="0" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string><select></string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>cisco</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>orinoco</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>prism</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string><manual></string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>deviceType</cstring> + </property> + </widget> + <widget row="1" column="1" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Device Type</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox8</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Advanced Options</string> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>additionalInfo</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>11</x> + <y>19</y> + <width>147</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Gather Additional Info</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>activeScanning</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>11</x> + <y>44</y> + <width>175</width> + <height>19</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Active Scanning (caution!)</string> + </property> + </widget> + </widget> + <widget> + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>GroupBox3</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>GUI Options</string> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>11</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>groupNetworks</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Group Detected Networks</string> + </property> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>enableActivity</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Enable Activity Display</string> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +</UI> diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 8f14bc1..a047433 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro @@ -1,11 +1,11 @@ DESTDIR = $(OPIEDIR)/bin TEMPLATE = app CONFIG = qt warn_on debug #CONFIG = qt warn_on release HEADERS = wellenreiterbase.h wellenreiter.h scanlistitem.h scanlist.h logwindow.h hexwindow.h SOURCES = main.cpp wellenreiterbase.cpp wellenreiter.cpp scanlistitem.cpp scanlist.cpp logwindow.cpp hexwindow.cpp INCLUDEPATH += $(OPIEDIR)/include ../daemon DEPENDPATH += $(OPIEDIR)/include ../daemon LIBS += -lqpe -lopie -lwellenreiter -INTERFACES = wellenreitertemplate.ui +INTERFACES = configbase.ui TARGET = wellenreiter diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 6d62fa8..3453d18 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -1,246 +1,256 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ***********************************************************************/ // Qt #include <qpushbutton.h> // Standard #include <assert.h> +#include <errno.h> #include <unistd.h> +#include <string.h> #include <sys/types.h> // Local #include "wellenreiter.h" #include "scanlistitem.h" #include "logwindow.h" #include "hexwindow.h" #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) : WellenreiterBase( parent, name, fl ) { logwindow->log( "(i) Wellenreiter has been started." ); connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); netview->setColumnWidthMode( 1, QListView::Manual ); // // setup socket for daemon communication and start poller // daemon_fd = commsock( GUIADDR, GUIPORT ); if ( daemon_fd == -1 ) { logwindow->log( "(E) Couldn't get file descriptor for commsocket." ); qDebug( "D'oh! Could not get file descriptor for daemon-->gui communication socket." ); } else startTimer( 700 ); } Wellenreiter::~Wellenreiter() { // no need to delete child widgets, Qt does it all for us } void Wellenreiter::handleMessage() { // FIXME: receive message and handle it qDebug( "received message from daemon." ); char buffer[128]; int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); qDebug( "received %d from recvcomm", result ); /* typedef struct { int net_type; 1 = Accesspoint ; 2 = Ad-Hoc int ssid_len; Length of SSID int channel; Channel int wep; 1 = WEP enabled ; 0 = disabled char mac[64]; MAC address of Accesspoint char bssid[128]; BSSID of Accesspoint } wl_network_t; */ // qDebug( "Sniffer sent: '%s'", (const char*) buffer ); hexwindow->log( (const char*) &buffer ); if ( result == NETFOUND ) /* new network found */ { qDebug( "Sniffer said: new network found." ); wl_network_t n; get_network_found( &n, (char*) &buffer ); qDebug( "Sniffer said: net_type is %d.", n.net_type ); qDebug( "Sniffer said: MAC is %s", (const char*) &n.mac ); //n.bssid[n.ssid_len] = "\0"; QString type; if ( n.net_type == 1 ) type = "managed"; else type = "adhoc"; addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); } else { qDebug( "unknown sniffer command." ); } } bool Wellenreiter::hasMessage() { // FIXME: do this in libwellenreiter, not here!!! fd_set rfds; FD_ZERO( &rfds ); FD_SET( daemon_fd, &rfds ); struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 10; int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); - return FD_ISSET( daemon_fd, &rfds ); + + if ( result == 0 ) + { + return false; + } + else if ( result == -1 ) + { + qDebug( "selected returned: %s", strerror( errno ) ); + return false; + } + else + return true; //FD_ISSET( daemon_fd, &rfds ); gibbet 'eh nur einen Deskriptor } void Wellenreiter::timerEvent( QTimerEvent* e ) { qDebug( "checking for message..." ); - - int result = hasMessage(); - qDebug( "hasMessage() returned %d", result ); - - if ( result ) + if ( hasMessage() ) { + qDebug( "got message" ); handleMessage(); } else { - qDebug( "no message :(" ); + qDebug( "no message..." ); } } void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) { // FIXME: this code belongs in customized QListView, not into this class // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]", (const char*) type, (const char*) essid, (const char*) macaddr, channel ); // search, if we already have seen this net QString s; MScanListItem* network; MScanListItem* item = (MScanListItem*) netview->firstChild(); while ( item && ( item->text( 0 ) != essid ) ) { qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); item = item->itemBelow(); } if ( item ) { // we have already seen this net, check all childs if MAC exists network = item; item = item->firstChild(); assert( item ); // this shouldn't fail while ( item && ( item->text( 2 ) != macaddr ) ) { qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); item = item->itemBelow(); } if ( item ) { // we have already seen this item, it's a dupe qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); return; } } else { s.sprintf( "(i) new network: '%s'", (const char*) essid ); logwindow->log( s ); network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); } // insert new station as child from network // no essid to reduce clutter, maybe later we have a nick or stationname to display!? qDebug( "inserting new station %s", (const char*) macaddr ); new MScanListItem( network, type, "", macaddr, wep, channel, signal ); if ( type == "managed" ) { s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); } else { s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); } logwindow->log( s ); } void Wellenreiter::buttonClicked() { // FIXME: communicate with daemon and set button text according to state button->setText( "Stop Scanning" ); // add some test stations, so that we can see if the GUI part works addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); QString command ("98"); //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc index 6b0fffb..84caf12 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc @@ -1,192 +1,193 @@ /* * rfmon mode sniffer * * $Id$ */ #include "sniff.hh" #include "ieee802_11.hh" #include "extract.hh" #include "log.hh" #include "proto.hh" /* Main function, checks packets */ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet, char *guihost, int guiport) { unsigned int caplen = pkthdr->caplen; unsigned int length = pkthdr->len; u_int16_t fc; unsigned int HEADER_LENGTH; /* pinfo holds all interresting information for us */ struct packetinfo pinfo; struct packetinfo *pinfoptr; /* wl_network_t will finally be set and send to the ui */ wl_network_t wl_net; pinfoptr=&pinfo; pinfoptr->isvalid = 0; pinfoptr->pktlen = pkthdr->len; if (caplen < IEEE802_11_FC_LEN) { /* This is a garbage packet, because is does not long enough to hold a 802.11b header */ pinfoptr->isvalid = 0; return; } /* Gets the framecontrol bits (2bytes long) */ fc = EXTRACT_LE_16BITS(packet); HEADER_LENGTH = GetHeaderLength(fc); if (caplen < HEADER_LENGTH) { /* This is a garbage packet, because it is not long enough to hold a correct header of its type */ pinfoptr->isvalid = 0; return; } /* Decode 802.11b header out of the packet */ if (decode_80211b_hdr(packet,pinfoptr) == 0) { /* Justification of the ofset to further process the packet */ length -= HEADER_LENGTH; caplen -= HEADER_LENGTH; packet += HEADER_LENGTH; } else /* Something is wrong,could not be a correct packet */ return; switch (FC_TYPE(fc)) { /* Is it a managemnet frame? */ case T_MGMT: switch (FC_SUBTYPE(fc)) { case ST_BEACON: if (handle_beacon(fc, packet,pinfoptr) ==0) { if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) { /* Every beacon must have the broadcast as destination so it must be a shitti packet */ pinfoptr->isvalid = 0; return; } if (pinfoptr->cap_ESS == pinfoptr->cap_IBSS) { /* Only one of both are possible, so must be a noise packet, if this comes up */ pinfoptr->isvalid = 0; return; } if (pinfoptr->channel < 1 || pinfoptr->channel > 14) { /* Only channels between 1 and 14 are possible others must be noise packets */ pinfoptr->isvalid = 0; return; } + printf( "cap_ESS is %d, cap_IBSS is %d\n", pinfoptr->cap_ESS, pinfoptr->cap_IBSS ); /* Here should be the infos to the gui issued */ if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0) { wl_loginfo("Found an access point"); wl_net.net_type=1; } else if(pinfoptr->cap_ESS == 0 && pinfoptr->cap_IBSS == 2) { wl_loginfo("Found an ad-hoc network"); wl_net.net_type=2; } if (strcmp (pinfoptr->ssid,NONBROADCASTING) ==0) { wl_loginfo("Net is a non-broadcasting network"); } else { wl_loginfo("SSID is: %s", pinfoptr->ssid); // wl_net.bssid=pinfoptr->ssid; } wl_loginfo("SSID length is: %d", pinfoptr->ssid_len); wl_net.ssid_len=pinfoptr->ssid_len; wl_loginfo("Channel is: %d", pinfoptr->channel); wl_net.channel=pinfoptr->channel; wl_net.wep=pinfoptr->cap_WEP; wl_loginfo("Mac is: %s", pinfoptr->sndhwaddr); memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac)-1);; wl_loginfo("SSID is: %s", pinfoptr->ssid); memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)-1); // printf ("\n\tDest : %s\n",pinfoptr->desthwaddr); send_network_found((char *)guihost, guiport, &wl_net); wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); } break; default: wl_logerr("Unknown IEEE802.11 frame subtype (%d)", FC_SUBTYPE(fc)); break; } /* End of switch over different mgt frame types */ break; case T_CTRL: wl_loginfo("Received control frame, not implemented yet"); break; case T_DATA: wl_loginfo("Received date frame, not implemented yet"); break; default: wl_logerr("Unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)); break; } } /* This decodes the 802.11b frame header out of the 802.11b packet all the infos is placed into the packetinfo structure */ int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo) { const struct mgmt_header_t *mgthdr = (const struct mgmt_header_t *) p; ppinfo->fcsubtype = FC_SUBTYPE(mgthdr->fc); /* Get the sender, bssid and dest mac address */ etheraddr_string(mgthdr->bssid,ppinfo->bssid); etheraddr_string(mgthdr->da,ppinfo->desthwaddr); etheraddr_string(mgthdr->sa,ppinfo->sndhwaddr); ppinfo->fc_wep = FC_WEP(mgthdr->fc); return 0; } void etheraddr_string(register const u_char *ep, char *text) { static char hex[] = "0123456789abcdef"; register unsigned int i, j; register char *cp; char buf[sizeof("00:00:00:00:00:00\0")]; cp = buf; if ((j = *ep >> 4) != 0) { *cp++ = hex[j]; } else { *cp++ = '0'; } *cp++ = hex[*ep++ & 0xf]; for (i = 5; (int)--i >= 0;) { *cp++ = ':'; diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control index da83359..83bfd0e 100644 --- a/noncore/net/wellenreiter/opie-wellenreiter.control +++ b/noncore/net/wellenreiter/opie-wellenreiter.control @@ -1,9 +1,9 @@ -Files: bin/wellenreiter bin/wellenreiterd pics/wellenreiter $QTDIR/lib/libwellenreiter.* +Files: bin/wellenreiter bin/wellenreiterd bin/orinoco_hopper pics/wellenreiter $QTDIR/lib/libwellenreiter.* Priority: optional Section: opie/applications Maintainer: Michael Lauer <mickeyl@handhelds.org> Architecture: arm Version: $QPE_VERSION-$SUB_VERSION Depends: opie-base ($QPE_VERSION) Description: A wavelan network monitor A wavelan network monitor/sniffer for the Opie environment. |