summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/daemon/source/config.hh2
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.cc35
-rw-r--r--noncore/net/wellenreiter/daemon/source/daemon.hh2
3 files changed, 31 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/config.hh b/noncore/net/wellenreiter/daemon/source/config.hh
index 42c56da..cac9565 100644
--- a/noncore/net/wellenreiter/daemon/source/config.hh
+++ b/noncore/net/wellenreiter/daemon/source/config.hh
@@ -20,11 +20,9 @@
20#define GUIADDR "127.0.0.1" /* Adress of GUI, later specified in configfile */ 20#define GUIADDR "127.0.0.1" /* Adress of GUI, later specified in configfile */
21#define GUIPORT 37773 /* Port of GUI, " " */ 21#define GUIPORT 37773 /* Port of GUI, " " */
22 22
23
24/* Temporary cardmode stuff, will hopefully removed soon */ 23/* Temporary cardmode stuff, will hopefully removed soon */
25#define CARD_TYPE_CISCO 1 24#define CARD_TYPE_CISCO 1
26#define CARD_TYPE_NG 2 25#define CARD_TYPE_NG 2
27#define CARD_TYPE_HOSTAP 3 26#define CARD_TYPE_HOSTAP 3
28#define SNIFFER_DEVICE "wlan0"
29 27
30#endif /* CONFIG_HH */ 28#endif /* CONFIG_HH */
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.cc b/noncore/net/wellenreiter/daemon/source/daemon.cc
index cc72377..54f308a 100644
--- a/noncore/net/wellenreiter/daemon/source/daemon.cc
+++ b/noncore/net/wellenreiter/daemon/source/daemon.cc
@@ -10,8 +10,8 @@
10/* Main function of wellenreiterd */ 10/* Main function of wellenreiterd */
11int main(int argc, char **argv) 11int main(int argc, char **argv)
12{ 12{
13 int sock, maxfd, retval; 13 int sock, maxfd, retval, card_type;
14 char buffer[128]; 14 char buffer[128], sniffer_device[5];
15 struct pcap_pkthdr header; 15 struct pcap_pkthdr header;
16 pcap_t *handletopcap; 16 pcap_t *handletopcap;
17 const unsigned char *packet; 17 const unsigned char *packet;
@@ -19,8 +19,21 @@ int main(int argc, char **argv)
19 fd_set rset; 19 fd_set rset;
20 20
21 fprintf(stderr, "wellenreiterd %s\n\n", VERSION); 21 fprintf(stderr, "wellenreiterd %s\n\n", VERSION);
22 fprintf(stderr, "(c) 2002 by M-M-M\n\n");
22 23
23 if(!card_into_monitormode(&handletopcap, SNIFFER_DEVICE, CARD_TYPE)) 24 if(argc < 3)
25 usage();
26
27 /* Set sniffer device */
28 memset(sniffer_device, 0, sizeof(sniffer_device));
29 strncpy(sniffer_device, (char *)argv[1], sizeof(sniffer_device) - 1);
30
31 /* Set card type */
32 card_type = atoi(argv[2]);
33 if(card_type < 1 || card_type > 3)
34 usage();
35
36 if(!card_into_monitormode(&handletopcap, sniffer_device, card_type))
24 { 37 {
25 wl_logerr("Cannot set card into mon mode, aborting"); 38 wl_logerr("Cannot set card into mon mode, aborting");
26 exit(-1); 39 exit(-1);
@@ -28,7 +41,7 @@ int main(int argc, char **argv)
28 wl_loginfo("Set card into monitor mode"); 41 wl_loginfo("Set card into monitor mode");
29 42
30 /////// following line will be moved to lib as soon as possible //////////// 43 /////// following line will be moved to lib as soon as possible ////////////
31 if((handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 0, NULL)) == NULL) 44 if((handletopcap = pcap_open_live(sniffer_device, BUFSIZ, 1, 0, NULL)) == NULL)
32 { 45 {
33 wl_logerr("pcap_open_live() failed: %s", strerror(errno)); 46 wl_logerr("pcap_open_live() failed: %s", strerror(errno));
34 exit(-1); 47 exit(-1);
@@ -42,11 +55,11 @@ int main(int argc, char **argv)
42 retval = pcap_datalink(handletopcap); 55 retval = pcap_datalink(handletopcap);
43 if (retval != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */ 56 if (retval != DLT_IEEE802_11) /* Rawmode is IEEE802_11 */
44 { 57 {
45 wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", SNIFFER_DEVICE); 58 wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", sniffer_device);
46 pcap_close(handletopcap); 59 pcap_close(handletopcap);
47 return 0; 60 return 0;
48 } 61 }
49 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE); 62 wl_loginfo("Your successfully listen on %s in 802.11 raw mode", sniffer_device);
50 //////////////////////////////////////// 63 ////////////////////////////////////////
51 64
52 /* Setup socket for incoming commands */ 65 /* Setup socket for incoming commands */
@@ -117,3 +130,13 @@ int main(int argc, char **argv)
117 close(sock); 130 close(sock);
118 exit(0); 131 exit(0);
119} 132}
133
134void usage(void)
135{
136 fprintf(stderr, "Usage: wellenreiter <device> <cardtype>\n" \
137 "\t<device> = Wirelessdevice (e.g. wlan0)\n" \
138 "\t<cardtype> = Cardtype:\t Cisco\t= 1\n" \
139 "\t\t\t\tNG\t= 2\n" \
140 "\t\t\t\tHOSTAP\t= 3\n");
141 exit(-1);
142}
diff --git a/noncore/net/wellenreiter/daemon/source/daemon.hh b/noncore/net/wellenreiter/daemon/source/daemon.hh
index 09acf11..8d03b97 100644
--- a/noncore/net/wellenreiter/daemon/source/daemon.hh
+++ b/noncore/net/wellenreiter/daemon/source/daemon.hh
@@ -19,4 +19,6 @@
19#include "../../libwellenreiter/source/cardmode.hh" 19#include "../../libwellenreiter/source/cardmode.hh"
20#include "../../libwellenreiter/source/sniff.hh" 20#include "../../libwellenreiter/source/sniff.hh"
21 21
22void usage(void);
23
22#endif /* DAEMON_HH */ 24#endif /* DAEMON_HH */