From: hackbard Date: Sat, 26 Jun 2004 07:26:21 +0000 (+0000) Subject: new Makefile, removed list management (-> use general ones), adapted .cvsignore file X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79a24c19a7b1e29e527d00c19f97b80a5dcf0647;p=my-code%2Fhdw-sniff.git new Makefile, removed list management (-> use general ones), adapted .cvsignore file --- diff --git a/.cvsignore b/.cvsignore index ac48741..020fd6d 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,6 @@ *.pdf hdw-sniff +old/hdw-sniff +*.log +old/*.log *.o diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0503908 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +# Makefile of hdw-sniff + +INCLUDEDIR = /usr/include + +CFLAGS = -DDEBUG -O3 -Wall +LIBS = -lpcap + +API_OBJS = network.o event.o input.o display.o audio.o + +api: links $(API_OBJS) + +hdw-sniff: $(API_OBJS) + $(CC) $(CFLAGS) -o $@ $(API_OBJS) hdw-sniff.c $(LIBS) +all: hdw-sniff + +clean: + rm -f $(API_OBJS) {event,input,display,audio,network,list}.{c,h} + rm -f hdw-sniff + +links: + ln -sf ../api/event/event.{c,h} . + ln -sf ../api/input/input.{c,h} . + ln -sf ../api/display/display.{c,h} . + ln -sf ../api/audio/audio.{c,h} . + ln -sf ../api/network/network.{c,h} . + ln -sf ../api/list/list.{c,h} . + +remake: clean all diff --git a/list.c b/list.c deleted file mode 100644 index 0ab3ff0..0000000 --- a/list.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * list.c - list interface - * - * author: hackbard@hackdaworld.dyndns.org - * - */ - -#include "list.h" - - diff --git a/list.h b/list.h deleted file mode 100644 index e036835..0000000 --- a/list.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * list.h - list header file - * - * author: hackbard@hackdaworld.dyndns.org - * - */ - -#define MAX_BSSID_CHARS 6 -#define MAX_SSID_CHARS 32 - -struct bssid -{ - char bssid[MAX_BSSID_CHARS]; /* the bssid mac address */ - struct bss *next; /* next bssid */ -} - -struct bsslist -{ - char ssid[MAX_SSID_CHARS]; /* network name of this bss */ - char struct *bssid; /* pointer to bssid mac addresses of this bss */ - struct bsslist *next; /* next sniffed bss */ -} diff --git a/main.c b/main.c index 9e8258f..32b035b 100644 --- a/main.c +++ b/main.c @@ -1,62 +1,47 @@ /* * main.c - main hdw-sniff * - * author: hackbard@hackdaworld.dyndns.org + * Copyright (C) 2004 hackbard@hackdaworld.dyndns.org * */ -#include #include "main.h" /* functions */ -int usage(void) -{ - puts("usage: hdw-sniff "); - puts("\toptions:\t-m \t1 monitoring, 2 managed"); - puts("\t\t-d \twlan0,eth0"); - puts("\t\t-l "); - puts("\t\t-h \tdisplay this help message"); - return -23; -} -int hop_channel(info_struct *info) -{ - struct iwreq iwreq; - if(info->current_channel>=CHANNEL_MAX) info->current_channel=1; - memset(&iwreq,0,sizeof(iwreq)); - strcpy(iwreq.ifr_name,info->device); - iwreq.u.freq.e=0; - iwreq.u.freq.m=info->current_channel; - if(ioctl(info->channel_hop_fd,SIOCSIWFREQ,&iwreq)<0) - { - puts("unable to hop channel"); - perror("ioctl"); - return -23; - } - ++(info->current_channel); - return 23; +int usage(void) { + puts("usage: hdw-sniff "); + puts("\toptions:\t-m \t1 monitoring, 2 managed"); + puts("\t\t-d \twlan0,eth0"); + puts("\t\t-l "); + puts("\t\t-k \t(string)"); + puts("\t\t-h \tdisplay this help message"); + puts(""); } -int main(int argc, char **argv) -{ - /* local variables */ - char pcap_error[PCAP_ERRBUF_SIZE]; - char sys_call[SYSCALL_MAX]; +int hop_channel(t_info *info) { - int pcap_fd,channel_hop_fd;; - int i; + struct iwreq iwreq; - fd_set pcap_fd_set; - struct timeval pcap_fd_set_tv; + if(info->current_channel>=CHANNEL_MAX) info->current_channel=1; + memset(&iwreq,0,sizeof(iwreq)); + strcpy(iwreq.ifr_name,info->device); + iwreq.u.freq.e=0; + iwreq.u.freq.m=info->current_channel; + if(ioctl(info->channel_hop_fd,SIOCSIWFREQ,&iwreq)<0) { + puts("unable to hop channel"); + perror("ioctl"); + return -23; + } + ++(info->current_channel); + return 23; +} - struct info_struct info; +int main(int argc, char **argv) { + t_info info; - memset(&info,0,sizeof(struct info_struct)); - /* default values */ - info.caps=0; - info.logfile_fd=0; - info.quit=0; + memset(&info,0,sizeof(t_info)); /* parse arguments */ for(i=1;i - +#include +#include #define SYSCALL_MAX 32 #define MAX_DEV_CHARS 6 -#define PCAP_SELECT_SEC 0 -#define PCAP_SELECT_USEC 200000 - -#define CAP_MODE_MASK 0x01 -#define CAP_QUIT_MASK 0x02 +#define SELECT_SEC 0 +#define SELECT_USEC 200000 +/* modes */ #define MONITORING_MODE 0x01 #define MANAGED_MODE 0x00 #define QUIT_MODE 0x02 -#define IWPRIV_M_MODE 3 - - -/* typedefinitions */ -struct info_struct -{ - unsigned char caps; /* capabilities */ - int logfile_fd; /* file descriptof for logfile */ - char device[MAX_DEV_CHARS]; /* sniffed devie */ - int channel_hop_fd; /* fd for channel hopping */ -}; +#define MAX_BYTE_WEP 13 /* maximal 104 bit key */ + +/* type definitions */ +typedef struct s_info { + unsigned char mode; /* monitoring/managed mode */ + char device[MAX_DEV_CHARS]; /* sniffed devie */ + int logfile_fd; /* file descriptof for logfile */ + int pcap_fd; /* fd for reading pcap events */ + char key[13]; /* wep key */ + +} t_info; /* function prototypes */ diff --git a/old/Makefile b/old/Makefile index 7169c03..b60527c 100644 --- a/old/Makefile +++ b/old/Makefile @@ -1,7 +1,7 @@ #!/usr/bin/make CC = gcc -CFLAGS = -O3 +CFLAGS = -O3 -DDEBUG_CHAR LDFLAGS = -lpcap TARGETS = hdw-sniff