desc
stringlengths 3
26.7k
| decl
stringlengths 11
7.89k
| bodies
stringlengths 8
553k
|
---|---|---|
'Set the 802.11 \'Data\' data frame \'QoS\' field'
| def set_QoS(self, value):
| nb = (value & 65535)
self.header.set_word(28, nb, '<')
|
'Get the Destination Service Access Point (SAP) from LLC frame'
| def get_DSAP(self):
| return self.header.get_byte(0)
|
'Set the Destination Service Access Point (SAP) of LLC frame'
| def set_DSAP(self, value):
| self.header.set_byte(0, value)
|
'Get the Source Service Access Point (SAP) from LLC frame'
| def get_SSAP(self):
| return self.header.get_byte(1)
|
'Set the Source Service Access Point (SAP) of LLC frame'
| def set_SSAP(self, value):
| self.header.set_byte(1, value)
|
'Get the Control field from LLC frame'
| def get_control(self):
| return self.header.get_byte(2)
|
'Set the Control field of LLC frame'
| def set_control(self, value):
| self.header.set_byte(2, value)
|
'Get the three-octet Organizationally Unique Identifier (OUI) SNAP frame'
| def get_OUI(self):
| b = self.header.get_bytes()[0:3].tostring()
(oui,) = struct.unpack('!L', ('\x00' + b))
return oui
|
'Set the three-octet Organizationally Unique Identifier (OUI) SNAP frame'
| def set_OUI(self, value):
| mask = ((~ 4294967040) & 255)
masked = (self.header.get_long(0, '>') & mask)
nb = (masked | ((value & 16777215) << 8))
self.header.set_long(0, nb)
|
'Get the two-octet Protocol Identifier (PID) SNAP field'
| def get_protoID(self):
| return self.header.get_word(3, '>')
|
'Set the two-octet Protocol Identifier (PID) SNAP field'
| def set_protoID(self, value):
| self.header.set_word(3, value, '>')
|
'Return True if it\'s a WEP'
| def is_WEP(self):
| b = self.header.get_byte(3)
return (not (b & 32))
|
'Return the \'WEP IV\' field'
| def get_iv(self):
| b = self.header.get_bytes()[0:3].tostring()
(iv,) = struct.unpack('!L', ('\x00' + b))
return iv
|
'Set the \'WEP IV\' field.'
| def set_iv(self, value):
| mask = ((~ 4294967040) & 255)
masked = (self.header.get_long(0, '>') & mask)
nb = (masked | ((value & 16777215) << 8))
self.header.set_long(0, nb)
|
'Return the \'WEP KEY ID\' field'
| def get_keyid(self):
| b = self.header.get_byte(3)
return ((b >> 6) & 3)
|
'Set the \'WEP KEY ID\' field'
| def set_keyid(self, value):
| mask = ((~ 192) & 255)
masked = (self.header.get_byte(3) & mask)
nb = (masked | ((value & 3) << 6))
self.header.set_byte(3, nb)
|
'Return \'WEP Data\' field decrypted'
| def get_decrypted_data(self, key_string):
| if (len(self.body_string) < 8):
return self.body_string
iv = struct.pack('>L', self.get_iv())[(-3):]
key = (iv + key_string)
rc4 = RC4(key)
decrypted_data = rc4.decrypt(self.body_string)
return decrypted_data
|
'Return \'WEP ICV\' field'
| def get_icv(self):
| b = self.tail.get_long((-4), '>')
return b
|
'Set \'WEP ICV\' field'
| def set_icv(self, value=None):
| if (value is None):
value = self.get_computed_icv()
nb = (value & 4294967295)
self.tail.set_long((-4), nb)
|
'Return True if it\'s a WPA'
| def is_WPA(self):
| b = (self.get_WEPSeed() == ((self.get_TSC1() | 32) & 127))
return (b and self.get_extIV())
|
'Return the \'WPA KEY ID\' field'
| def get_keyid(self):
| b = self.header.get_byte(3)
return ((b >> 6) & 3)
|
'Set the \'WPA KEY ID\' field'
| def set_keyid(self, value):
| mask = ((~ 192) & 255)
masked = (self.header.get_byte(3) & mask)
nb = (masked | ((value & 3) << 6))
self.header.set_byte(3, nb)
|
'Return \'WPA Data\' field decrypted'
| def get_decrypted_data(self):
| return self.body_string
|
'Return the \'WPA TSC1\' field'
| def get_TSC1(self):
| b = self.header.get_byte(0)
return (b & 255)
|
'Set the \'WPA TSC1\' field'
| def set_TSC1(self, value):
| nb = (value & 255)
self.header.set_byte(0, nb)
|
'Return the \'WPA WEPSeed\' field'
| def get_WEPSeed(self):
| b = self.header.get_byte(1)
return (b & 255)
|
'Set the \'WPA WEPSeed\' field'
| def set_WEPSeed(self, value):
| nb = (value & 255)
self.header.set_byte(1, nb)
|
'Return the \'WPA TSC0\' field'
| def get_TSC0(self):
| b = self.header.get_byte(2)
return (b & 255)
|
'Set the \'WPA TSC0\' field'
| def set_TSC0(self, value):
| nb = (value & 255)
self.header.set_byte(2, nb)
|
'Return the \'WPA extID\' field'
| def get_extIV(self):
| b = self.header.get_byte(3)
return ((b >> 5) & 1)
|
'Set the \'WPA extID\' field'
| def set_extIV(self, value):
| mask = ((~ 32) & 255)
masked = (self.header.get_byte(3) & mask)
nb = (masked | ((value & 1) << 5))
self.header.set_byte(3, nb)
|
'Return the \'WPA TSC2\' field'
| def get_TSC2(self):
| b = self.header.get_byte(4)
return (b & 255)
|
'Set the \'WPA TSC2\' field'
| def set_TSC2(self, value):
| nb = (value & 255)
self.header.set_byte(4, nb)
|
'Return the \'WPA TSC3\' field'
| def get_TSC3(self):
| b = self.header.get_byte(5)
return (b & 255)
|
'Set the \'WPA TSC3\' field'
| def set_TSC3(self, value):
| nb = (value & 255)
self.header.set_byte(5, nb)
|
'Return the \'WPA TSC4\' field'
| def get_TSC4(self):
| b = self.header.get_byte(6)
return (b & 255)
|
'Set the \'WPA TSC4\' field'
| def set_TSC4(self, value):
| nb = (value & 255)
self.header.set_byte(6, nb)
|
'Return the \'WPA TSC5\' field'
| def get_TSC5(self):
| b = self.header.get_byte(7)
return (b & 255)
|
'Set the \'WPA TSC5\' field'
| def set_TSC5(self, value):
| nb = (value & 255)
self.header.set_byte(7, nb)
|
'Return \'WPA ICV\' field'
| def get_icv(self):
| b = self.tail.get_long((-4), '>')
return b
|
'Set \'WPA ICV\' field'
| def set_icv(self, value=None):
| if (value is None):
value = self.compute_checksum(self.body_string)
nb = (value & 4294967295)
self.tail.set_long((-4), nb)
|
'Return the \'WPA2Data MIC\' field'
| def get_MIC(self):
| return self.get_tail_as_string()[:8]
|
'Set the \'WPA2Data MIC\' field'
| def set_MIC(self, value):
| value.ljust(8, '\x00')
value = value[:8]
icv = self.tail.get_buffer_as_string()[(-4):]
self.tail.set_bytes_from_string((value + icv))
|
'Return True if it\'s a WPA2'
| def is_WPA2(self):
| b = (self.get_PN1() == ((self.get_PN0() | 32) & 127))
return ((not b) and self.get_extIV())
|
'Return the \'WPA2 extID\' field'
| def get_extIV(self):
| b = self.header.get_byte(3)
return ((b >> 5) & 1)
|
'Set the \'WPA2 extID\' field'
| def set_extIV(self, value):
| mask = ((~ 32) & 255)
masked = (self.header.get_byte(3) & mask)
nb = (masked | ((value & 1) << 5))
self.header.set_byte(3, nb)
|
'Return the \'WPA2 KEY ID\' field'
| def get_keyid(self):
| b = self.header.get_byte(3)
return ((b >> 6) & 3)
|
'Set the \'WPA2 KEY ID\' field'
| def set_keyid(self, value):
| mask = ((~ 192) & 255)
masked = (self.header.get_byte(3) & mask)
nb = (masked | ((value & 3) << 6))
self.header.set_byte(3, nb)
|
'Return \'WPA2 Data\' field decrypted'
| def get_decrypted_data(self):
| return self.body_string
|
'Return the \'WPA2 PN0\' field'
| def get_PN0(self):
| b = self.header.get_byte(0)
return (b & 255)
|
'Set the \'WPA2 PN0\' field'
| def set_PN0(self, value):
| nb = (value & 255)
self.header.set_byte(0, nb)
|
'Return the \'WPA2 PN1\' field'
| def get_PN1(self):
| b = self.header.get_byte(1)
return (b & 255)
|
'Set the \'WPA2 PN1\' field'
| def set_PN1(self, value):
| nb = (value & 255)
self.header.set_byte(1, nb)
|
'Return the \'WPA2 PN2\' field'
| def get_PN2(self):
| b = self.header.get_byte(4)
return (b & 255)
|
'Set the \'WPA2 PN2\' field'
| def set_PN2(self, value):
| nb = (value & 255)
self.header.set_byte(4, nb)
|
'Return the \'WPA2 PN3\' field'
| def get_PN3(self):
| b = self.header.get_byte(5)
return (b & 255)
|
'Set the \'WPA2 PN3\' field'
| def set_PN3(self, value):
| nb = (value & 255)
self.header.set_byte(5, nb)
|
'Return the \'WPA2 PN4\' field'
| def get_PN4(self):
| b = self.header.get_byte(6)
return (b & 255)
|
'Set the \'WPA2 PN4\' field'
| def set_PN4(self, value):
| nb = (value & 255)
self.header.set_byte(6, nb)
|
'Return the \'WPA2 PN5\' field'
| def get_PN5(self):
| b = self.header.get_byte(7)
return (b & 255)
|
'Set the \'WPA2 PN5\' field'
| def set_PN5(self, value):
| nb = (value & 255)
self.header.set_byte(7, nb)
|
'Return the \'WPA2Data MIC\' field'
| def get_MIC(self):
| return self.get_tail_as_string()
|
'Set the \'WPA2Data MIC\' field'
| def set_MIC(self, value):
| value.ljust(8, '\x00')
value = value[:8]
self.tail.set_bytes_from_string(value)
|
'Return the RadioTap header \'length\' field'
| def get_header_length(self):
| self.__update_header_length()
return self.header.get_word(2, '<')
|
'Return the \'version\' field'
| def get_version(self):
| b = self.header.get_byte(0)
return b
|
'Set the \'version\' field'
| def set_version(self, value):
| nb = (value & 255)
self.header.set_byte(0, nb)
nb = (value & 255)
|
'Return RadioTap present bitmap field'
| def get_present(self, offset=_BASE_PRESENT_FLAGS_OFFSET):
| present = self.header.get_long(offset, '<')
return present
|
'Set RadioTap present field bit'
| def __set_present(self, value):
| self.header.set_long(4, value)
|
'Get a \'present\' field bit'
| def get_present_bit(self, field, offset=4):
| present = self.get_present(offset)
return (not (not ((2 ** field.BIT_NUMBER) & present)))
|
'Set a \'present\' field bit'
| def __set_present_bit(self, field):
| npresent = ((2 ** field.BIT_NUMBER) | self.get_present())
self.header.set_long(4, npresent, '<')
|
'Unset a \'present\' field bit'
| def __unset_present_bit(self, field):
| npresent = ((~ (2 ** field.BIT_NUMBER)) & self.get_present())
self.header.set_long(4, npresent, '<')
|
'Set the Value in microseconds of the MAC\'s 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC'
| def set_tsft(self, nvalue):
| self.__set_field_values(RadioTap.RTF_TSFT, [nvalue])
|
'Get the Value in microseconds of the MAC\'s 64-bit 802.11 Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC'
| def get_tsft(self):
| values = self.__get_field_values(RadioTap.RTF_TSFT)
if (not values):
return None
return values[0]
|
'Set the properties of transmitted and received frames.'
| def set_flags(self, nvalue):
| self.__set_field_values(self.RTF_FLAGS, [nvalue])
|
'Get the properties of transmitted and received frames.'
| def get_flags(self):
| values = self.__get_field_values(self.RTF_FLAGS)
if (not values):
return None
return values[0]
|
'Set the TX/RX data rate in 500 Kbps units'
| def set_rate(self, nvalue):
| self.__set_field_values(self.RTF_RATE, [nvalue])
|
'Get the TX/RX data rate in 500 Kbps units'
| def get_rate(self):
| values = self.__get_field_values(self.RTF_RATE)
if (not values):
return None
return values[0]
|
'Set the channel Tx/Rx frequency in MHz and the channel flags'
| def set_channel(self, freq, flags):
| self.__set_field_values(self.RTF_CHANNEL, [freq, flags])
|
'Get the TX/RX data rate in 500 Kbps units'
| def get_channel(self):
| values = self.__get_field_values(self.RTF_CHANNEL)
return values
|
'Set the hop set and pattern for frequency-hopping radios'
| def set_FHSS(self, hop_set, hop_pattern):
| self.__set_field_values(self.RTF_FHSS, [hop_set, hop_pattern])
|
'Get the hop set and pattern for frequency-hopping radios'
| def get_FHSS(self):
| values = self.__get_field_values(self.RTF_FHSS)
return values
|
'Set the RF signal power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def set_dBm_ant_signal(self, signal):
| self.__set_field_values(self.RTF_DBM_ANTSIGNAL, [signal])
|
'Get the RF signal power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def get_dBm_ant_signal(self):
| values = self.__get_field_values(self.RTF_DBM_ANTSIGNAL)
if (not values):
return None
return values[0]
|
'Set the RF noise power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def set_dBm_ant_noise(self, signal):
| self.__set_field_values(self.RTF_DBM_ANTNOISE, [signal])
|
'Get the RF noise power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def get_dBm_ant_noise(self):
| values = self.__get_field_values(self.RTF_DBM_ANTNOISE)
if (not values):
return None
return values[0]
|
'Set the quality of Barker code lock. Called \'Signal Quality\' in datasheets.'
| def set_lock_quality(self, quality):
| self.__set_field_values(self.RTF_LOCK_QUALITY, [quality])
|
'Get the quality of Barker code lock. Called \'Signal Quality\' in datasheets.'
| def get_lock_quality(self):
| values = self.__get_field_values(self.RTF_LOCK_QUALITY)
if (not values):
return None
return values[0]
|
'Set the transmit power expressed as unitless distance from max power set at factory calibration. 0 is max power.'
| def set_tx_attenuation(self, power):
| self.__set_field_values(self.RTF_TX_ATTENUATION, [power])
|
'Set the transmit power expressed as unitless distance from max power set at factory calibration. 0 is max power.'
| def get_tx_attenuation(self):
| values = self.__get_field_values(self.RTF_TX_ATTENUATION)
if (not values):
return None
return values[0]
|
'Set the transmit power expressed as decibel distance from max power set at factory calibration. 0 is max power.'
| def set_dB_tx_attenuation(self, power):
| self.__set_field_values(self.RTF_DB_TX_ATTENUATION, [power])
|
'Set the transmit power expressed as decibel distance from max power set at factory calibration. 0 is max power.'
| def get_dB_tx_attenuation(self):
| values = self.__get_field_values(self.RTF_DB_TX_ATTENUATION)
if (not values):
return None
return values[0]
|
'Set the transmit power expressed as dBm (decibels from a 1 milliwatt reference). This is the absolute power level measured at the antenna port.'
| def set_dBm_tx_power(self, power):
| self.__set_field_values(self.RTF_DBM_TX_POWER, [power])
|
'Get the transmit power expressed as dBm (decibels from a 1 milliwatt reference). This is the absolute power level measured at the antenna port.'
| def get_dBm_tx_power(self):
| values = self.__get_field_values(self.RTF_DBM_TX_POWER)
if (not values):
return None
return values[0]
|
'Set Rx/Tx antenna index for this packet. The first antenna is antenna 0.'
| def set_antenna(self, antenna_index):
| self.__set_field_values(self.RTF_ANTENNA, [antenna_index])
|
'Set Rx/Tx antenna index for this packet. The first antenna is antenna 0.'
| def get_antenna(self):
| values = self.__get_field_values(self.RTF_ANTENNA)
if (not values):
return None
return values[0]
|
'Set the RF signal power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def set_dB_ant_signal(self, signal):
| self.__set_field_values(self.RTF_DB_ANTSIGNAL, [signal])
|
'Get the RF signal power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def get_dB_ant_signal(self):
| values = self.__get_field_values(self.RTF_DB_ANTSIGNAL)
if (not values):
return None
return values[0]
|
'Set the RF noise power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def set_dB_ant_noise(self, signal):
| self.__set_field_values(self.RTF_DB_ANTNOISE, [signal])
|
'Get the RF noise power at the antenna, decibel difference from an arbitrary, fixed reference.'
| def get_dB_ant_noise(self):
| values = self.__get_field_values(self.RTF_DB_ANTNOISE)
if (not values):
return None
return values[0]
|
'Set the Field containing the FCS of the frame (instead of it being appended to the frame as it would appear on the air.)'
| def set_FCS_in_header(self, fcs):
| self.__set_field_values(self.RTF_FCS_IN_HEADER, [fcs])
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.