puts("\t\t-m <mode> \tieee80211 or prism");
puts("\t\t-d <device> \twlan0,eth0");
puts("\t\t-l <logfile>");
- puts("\t\t-k <key> \t(string)");
- puts("\t\t-D <file> \t(dump packages to file)");
+ //puts("\t\t-k <key> \t(string)");
+ puts("\t\t-D <file> \t(dump packages to file (pcap format))");
puts("\t\t-h \tdisplay this help message");
puts("");
++i;
break;
case 'D':
- if((info.dump_fd=open(argv[i+1],O_RDWR|O_CREAT))!=0)
- printf("dump file -> %s\n",argv[i+1]);
- else
- puts("warning: can't dump to file.");
+ printf("dump file -> %s\n",argv[i+1]);
+ strncpy(info.dump_file,argv[i+1],128);
++i;
break;
case 'd':
pcap_fd=pcap_fileno(info.pcap_handle);
/* -> non blocking? */
+ /* pcap dump */
+ if(strcmp(info.dump_file,"")) {
+ if((info.dump_handle=pcap_dump_open(info.pcap_handle,info.dump_file))==NULL) {
+ puts("pcap open dump file failed");
+ return -23;
+ }
+ }
+
/* socket fd for channel hopping */
info.channel_hop_fd=socket(AF_INET,SOCK_DGRAM,0);
list_shutdown(&(info.sniffed_sta));
input_shutdown(&(info.input));
display_shutdown(&(info.display));
+
+ if(info.dump_handle!=NULL) pcap_dump_close(info.dump_handle);
puts("");
puts("");