1 /* 2 * Walsh - Main and usage functions 3 * Copyright (c) 2011, Tactical Network Solutions, Craig Heffner <cheffner@tacnetsol.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * 20 * In addition, as a special exception, the copyright holders give 21 * permission to link the code of portions of this program with the 22 * OpenSSL library under certain conditions as described in each 23 * individual source file, and distribute linked combinations 24 * including the two. 25 * You must obey the GNU General Public License in all respects 26 * for all of the code used other than OpenSSL. * If you modify 27 * file(s) with this exception, you may extend this exception to your 28 * version of the file(s), but you are not obligated to do so. * If you 29 * do not wish to do so, delete this exception statement from your 30 * version. * If you delete this exception statement from all source 31 * files in the program, then also delete it here. 32 */ 33 34 #ifndef WPSMON_H 35 #define WPSMON_H 36 37 #include <getopt.h> 38 #include <signal.h> 39 #include <sys/time.h> 40 #include <arpa/inet.h> 41 #include <libwps.h> 42 #include "defs.h" 43 #include "globule.h" 44 #include "misc.h" 45 #include "init.h" 46 #include "iface.h" 47 #include "80211.h" 48 #include "builder.h" 49 #include "session.h" 50 51 #define INTERFACE 0 52 #define PCAP_FILE 1 53 54 #define PROBE_RESPONSE 0x05 55 56 #define WPS_VENDOR_ID "\x00\x50\xF2\x04" 57 #define WPS_VENDOR_ID_SIZE 4 58 #define VENDOR_ID_OFFSET 2 59 #define LENGTH_OFFSET 1 60 61 #define SURVEY 0 62 #define SCAN 1 63 64 #define CHANNEL_INTERVAL 999999 65 66 #define YES "Yes" 67 #define NO "No " 68 69 enum tag_type 70 { 71 HEX = 0, 72 STRING = 1 73 }; 74 75 struct elements 76 { 77 int number; 78 enum tag_type type; 79 char *name; 80 }; 81 82 struct data_element 83 { 84 uint16_t type; 85 uint16_t len; 86 }; 87 88 struct global_variables 89 { 90 int csv; 91 FILE *fp; 92 int bssid_count; 93 unsigned char **bssids; 94 } wpsmon; 95 96 void monitor(char *bssid, int passive, int source, int channel, int mode); 97 void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *target, int passive, int mode, int source); 98 void send_probe_request(unsigned char *bssid, char *essid); 99 int is_dup(unsigned char *bssid); 100 void mark_bssid(unsigned char *bssid); 101 void free_bssid_list(unsigned char **list, int count); 102 void sigalrm_handler(int x); 103 104 #endif 105