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
@@ -22,3 +22,2 @@
22 22
23
24/* Temporary cardmode stuff, will hopefully removed soon */ 23/* Temporary cardmode stuff, will hopefully removed soon */
@@ -27,3 +26,2 @@
27#define CARD_TYPE_HOSTAP 3 26#define CARD_TYPE_HOSTAP 3
28#define SNIFFER_DEVICE "wlan0"
29 27
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
@@ -12,4 +12,4 @@ int 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;
@@ -21,4 +21,17 @@ int main(int argc, char **argv)
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 {
@@ -30,3 +43,3 @@ int main(int argc, char **argv)
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 {
@@ -44,3 +57,3 @@ int main(int argc, char **argv)
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);
@@ -48,3 +61,3 @@ int main(int argc, char **argv)
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 ////////////////////////////////////////
@@ -119 +132,11 @@ int main(int argc, char **argv)
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
@@ -21,2 +21,4 @@
21 21
22void usage(void);
23
22#endif /* DAEMON_HH */ 24#endif /* DAEMON_HH */