scapy.layers.eap module

Extensible Authentication Protocol (EAP)

class scapy.layers.eap.EAP

Bases: scapy.packet.Packet

RFC 3748 - Extensible Authentication Protocol (EAP)

FAILURE = 4
FINISH = 6
INITIATE = 5
REQUEST = 1
RESPONSE = 2
SUCCESS = 3
aliastypes = [<class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

classmethod dispatch_hook(_pkt=None, *args, **kargs)
fields_desc = [<Field (EAP).code>, <Field (EAP).id>, <Field (EAP).len>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>, <scapy.fields.ConditionalField object>]
getlayer(cls, nb=1, _track=None, _subclass=True, **flt)

Return the nb^th layer that is an instance of cls, matching flt values.

guess_payload_class(_)

DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism.

Parameters:payload (str) – the layer’s payload
Returns:the payload class
haslayer(cls)

true if self has a layer that is an instance of cls. Superseded by “cls in self” syntax.

mysummary()

DEV: can be overloaded to return a string that summarizes the layer. Only one mysummary() is used in a whole packet summary: the one of the upper layer, # noqa: E501 except if a mysummary() also returns (as a couple) a list of layers whose # noqa: E501 mysummary() must be called if they are present.

post_build(p, pay)

DEV: called right after the current layer is build.

Parameters:
  • pkt (str) – the current packet (build by self_buil function)
  • pay (str) – the packet payload (build by do_build_payload function)
Returns:

a string of the packet with the payload

classmethod register_variant()
registered_methods = {0: <class 'scapy.layers.eap.EAP'>, 4: <class 'scapy.layers.eap.EAP_MD5'>, 13: <class 'scapy.layers.eap.EAP_TLS'>, 17: <class 'scapy.layers.eap.LEAP'>, 21: <class 'scapy.layers.eap.EAP_TTLS'>, 25: <class 'scapy.layers.eap.EAP_PEAP'>, 43: <class 'scapy.layers.eap.EAP_FAST'>}
class scapy.layers.eap.EAPOL

Bases: scapy.packet.Packet

EAPOL - IEEE Std 802.1X-2010

ASF = 4
EAP_PACKET = 0
KEY = 3
LOGOFF = 2
START = 1
aliastypes = [<class 'scapy.layers.eap.EAPOL'>, <class 'scapy.packet.Packet'>]
answers(other)

DEV: true if self is an answer from other

extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (EAPOL).version>, <Field (EAPOL).type>, <Field (EAPOL).len>]
hashret()

DEV: returns a string that has the same value for a request and its answer.

mysummary()

DEV: can be overloaded to return a string that summarizes the layer. Only one mysummary() is used in a whole packet summary: the one of the upper layer, # noqa: E501 except if a mysummary() also returns (as a couple) a list of layers whose # noqa: E501 mysummary() must be called if they are present.

payload_guess = [({'type': 0}, <class 'scapy.layers.eap.EAP'>), ({'type': 5}, <class 'scapy.layers.eap.MKAPDU'>), ({'type': 3}, <class 'scapy.contrib.wpa_eapol.WPA_key'>)]
class scapy.layers.eap.EAP_FAST

Bases: scapy.layers.eap.EAP

RFC 4851 - “The Flexible Authentication via Secure Tunneling Extensible Authentication Protocol Method (EAP-FAST)”

aliastypes = [<class 'scapy.layers.eap.EAP_FAST'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EAP_FAST).code>, <Field (EAP_FAST).id>, <Field (EAP_FAST).len>, <Field (EAP_FAST).type>, <Field (EAP_FAST).L>, <Field (EAP_FAST).M>, <Field (EAP_FAST).S>, <Field (EAP_FAST).reserved>, <Field (EAP_FAST).version>, <scapy.fields.ConditionalField object>, <Field (EAP_FAST).data>]
class scapy.layers.eap.EAP_MD5

Bases: scapy.layers.eap.EAP

RFC 3748 - “Extensible Authentication Protocol (EAP)”

aliastypes = [<class 'scapy.layers.eap.EAP_MD5'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EAP_MD5).code>, <Field (EAP_MD5).id>, <Field (EAP_MD5).len>, <Field (EAP_MD5).type>, <Field (EAP_MD5).value_size>, <Field (EAP_MD5).value>, <Field (EAP_MD5).optional_name>]
class scapy.layers.eap.EAP_PEAP

Bases: scapy.layers.eap.EAP

draft-josefsson-pppext-eap-tls-eap-05.txt - “Protected EAP Protocol (PEAP)”

