small fixes in documentation + initial checkin of wep - crack tool
[my-code/hdw-sniff.git] / main.h
1 /*
2  * main.h - main header file
3  *
4  * author: hackbard@hackdaworld.dyndns.org
5  *
6  */
7
8 #ifndef MAIN_H
9 #define MAIN_H
10
11 #define _GNU_SOURCE
12 #include <stdio.h>
13 #include <string.h>
14 #include <stdlib.h>
15 #include <sys/socket.h>
16 #include <time.h>
17 #include <netinet/in.h>
18 #include <arpa/inet.h>
19 #include <pcap.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24 #include <sys/ioctl.h>
25 #include <sys/time.h>
26
27 #include <linux/wireless.h>
28
29 #include "parse.h"
30
31 #include "event.h"
32 #include "display.h"
33 #include "input.h"
34 #include "list.h"
35
36 #define SYSCALL_MAX 32
37 #define MESSAGE_MAX 64
38 #define CHANNEL_MAX 13
39 #define MAX_DEV_CHARS 6
40 #define MAX_SYSCALL_CHARS 128
41
42 #define HOP_SEC 0
43 #define HOP_USEC 200000
44
45 #define GUI_OFFSET_STA 1
46 #define GUI_OFFSET_SSID 19
47 #define GUI_OFFSET_AP 39
48 #define GUI_OFFSET_WEP 44
49 #define GUI_OFFSET_MGMT 50
50 #define GUI_OFFSET_CTRL 57
51 #define GUI_OFFSET_DATA 64
52 #define GUI_OFFSET_ACTIVE 71
53 #define GUI_OFFSET_SIGNAL 77
54
55 #define HDW_SNIFF_MAX_WIDTH (GUI_OFFSET_SIGNAL+5)
56 #define HDW_SNIFF_MAX_HEIGHT 8
57
58 /* modes */
59 #define MODE_IEEE80211 (1<<0)
60 #define MODE_PRISM (1<<1)
61 #define MODE_QUIT (1<<2)
62 #define MODE_HEXOUT (1<<3)
63 #define MODE_ASCIIOUT (1<<4)
64
65 #define MAX_BYTE_WEP 13 /* maximal 104 bit key */
66
67 #define VIEW_ALL 0x00
68 #define VIEW_SINGLE 0x01
69
70 /* type definitions */
71 typedef struct s_info {
72   t_event event;
73   t_display display;
74   char *clean_line;
75   int c_line,c_page;
76   unsigned char view;
77   t_input input;
78   int count; /* count packages */
79   int count_m;
80   int count_c;
81   int count_d;
82   unsigned char mode; /* ieee802.11/prism mode */
83   char device[MAX_DEV_CHARS]; /* sniffed devie */
84   int log_fd; /* file descriptor for logfile */
85   char dump_file[128];
86   pcap_dumper_t *dump_handle;
87   int current_channel;
88   int channel_hop_fd;
89   pcap_t *pcap_handle;
90   t_list sniffed_sta;
91   int view_table;
92 } t_info;
93
94 /* function prototypes */
95 void parse_package(unsigned char *ptr,const struct pcap_pkthdr *pcap_header,const unsigned char *package);
96 int display_console(t_info *info,char *string);
97
98 #endif