chewie.eap module

Module for parsing & packing EAP

class chewie.eap.Eap

Bases: object

Class for parsing & packing EAP messages

FAILURE = 4
IDENTITY = 1
LEGACY_NAK = 3
MD5_CHALLENGE = 4
PACKET_TYPE = None
PEAP = 25
REQUEST = 1
RESPONSE = 2
SUCCESS = 3
TLS = 13
TTLS = 21
code = None
pack(packed_body)

Pack an EAP Message

packet_id = None
static parse(packed_message)
Args:

packed_message:

Returns:

Eap*** object.

Raises:

MessageParseError if packed_message cannot be parsed.

class chewie.eap.EapFailure(packet_id)

Bases: Eap

EAP Failure Packet

pack(packed_body=b'')

Pack an EAP Message

classmethod parse(packet_id)
Args:

packed_message:

Returns:

Eap*** object.

Raises:

MessageParseError if packed_message cannot be parsed.

class chewie.eap.EapIdentity(code, packet_id, identity)

Bases: Eap

PACKET_TYPE = 1
pack(packed_body=b'')

Pack an EAP Message

classmethod parse(code, packet_id, packed_message)
Returns:

EapIdentity.

Raises:

MessageParseError if packed message cannot be decoded.

class chewie.eap.EapLegacyNak(code, packet_id, desired_auth_types)

Bases: Eap

EAP Legacy-NAK Packet

PACKET_TYPE = 3
pack(packed_body=b'')

Pack an EAP Message

classmethod parse(code, packet_id, packed_msg)
Returns:

EapLegacyNak.

Raises:

MessageParseError if cannot unpack packed_message

class chewie.eap.EapMd5Challenge(code, packet_id, challenge, extra_data)

Bases: Eap

EAP MD5-Challenge Packet

PACKET_TYPE = 4
pack(packed_body=b'')

Pack an EAP Message

classmethod parse(code, packet_id, packed_message)
Returns:

EapMd5Challenge.

Raises:

MessageParseError if cannot unpack packed_message

class chewie.eap.EapPEAP(code, packet_id, flags, extra_data)

Bases: EapTLSBase

PEAP Packet

PACKET_TYPE = 25
class chewie.eap.EapSuccess(packet_id)

Bases: Eap

EAP Success Packet

pack(packed_body=b'')

Pack an EAP Message

classmethod parse(packet_id)
Args:

packed_message:

Returns:

Eap*** object.

Raises:

MessageParseError if packed_message cannot be parsed.

class chewie.eap.EapTLS(code, packet_id, flags, extra_data)

Bases: EapTLSBase

EAP TLS Packet

PACKET_TYPE = 13
class chewie.eap.EapTLSBase(code, packet_id, flags, extra_data)

Bases: Eap

EAPTLS & EAPTTLS have the same packet format.

pack(packed_body=b'')

Pack an EAP Message

classmethod parse(code, packet_id, packed_msg)
Returns:

A child of EapTLSBase e.g. EapTLS, EAPTTLS.

Raises:

MessageParseError if cannot unpack packed_message

class chewie.eap.EapTTLS(code, packet_id, flags, extra_data)

Bases: EapTLSBase

EAP TTLS Packet

PACKET_TYPE = 21
chewie.eap.register_parser(cls)

Register a packet type to the parser