aliastypes = [<class 'scapy.layers.eap.EAP_PEAP'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EAP_PEAP).code>, <Field (EAP_PEAP).id>, <Field (EAP_PEAP).len>, <Field (EAP_PEAP).type>, <Field (EAP_PEAP).L>, <Field (EAP_PEAP).M>, <Field (EAP_PEAP).S>, <Field (EAP_PEAP).reserved>, <Field (EAP_PEAP).version>, <scapy.fields.ConditionalField object>, <Field (EAP_PEAP).tls_data>]
class scapy.layers.eap.EAP_TLS

Bases: scapy.layers.eap.EAP

RFC 5216 - “The EAP-TLS Authentication Protocol”

aliastypes = [<class 'scapy.layers.eap.EAP_TLS'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EAP_TLS).code>, <Field (EAP_TLS).id>, <Field (EAP_TLS).len>, <Field (EAP_TLS).type>, <Field (EAP_TLS).L>, <Field (EAP_TLS).M>, <Field (EAP_TLS).S>, <Field (EAP_TLS).reserved>, <scapy.fields.ConditionalField object>, <Field (EAP_TLS).tls_data>]
class scapy.layers.eap.EAP_TTLS

Bases: scapy.layers.eap.EAP

RFC 5281 - “Extensible Authentication Protocol Tunneled Transport Layer Security Authenticated Protocol Version 0 (EAP-TTLSv0)”

aliastypes = [<class 'scapy.layers.eap.EAP_TTLS'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (EAP_TTLS).code>, <Field (EAP_TTLS).id>, <Field (EAP_TTLS).len>, <Field (EAP_TTLS).type>, <Field (EAP_TTLS).L>, <Field (EAP_TTLS).M>, <Field (EAP_TTLS).S>, <Field (EAP_TTLS).reserved>, <Field (EAP_TTLS).version>, <scapy.fields.ConditionalField object>, <Field (EAP_TTLS).data>]
class scapy.layers.eap.LEAP

Bases: scapy.layers.eap.EAP

Cisco LEAP (Lightweight EAP) https://freeradius.org/rfc/leap.txt

aliastypes = [<class 'scapy.layers.eap.LEAP'>, <class 'scapy.layers.eap.EAP'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (LEAP).code>, <Field (LEAP).id>, <Field (LEAP).len>, <Field (LEAP).type>, <Field (LEAP).version>, <Field (LEAP).unused>, <Field (LEAP).count>, <Field (LEAP).challenge_response>, <Field (LEAP).username>]
class scapy.layers.eap.MACsecSCI

Bases: scapy.packet.Packet

Secure Channel Identifier.

aliastypes = [<class 'scapy.layers.eap.MACsecSCI'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (MACsecSCI).system_identifier>, <Field (MACsecSCI).port_identifier>]
class scapy.layers.eap.MKABasicParamSet

Bases: scapy.packet.Packet

Basic Parameter Set (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKABasicParamSet'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (MKABasicParamSet).mka_version_id>, <Field (MKABasicParamSet).key_server_priority>, <Field (MKABasicParamSet).key_server>, <Field (MKABasicParamSet).macsec_desired>, <Field (MKABasicParamSet).macsec_capability>, <Field (MKABasicParamSet).param_set_body_len>, <Field (MKABasicParamSet).SCI>, <Field (MKABasicParamSet).actor_member_id>, <Field (MKABasicParamSet).actor_message_number>, <Field (MKABasicParamSet).algorithm_agility>, <scapy.fields.PadField object>]
class scapy.layers.eap.MKADistributedCAKParamSet

Bases: scapy.layers.eap.MKAParamSet

Distributed CAK Parameter Set (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKADistributedCAKParamSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<scapy.fields.PadField object>, <Field (MKADistributedCAKParamSet).param_set_body_len>, <Field (MKADistributedCAKParamSet).cak_aes_key_wrap>, <Field (MKADistributedCAKParamSet).cak_key_name>]
class scapy.layers.eap.MKADistributedSAKParamSet

Bases: scapy.layers.eap.MKAParamSet

Distributed SAK parameter set (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKADistributedSAKParamSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MKADistributedSAKParamSet).param_set_type>, <Field (MKADistributedSAKParamSet).distributed_an>, <Field (MKADistributedSAKParamSet).confidentiality_offset>, <Field (MKADistributedSAKParamSet).unused>, <Field (MKADistributedSAKParamSet).param_set_body_len>, <Field (MKADistributedSAKParamSet).key_number>, <scapy.fields.ConditionalField object>, <Field (MKADistributedSAKParamSet).sak_aes_key_wrap>]
class scapy.layers.eap.MKAICVSet

