/*
* main.c - main hdw-sniff
*
- * author: hackbard@hackdaworld.dyndns.org
+ * Copyright (C) 2004 hackbard@hackdaworld.dyndns.org
*
*/
-#include <stdio.h>
#include "main.h"
/* functions */
-int usage(void)
-{
- puts("usage: hdw-sniff <options>");
- puts("\toptions:\t-m <mode> \t1 monitoring, 2 managed");
- puts("\t\t-d <device> \twlan0,eth0");
- puts("\t\t-l <logfile>");
- 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 <options>");
+ puts("\toptions:\t-m <mode> \t1 monitoring, 2 managed");
+ puts("\t\t-d <device> \twlan0,eth0");
+ puts("\t\t-l <logfile>");
+ puts("\t\t-k <key> \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<argc;i++)