Adding log file and generic wifilogger refactoring
[wifihood] / wifisniffer / ieee80211.py
1
2 # Removed leading IEEE80211_RADIOTAP_
3 ratiotap_header_bits = (
4 ( "TSFT" , 0 , "q" , False ) ,
5 ( "FLAGS" , 1 , "B" , True ) ,
6 ( "RATE" , 2 , "B" , True ) ,
7 ( "CHANNEL" , 3 , "hh" , False ) ,
8 ( "FHSS" , 4 , "h" , False ) ,
9 ( "DBM_ANTSIGNAL" , 5 , "b" , True ) ,
10 ( "DBM_ANTNOISE" , 6 , "b" , True ) ,
11 ( "LOCK_QUALITY" , 7 , "h" , False ) ,
12 ( "TX_ATTENUATION" , 8 , "h" , False ) ,
13 ( "DB_TX_ATTENUATION" , 9 , "h" , False ) ,
14 ( "DBM_TX_POWER" , 10 , "b" , True ) ,
15 ( "ANTENNA" , 11 , "B" , True ) ,
16 ( "DB_ANTSIGNAL" , 12 , "B" , True ) ,
17 ( "DB_ANTNOISE" , 13 , "B" , True ) ,
18 ( "RX_FLAGS" , 14 , "h" , False ) ,
19 ( "TX_FLAGS" , 15 , "h" , False ) ,
20 ( "RTS_RETRIES" , 16 , "B" , True ) ,
21 ( "DATA_RETRIES" , 17 , "B" , True ) ,
22 ( "EXT" , 31 , "" , False )
23
24
25 # Removed leading IEEE80211_CHAN_
26 channel_flags = (
27 ( "INDOOR"  , 0x0004 ) , # This channel can be used indoor
28 ( "OUTDOOR" , 0x0008 ) , # This channel can be used outdoor
29 ( "TURBO"   , 0x0010 ) , # Turbo channel
30 ( "CCK"     , 0x0020 ) , # CCK channel
31 ( "OFDM"    , 0x0040 ) , # OFDM channel
32 ( "2GHZ"    , 0x0080 ) , # 2 GHz spectrum channel.
33 ( "5GHZ"    , 0x0100 ) , # 5 GHz spectrum channel
34 ( "PASSIVE" , 0x0200 ) , # Only passive scan allowed
35 ( "DYN"     , 0x0400 ) , # Dynamic CCK-OFDM channel
36 ( "GFSK"    , 0x0800 ) , # GFSK channel (FHSS PHY)
37 ( "RADAR"   , 0x1000 ) , # Radar found on channel
38 ( "STURBO"  , 0x2000 ) , # 11a static turbo channel only
39 ( "HALF"    , 0x4000 ) , # Half rate channel
40 ( "QUARTER" , 0x8000 ) , # Quarter rate channel
41 )
42 # IEEE80211_CHAN_A  = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM
43 # IEEE80211_CHAN_B  = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK
44 # IEEE80211_CHAN_G  = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN
45 # IEEE80211_CHAN_TA = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO
46 # IEEE80211_CHAN_TG = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN  | IEEE80211_CHAN_TURBO
47
48 # Removed leading IEEE80211_RADIOTAP_F_
49 radiotap_flags = (
50 ( "CFP"      , 0x01 ) , # sent/received during CFP
51 ( "SHORTPRE" , 0x02 ) , # sent/received with short preamble
52 ( "WEP"      , 0x04 ) , # sent/received with WEP encryption
53 ( "FRAG"     , 0x08 ) , # sent/received with fragmentation
54 ( "FCS"      , 0x10 ) , # frame includes FCS
55 ( "DATAPAD"  , 0x20 )   # frame has padding between 802.11 header and payload (to 32-bit boundary)
56 )
57
58 # Removed leading IEEE80211_RADIOTAP_F_RX_
59 radiotap_rx_flags = (
60 ( "BADFCS" , 0x0001 )   # frame failed crc check
61 )
62
63 # Removed leading IEEE80211_RADIOTAP_F_TX_
64 radiotap_tx_flags = (
65 ( "FAIL" , 0x0001 ) , # failed due to excessive retries
66 ( "CTS"  , 0x0002 ) , # used cts 'protection'
67 ( "RTS"  , 0x0004 )   # used rts/cts handshake
68 )
69
70
71 # without IEEE80211_FC0_TYPE_
72 frame_types = (
73 ( "MGT"               , 0x00 ) ,
74 ( "CTL"               , 0x04 ) ,
75 ( "DATA"              , 0x08 )  
76 )
77 # without IEEE80211_FC0_SUBTYPE_
78 management_subtypes = (
79 ( "ASSOC_REQ"    , 0x00 ) ,
80 ( "ASSOC_RESP"   , 0x10 ) ,
81 ( "REASSOC_REQ"  , 0x20 ) ,
82 ( "REASSOC_RESP" , 0x30 ) ,
83 ( "PROBE_REQ"    , 0x40 ) ,
84 ( "PROBE_RESP"   , 0x50 ) ,
85 ( "BEACON"       , 0x80 ) ,
86 ( "ATIM"         , 0x90 ) ,
87 ( "DISASSOC"     , 0xA0 ) ,
88 ( "AUTH"         , 0xB0 ) ,
89 ( "DEAUTH"       , 0xC0 ) ,
90 ( "ACTION"       , 0xD0 )  
91 )
92 # without IEEE80211_FC0_SUBTYPE_
93 control_subtypes = (
94 ( "PS_POLL"        , 0xa0 ) ,
95 ( "RTS"            , 0xb0 ) ,
96 ( "CTS"            , 0xc0 ) ,
97 ( "ACK"            , 0xd0 ) ,
98 ( "CF_END"         , 0xe0 ) ,
99 ( "CF_END_ACK"     , 0xf0 )  
100 )
101 # without IEEE80211_FC0_SUBTYPE_
102 data_subtypes = (
103 ( "DATA"           , 0x00 ) ,
104 ( "CF_ACK"         , 0x10 ) ,
105 ( "CF_POLL"        , 0x20 ) ,
106 ( "CF_ACPL"        , 0x30 ) ,
107 ( "NULL"           , 0x40 ) ,
108 ( "CFACK"          , 0x50 ) ,
109 ( "CFPOLL"         , 0x60 ) ,
110 ( "CF_ACK_CF_ACK"  , 0x70 ) ,
111 ( "QOS"            , 0x80 ) ,
112 ( "QOS_NULL"       , 0xc0 )  
113 )
114
115 # without IEEE80211_FC1_DIR_
116 directions = (
117 ( "NODS"               , 0x00 ) , # STA->STA
118 ( "TODS"               , 0x01 ) , # STA->AP
119 ( "FROMDS"             , 0x02 ) , # AP ->STA
120 ( "DSTODS"             , 0x03 )   # AP ->AP
121 )
122