From: hackbard Date: Tue, 12 Nov 2002 00:53:33 +0000 (+0000) Subject: ?!? wtf :) X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=f0775823587944872372259c853aee47601c82e8;p=my-code%2Fhdw-sniff.git ?!? wtf :) --- diff --git a/hdw-sniff.c b/hdw-sniff.c index 8cbfb49..db285a2 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -97,7 +97,10 @@ int main(int argc, char *argv[]) { /* do loopp */ while(1) { if((select(pcap_fd+1,&pcap_fd_set,NULL,NULL,&fd_set_tv)) && (FD_ISSET(pcap_fd,&pcap_fd_set))) pcap_loop(pcap_handle,-1,pcap_process,(u_char *)&my_info_struct); - else hop_channel(&my_info_struct,pcap_fd); + else if((hop_channel(&my_info_struct,pcap_fd))==-1) { + printf("channelhopping failed, aborting\n"); + return -1; + } } return 0; } @@ -191,15 +194,24 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, int hop_channel(struct info_struct *info,int pcap_fd) { struct iwreq my_iwreq; + int foo_fd; + /* oder vielleicht doch pcap_fd ? */ + if((foo_fd=socket(AF_INET,SOCK_DGRAM,0))==-1) { + printf("unable to create socket\n"); + return -1; + } if (info->channel==15) info->channel=1; memset(&my_iwreq,0,sizeof(my_iwreq)); strcpy(my_iwreq.ifr_name,info->dev); + printf("debug: device = %s\n",my_iwreq.ifr_name); my_iwreq.u.freq.e=0; my_iwreq.u.freq.m=info->channel; - if((ioctl(pcap_fd,SIOCSIWFREQ,& my_iwreq))==-1) { + // if((ioctl(foo_fd,SIOCSIWFREQ,&my_iwreq))==-1) { + if((ioctl(pcap_fd,SIOCSIWFREQ,&my_iwreq))==-1) { printf("unable to hop channels\n"); + perror("ioctl"); return -1; } printf("debug: hopped to channel %d\n",info->channel);