--- /dev/null
+
+# Removed leading IEEE80211_RADIOTAP_
+ratiotap_header_bits = (
+( "TSFT" , 0 , "q" , False ) ,
+( "FLAGS" , 1 , "B" , True ) ,
+( "RATE" , 2 , "B" , True ) ,
+( "CHANNEL" , 3 , "hh" , False ) ,
+( "FHSS" , 4 , "h" , False ) ,
+( "DBM_ANTSIGNAL" , 5 , "b" , True ) ,
+( "DBM_ANTNOISE" , 6 , "b" , True ) ,
+( "LOCK_QUALITY" , 7 , "h" , False ) ,
+( "TX_ATTENUATION" , 8 , "h" , False ) ,
+( "DB_TX_ATTENUATION" , 9 , "h" , False ) ,
+( "DBM_TX_POWER" , 10 , "b" , True ) ,
+( "ANTENNA" , 11 , "B" , True ) ,
+( "DB_ANTSIGNAL" , 12 , "B" , True ) ,
+( "DB_ANTNOISE" , 13 , "B" , True ) ,
+( "RX_FLAGS" , 14 , "h" , False ) ,
+( "TX_FLAGS" , 15 , "h" , False ) ,
+( "RTS_RETRIES" , 16 , "B" , True ) ,
+( "DATA_RETRIES" , 17 , "B" , True ) ,
+( "EXT" , 31 , "" , False )
+)
+
+# Removed leading IEEE80211_CHAN_
+channel_flags = (
+( "INDOOR" , 0x0004 ) , # This channel can be used indoor
+( "OUTDOOR" , 0x0008 ) , # This channel can be used outdoor
+( "TURBO" , 0x0010 ) , # Turbo channel
+( "CCK" , 0x0020 ) , # CCK channel
+( "OFDM" , 0x0040 ) , # OFDM channel
+( "2GHZ" , 0x0080 ) , # 2 GHz spectrum channel.
+( "5GHZ" , 0x0100 ) , # 5 GHz spectrum channel
+( "PASSIVE" , 0x0200 ) , # Only passive scan allowed
+( "DYN" , 0x0400 ) , # Dynamic CCK-OFDM channel
+( "GFSK" , 0x0800 ) , # GFSK channel (FHSS PHY)
+( "RADAR" , 0x1000 ) , # Radar found on channel
+( "STURBO" , 0x2000 ) , # 11a static turbo channel only
+( "HALF" , 0x4000 ) , # Half rate channel
+( "QUARTER" , 0x8000 ) , # Quarter rate channel
+)
+# IEEE80211_CHAN_A = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM
+# IEEE80211_CHAN_B = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK
+# IEEE80211_CHAN_G = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN
+# IEEE80211_CHAN_TA = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO
+# IEEE80211_CHAN_TG = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN | IEEE80211_CHAN_TURBO
+
+# Removed leading IEEE80211_RADIOTAP_F_
+radiotap_flags = (
+( "CFP" , 0x01 ) , # sent/received during CFP
+( "SHORTPRE" , 0x02 ) , # sent/received with short preamble
+( "WEP" , 0x04 ) , # sent/received with WEP encryption
+( "FRAG" , 0x08 ) , # sent/received with fragmentation
+( "FCS" , 0x10 ) , # frame includes FCS
+( "DATAPAD" , 0x20 ) # frame has padding between 802.11 header and payload (to 32-bit boundary)
+)
+
+# Removed leading IEEE80211_RADIOTAP_F_RX_
+radiotap_rx_flags = (
+( "BADFCS" , 0x0001 ) # frame failed crc check
+)
+
+# Removed leading IEEE80211_RADIOTAP_F_TX_
+radiotap_tx_flags = (
+( "FAIL" , 0x0001 ) , # failed due to excessive retries
+( "CTS" , 0x0002 ) , # used cts 'protection'
+( "RTS" , 0x0004 ) # used rts/cts handshake
+)
+
+
+# without IEEE80211_FC0_TYPE_
+frame_type = (
+( "MGT" , 0x00 ) ,
+( "CTL" , 0x04 ) ,
+( "DATA" , 0x08 )
+)
+# without IEEE80211_FC0_SUBTYPE_
+management_subtypes = (
+( "ASSOC_REQ" , 0x00 ) ,
+( "ASSOC_RESP" , 0x10 ) ,
+( "REASSOC_REQ" , 0x20 ) ,
+( "REASSOC_RESP" , 0x30 ) ,
+( "PROBE_REQ" , 0x40 ) ,
+( "PROBE_RESP" , 0x50 ) ,
+( "BEACON" , 0x80 ) ,
+( "ATIM" , 0x90 ) ,
+( "DISASSOC" , 0xA0 ) ,
+( "AUTH" , 0xB0 ) ,
+( "DEAUTH" , 0xC0 ) ,
+( "ACTION" , 0xD0 )
+)
+# without IEEE80211_FC0_SUBTYPE_
+control_subtypes = (
+( "PS_POLL" , 0xa0 ) ,
+( "RTS" , 0xb0 ) ,
+( "CTS" , 0xc0 ) ,
+( "ACK" , 0xd0 ) ,
+( "CF_END" , 0xe0 ) ,
+( "CF_END_ACK" , 0xf0 )
+)
+# without IEEE80211_FC0_SUBTYPE_
+data_subtypes = (
+( "DATA" , 0x00 ) ,
+( "CF_ACK" , 0x10 ) ,
+( "CF_POLL" , 0x20 ) ,
+( "CF_ACPL" , 0x30 ) ,
+( "NULL" , 0x40 ) ,
+( "CFACK" , 0x50 ) ,
+( "CFPOLL" , 0x60 ) ,
+( "CF_ACK_CF_ACK" , 0x70 ) ,
+( "QOS" , 0x80 ) ,
+( "QOS_NULL" , 0xc0 )
+)
+
+# without IEEE80211_FC1_DIR_
+directions = (
+( "NODS" , 0x00 ) , # STA->STA
+( "TODS" , 0x01 ) , # STA->AP
+( "FROMDS" , 0x02 ) , # AP ->STA
+( "DSTODS" , 0x03 ) # AP ->AP
+)
+
read_timeout = 100 # in milliseconds
pc = pcapy.open_live(iface, max_bytes, promiscuous, read_timeout)
-# Removed leading IEEE80211_RADIOTAP_
-ratiotap_header_bits = (
-( "TSFT" , 0 , "q" , False ) ,
-( "FLAGS" , 1 , "B" , True ) ,
-( "RATE" , 2 , "B" , True ) ,
-( "CHANNEL" , 3 , "hh" , False ) ,
-( "FHSS" , 4 , "h" , False ) ,
-( "DBM_ANTSIGNAL" , 5 , "b" , True ) ,
-( "DBM_ANTNOISE" , 6 , "b" , True ) ,
-( "LOCK_QUALITY" , 7 , "h" , False ) ,
-( "TX_ATTENUATION" , 8 , "h" , False ) ,
-( "DB_TX_ATTENUATION" , 9 , "h" , False ) ,
-( "DBM_TX_POWER" , 10 , "b" , True ) ,
-( "ANTENNA" , 11 , "B" , True ) ,
-( "DB_ANTSIGNAL" , 12 , "B" , True ) ,
-( "DB_ANTNOISE" , 13 , "B" , True ) ,
-( "RX_FLAGS" , 14 , "h" , False ) ,
-( "TX_FLAGS" , 15 , "h" , False ) ,
-( "RTS_RETRIES" , 16 , "B" , True ) ,
-( "DATA_RETRIES" , 17 , "B" , True ) ,
-( "EXT" , 31 , "" , False )
-)
-
-# Removed leading IEEE80211_CHAN_
-channel_flags = (
-( "INDOOR" , 0x0004 ) , # This channel can be used indoor
-( "OUTDOOR" , 0x0008 ) , # This channel can be used outdoor
-( "TURBO" , 0x0010 ) , # Turbo channel
-( "CCK" , 0x0020 ) , # CCK channel
-( "OFDM" , 0x0040 ) , # OFDM channel
-( "2GHZ" , 0x0080 ) , # 2 GHz spectrum channel.
-( "5GHZ" , 0x0100 ) , # 5 GHz spectrum channel
-( "PASSIVE" , 0x0200 ) , # Only passive scan allowed
-( "DYN" , 0x0400 ) , # Dynamic CCK-OFDM channel
-( "GFSK" , 0x0800 ) , # GFSK channel (FHSS PHY)
-( "RADAR" , 0x1000 ) , # Radar found on channel
-( "STURBO" , 0x2000 ) , # 11a static turbo channel only
-( "HALF" , 0x4000 ) , # Half rate channel
-( "QUARTER" , 0x8000 ) , # Quarter rate channel
-)
-# IEEE80211_CHAN_A = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM
-# IEEE80211_CHAN_B = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK
-# IEEE80211_CHAN_G = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN
-# IEEE80211_CHAN_TA = IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO
-# IEEE80211_CHAN_TG = IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN | IEEE80211_CHAN_TURBO
-
-# Removed leading IEEE80211_RADIOTAP_F_
-radiotap_flags = (
-( "CFP" , 0x01 ) , # sent/received during CFP
-( "SHORTPRE" , 0x02 ) , # sent/received with short preamble
-( "WEP" , 0x04 ) , # sent/received with WEP encryption
-( "FRAG" , 0x08 ) , # sent/received with fragmentation
-( "FCS" , 0x10 ) , # frame includes FCS
-( "DATAPAD" , 0x20 ) # frame has padding between 802.11 header and payload (to 32-bit boundary)
-)
-
-# Removed leading IEEE80211_RADIOTAP_F_RX_
-radiotap_rx_flags = (
-( "BADFCS" , 0x0001 ) # frame failed crc check
-)
-
-# Removed leading IEEE80211_RADIOTAP_F_TX_
-radiotap_tx_flags = (
-( "FAIL" , 0x0001 ) , # failed due to excessive retries
-( "CTS" , 0x0002 ) , # used cts 'protection'
-( "RTS" , 0x0004 ) # used rts/cts handshake
-)
-
-
-# without IEEE80211_FC0_TYPE_
-frame_type = (
-( "MGT" , 0x00 ) ,
-( "CTL" , 0x04 ) ,
-( "DATA" , 0x08 )
-)
-# without IEEE80211_FC0_SUBTYPE_
-management_subtypes = (
-( "ASSOC_REQ" , 0x00 ) ,
-( "ASSOC_RESP" , 0x10 ) ,
-( "REASSOC_REQ" , 0x20 ) ,
-( "REASSOC_RESP" , 0x30 ) ,
-( "PROBE_REQ" , 0x40 ) ,
-( "PROBE_RESP" , 0x50 ) ,
-( "BEACON" , 0x80 ) ,
-( "ATIM" , 0x90 ) ,
-( "DISASSOC" , 0xA0 ) ,
-( "AUTH" , 0xB0 ) ,
-( "DEAUTH" , 0xC0 ) ,
-( "ACTION" , 0xD0 )
-)
-# without IEEE80211_FC0_SUBTYPE_
-control_subtypes = (
-( "PS_POLL" , 0xa0 ) ,
-( "RTS" , 0xb0 ) ,
-( "CTS" , 0xc0 ) ,
-( "ACK" , 0xd0 ) ,
-( "CF_END" , 0xe0 ) ,
-( "CF_END_ACK" , 0xf0 )
-)
-# without IEEE80211_FC0_SUBTYPE_
-data_subtypes = (
-( "DATA" , 0x00 ) ,
-( "CF_ACK" , 0x10 ) ,
-( "CF_POLL" , 0x20 ) ,
-( "CF_ACPL" , 0x30 ) ,
-( "NULL" , 0x40 ) ,
-( "CFACK" , 0x50 ) ,
-( "CFPOLL" , 0x60 ) ,
-( "CF_ACK_CF_ACK" , 0x70 ) ,
-( "QOS" , 0x80 ) ,
-( "QOS_NULL" , 0xc0 )
-)
-
-# without IEEE80211_FC1_DIR_
-directions = (
-( "NODS" , 0x00 ) , # STA->STA
-( "TODS" , 0x01 ) , # STA->AP
-( "FROMDS" , 0x02 ) , # AP ->STA
-( "DSTODS" , 0x03 ) # AP ->AP
-)
+import ieee80211
import time