chewie.message_parser module

class chewie.message_parser.EapMessage(src_mac, message_id)

Bases: object

message_id = None
src_mac = None
class chewie.message_parser.EapolLogoffMessage(src_mac)

Bases: EapMessage

classmethod build(src_mac)
class chewie.message_parser.EapolStartMessage(src_mac)

Bases: EapMessage

classmethod build(src_mac)
class chewie.message_parser.FailureMessage(src_mac, message_id)

Bases: EapMessage

classmethod build(src_mac, eap)
class chewie.message_parser.IdentityMessage(src_mac, message_id, code, identity)

Bases: EapMessage

classmethod build(src_mac, eap)
class chewie.message_parser.LegacyNakMessage(src_mac, message_id, code, desired_auth_types)

Bases: EapMessage

classmethod build(src_mac, eap)
class chewie.message_parser.Md5ChallengeMessage(src_mac, message_id, code, challenge, extra_data)

Bases: EapMessage

classmethod build(src_mac, eap)
class chewie.message_parser.MessagePacker

Bases: object

static eap_pack(message)

Pack an EAP message. Args:

message (Message):

Returns:

version (int), packet_type (int), packed eap (bytes)

static ethernet_pack(message, src_mac, dst_mac)

Packs a ethernet packet. Args:

message: EAP payload src_mac (MacAddress): dst_mac (MacAddress):

Returns:

packed ethernet packet (bytes)

static pack(message)

packs the EAPOL Args:

message (Message): EAP message

Returns:

Packed EAPOL packet (bytes)

static radius_mab_pack(src_mac, radius_packet_id, request_authenticator, secret, nas_port)
static radius_pack(eap_message, src_mac, username, radius_packet_id, request_authenticator, state, secret, nas_port=None, extra_attributes=None)

Packs up a RADIUS message to send to a RADIUS Server. Args:

eap_message (Message): e.g. IdentityMessage src_mac (MacAddress): supplicants mac address username (str): supplicants username radius_packet_id (int): request_authenticator (bytes): state (State): RADIUS State secret (str): RADIUS secret used between Chewie and RADIUS Server extra_attributes (list): list of extra RADIUS attributes to send along with the above.

Returns:

packed RADIUS packet (bytes)

class chewie.message_parser.MessageParser

Bases: object

static eap_parse(data, src_mac)

Parses the actual EAP payload Args:

data: src_mac (MacAddress): source mac address of the data packet

Raises:

MessageParseError: the data cannot be parsed.

static ethernet_parse(packed_message)

Parses the ethernet header part, and payload Args:

packed_message:

Returns:

***Message & destination mac address.

Raises:

MessageParseError: the packed_message cannot be parsed.

static one_x_parse(data, src_mac)

Parses the 1x header (version and packet type) part of the packet, and the payload. Args:

data: src_mac (MacAddress): source mac address of the data packet.

Raises:

MessageParseError: the data cannot be parsed.

static radius_parse(packed_message, secret, radius_lifecycle)

Parses a RADIUS packet Returns:

RadiusPacket

Raises:

MessageParseError: the packed_message cannot be parsed

class chewie.message_parser.PeapMessage(src_mac, message_id, code, flags, extra_data)

Bases: TlsMessageBase

class chewie.message_parser.SuccessMessage(src_mac, message_id)

Bases: EapMessage

classmethod build(src_mac, eap)
class chewie.message_parser.TlsMessage(src_mac, message_id, code, flags, extra_data)

Bases: TlsMessageBase

class chewie.message_parser.TlsMessageBase(src_mac, message_id, code, flags, extra_data)

Bases: EapMessage

TLS and TTLS will extend this class, but TTLS cannot be same type as TLS

classmethod build(src_mac, eap)
class chewie.message_parser.TtlsMessage(src_mac, message_id, code, flags, extra_data)

Bases: TlsMessageBase