Package killerbee :: Module dot154decode :: Class Dot154PacketParser
[hide private]
[frames] | no frames]

Class Dot154PacketParser

source code

Instance Methods [hide private]
 
__init__(self)
Instantiates the Dot154PacketParser class.
source code
 
__crypt_counter(self)
Used for AES-CTR mode after populating self.__crypt_A_i Don't call this directly.
source code
String
decrypt(self, packet, key)
Decrypts the specified packet.
source code
list
pktchop(self, packet)
Chops up the specified packet contents into a list of fields.
source code
Int
hdrlen(self, packet)
Returns the length of the 802.15.4 header.
source code
Int
payloadlen(self, packet)
Returns the length of the 802.15.4 payload.
source code
String
nonce(self, packet)
Returns the nonce of the 802.15.4 packet.
source code
Method Details [hide private]

__crypt_counter(self)

source code 

Used for AES-CTR mode after populating self.__crypt_A_i Don't call this directly. Just don't.

decrypt(self, packet, key)

source code 

Decrypts the specified packet. Returns empty string if the packet is not encrypted, or if decryption MIC validation fails.

Parameters:
  • packet (String) - Packet contents.
  • key (String) - Key contents.
Returns: String
Decrypted packet contents, empty string if not encrypted or if decryped MIC fails validation.

pktchop(self, packet)

source code 

Chops up the specified packet contents into a list of fields. Does not attempt to re-order the field values for parsing. ''.join(X) will reassemble original packet string. Fields which may or may not be present (such as the Source PAN field) are empty if they are not present, keeping the list elements consistent, as follows: FCF | Seq# | DPAN | DA | SPAN | SA | [Beacon Data] | PHY Payload

If the packet is a beacon frame, the Beacon Data field will be populated as a list element in the format:

Superframe Spec | GTS Fields | Pending Addr Counts | Proto ID | Stack Profile/Profile Version | Device Capabilities | Ext PAN ID | TX Offset | Update ID

An exception is raised if the packet contents are too short to decode.

Parameters:
  • packet (String) - Packet contents.
Returns: list
Chopped contents of the 802.15.4 packet into list elements.

hdrlen(self, packet)

source code 

Returns the length of the 802.15.4 header.

Parameters:
  • packet (String) - Packet contents to evaluate for header length.
Returns: Int
Length of the 802.15.4 header.

payloadlen(self, packet)

source code 

Returns the length of the 802.15.4 payload.

Parameters:
  • packet (String) - Packet contents to evaluate for header length.
Returns: Int
Length of the 802.15.4 payload.

nonce(self, packet)

source code 

Returns the nonce of the 802.15.4 packet. Returns empty string for unencrypted frames.

Parameters:
  • packet (String) - Packet contents to evaluate for nonce.
Returns: String
Nonce, empty when the frame is not encrypted.