summaryrefslogtreecommitdiff
path: root/noncore
authormjm <mjm>2002-12-16 17:59:21 (UTC)
committer mjm <mjm>2002-12-16 17:59:21 (UTC)
commit1a981d3a1d8ef7860d673bce009b7253d7e279d7 (patch) (side-by-side diff)
tree0a9e31d9cee51110dfe67b8c0ef1f2c8d0a27241 /noncore
parente6255e52c1ec8988f3a1490827b92874459d6ede (diff)
downloadopie-1a981d3a1d8ef7860d673bce009b7253d7e279d7.zip
opie-1a981d3a1d8ef7860d673bce009b7253d7e279d7.tar.gz
opie-1a981d3a1d8ef7860d673bce009b7253d7e279d7.tar.bz2
foobar
Diffstat (limited to 'noncore') (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 @@
-
/* Temporary cardmode stuff, will hopefully removed soon */
@@ -27,3 +26,2 @@
#define CARD_TYPE_HOSTAP 3
-#define SNIFFER_DEVICE "wlan0"
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)
{
- int sock, maxfd, retval;
- char buffer[128];
+ int sock, maxfd, retval, card_type;
+ char buffer[128], sniffer_device[5];
struct pcap_pkthdr header;
@@ -21,4 +21,17 @@ int main(int argc, char **argv)
fprintf(stderr, "wellenreiterd %s\n\n", VERSION);
+ fprintf(stderr, "(c) 2002 by M-M-M\n\n");
- if(!card_into_monitormode(&handletopcap, SNIFFER_DEVICE, CARD_TYPE))
+ if(argc < 3)
+ usage();
+
+ /* Set sniffer device */
+ memset(sniffer_device, 0, sizeof(sniffer_device));
+ strncpy(sniffer_device, (char *)argv[1], sizeof(sniffer_device) - 1);
+
+ /* Set card type */
+ card_type = atoi(argv[2]);
+ if(card_type < 1 || card_type > 3)
+ usage();
+
+ if(!card_into_monitormode(&handletopcap, sniffer_device, card_type))
{
@@ -30,3 +43,3 @@ int main(int argc, char **argv)
/////// following line will be moved to lib as soon as possible ////////////
- if((handletopcap = pcap_open_live(SNIFFER_DEVICE, BUFSIZ, 1, 0, NULL)) == NULL)
+ if((handletopcap = pcap_open_live(sniffer_device, BUFSIZ, 1, 0, NULL)) == NULL)
{
@@ -44,3 +57,3 @@ int main(int argc, char **argv)
{
- wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", SNIFFER_DEVICE);
+ wl_loginfo("Interface %s does not work in the correct 802.11 raw mode", sniffer_device);
pcap_close(handletopcap);
@@ -48,3 +61,3 @@ int main(int argc, char **argv)
}
- wl_loginfo("Your successfully listen on %s in 802.11 raw mode", SNIFFER_DEVICE);
+ wl_loginfo("Your successfully listen on %s in 802.11 raw mode", sniffer_device);
////////////////////////////////////////
@@ -119 +132,11 @@ int main(int argc, char **argv)
}
+
+void usage(void)
+{
+ fprintf(stderr, "Usage: wellenreiter <device> <cardtype>\n" \
+ "\t<device> = Wirelessdevice (e.g. wlan0)\n" \
+ "\t<cardtype> = Cardtype:\t Cisco\t= 1\n" \
+ "\t\t\t\tNG\t= 2\n" \
+ "\t\t\t\tHOSTAP\t= 3\n");
+ exit(-1);
+}
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 @@
+void usage(void);
+
#endif /* DAEMON_HH */