Bases: scapy.layers.eap.MKAParamSet

ICV (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKAICVSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<scapy.fields.PadField object>, <Field (MKAICVSet).param_set_body_len>, <Field (MKAICVSet).icv>]
class scapy.layers.eap.MKALivePeerListParamSet

Bases: scapy.layers.eap.MKAParamSet

Live Peer List parameter sets (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKALivePeerListParamSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<scapy.fields.PadField object>, <Field (MKALivePeerListParamSet).param_set_body_len>, <Field (MKALivePeerListParamSet).member_id_message_num>]
class scapy.layers.eap.MKAPDU

Bases: scapy.packet.Packet

MACsec Key Agreement Protocol Data Unit.

aliastypes = [<class 'scapy.layers.eap.MKAPDU'>, <class 'scapy.packet.Packet'>]
extract_padding(s)

DEV: to be overloaded to extract current layer’s padding.

Parameters:s (str) – the current layer
Returns:a couple of strings (actual layer, padding)
fields_desc = [<Field (MKAPDU).basic_param_set>, <Field (MKAPDU).parameter_sets>]
class scapy.layers.eap.MKAParamSet

Bases: scapy.packet.Packet

Class from which every parameter set class inherits (except MKABasicParamSet, which has no “Parameter set type” field, and must come first in the list of parameter sets).

EAPOL_MKA_DEFAULT_KEY_WRAP_LEN = 24
MACSEC_DEFAULT_ICV_LEN = 16
aliastypes = [<class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
classmethod dispatch_hook(_pkt=None, *args, **kargs)

Returns the right parameter set class.

class scapy.layers.eap.MKAParamSetPacketListField(name, default, cls=None, count_from=None, length_from=None, next_cls_cb=None)

Bases: scapy.fields.PacketListField

PacketListField that handles the parameter sets.

PARAM_SET_LEN_MASK = 4095
getfield(pkt, s)

Extract an internal value from a string

Extract from the raw packet s the field value belonging to layer pkt.

Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal representation.

m2i(pkt, m)

Convert machine value to internal value

class scapy.layers.eap.MKAPeerListTuple

Bases: scapy.packet.Packet

Live / Potential Peer List parameter sets tuples (802.1X-2010, section 11.11). # noqa: E501

aliastypes = [<class 'scapy.layers.eap.MKAPeerListTuple'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MKAPeerListTuple).member_id>, <Field (MKAPeerListTuple).message_number>]
class scapy.layers.eap.MKAPotentialPeerListParamSet

Bases: scapy.layers.eap.MKAParamSet

Potential Peer List parameter sets (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKAPotentialPeerListParamSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<scapy.fields.PadField object>, <Field (MKAPotentialPeerListParamSet).param_set_body_len>, <Field (MKAPotentialPeerListParamSet).member_id_message_num>]
class scapy.layers.eap.MKASAKUseParamSet

Bases: scapy.layers.eap.MKAParamSet

SAK Use Parameter Set (802.1X-2010, section 11.11).

aliastypes = [<class 'scapy.layers.eap.MKASAKUseParamSet'>, <class 'scapy.layers.eap.MKAParamSet'>, <class 'scapy.packet.Packet'>]
fields_desc = [<Field (MKASAKUseParamSet).param_set_type>, <Field (MKASAKUseParamSet).latest_key_an>, <Field (MKASAKUseParamSet).latest_key_tx>, <Field (MKASAKUseParamSet).latest_key_rx>, <Field (MKASAKUseParamSet).old_key_an>, <Field (MKASAKUseParamSet).old_key_tx>, <Field (MKASAKUseParamSet).old_key_rx>, <Field (MKASAKUseParamSet).plain_tx>, <Field (MKASAKUseParamSet).plain_rx>, <Field (MKASAKUseParamSet).X>, <Field (MKASAKUseParamSet).delay_protect>, <Field (MKASAKUseParamSet).param_set_body_len>, <Field (MKASAKUseParamSet).latest_key_key_server_member_id>, <Field (MKASAKUseParamSet).latest_key_key_number>, <Field (MKASAKUseParamSet).latest_key_lowest_acceptable_pn>, <Field (MKASAKUseParamSet).old_key_key_server_member_id>, <Field (MKASAKUseParamSet).old_key_key_number>, <Field (MKASAKUseParamSet).old_key_lowest_acceptable_pn>]