X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fhdw-sniff.git;a=blobdiff_plain;f=main.c;h=32b035bd3eb8a54bde007272e037c0c97abda1d7;hp=9e8258fe74c48b69481f68c03d981a673660e205;hb=79a24c19a7b1e29e527d00c19f97b80a5dcf0647;hpb=cd581a3e864957fdb30ee1987734e8abd8debf8c 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