scapy.asn1.ber module

Basic Encoding Rules (BER) for ASN.1

exception scapy.asn1.ber.BER_BadTag_Decoding_Error(msg: str, decoded: Any | None = None, remaining: bytes = b'')[source]

Bases: BER_Decoding_Error, ASN1_BadTag_Decoding_Error

exception scapy.asn1.ber.BER_Decoding_Error(msg: str, decoded: Any | None = None, remaining: bytes = b'')[source]

Bases: ASN1_Decoding_Error

exception scapy.asn1.ber.BER_Encoding_Error(msg: str, encoded: BERcodec_Object[Any] | str | None = None, remaining: bytes = b'')[source]

Bases: ASN1_Encoding_Error

exception scapy.asn1.ber.BER_Exception[source]

Bases: Exception

scapy.asn1.ber.BER_id_dec(s: bytes) Tuple[int, bytes][source]
scapy.asn1.ber.BER_id_enc(n: int) bytes[source]
scapy.asn1.ber.BER_len_dec(s: bytes) Tuple[int, bytes][source]
scapy.asn1.ber.BER_len_enc(ll: int, size: int | None = 0) bytes[source]
scapy.asn1.ber.BER_num_dec(s: bytes, cls_id: int = 0) Tuple[int, bytes][source]
scapy.asn1.ber.BER_num_enc(ll: int, size: int = 1) bytes[source]
scapy.asn1.ber.BER_tagging_dec(s: bytes, hidden_tag: int | ASN1Tag | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, safe: bool | None = False, _fname: str = '') Tuple[int | None, bytes][source]
scapy.asn1.ber.BER_tagging_enc(s: bytes, implicit_tag: int | None = None, explicit_tag: int | None = None) bytes[source]
class scapy.asn1.ber.BERcodec_BIT_STRING[source]

Bases: BERcodec_Object[str]

classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[str], bytes][source]
classmethod enc(_s: AnyStr, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag BIT_STRING[3]>
class scapy.asn1.ber.BERcodec_BMP_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag BMP_STRING[30]>
class scapy.asn1.ber.BERcodec_BOOLEAN[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag BOOLEAN[1]>
class scapy.asn1.ber.BERcodec_COUNTER32[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag COUNTER32[65]>
class scapy.asn1.ber.BERcodec_COUNTER64[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag COUNTER64[70]>
class scapy.asn1.ber.BERcodec_ENUMERATED[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag ENUMERATED[10]>
class scapy.asn1.ber.BERcodec_GAUGE32[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag GAUGE32[66]>
class scapy.asn1.ber.BERcodec_GENERALIZED_TIME[source]

Bases: BERcodec_STRING

tag = <ASN1Tag GENERALIZED_TIME[24]>
class scapy.asn1.ber.BERcodec_GENERAL_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag GENERAL_STRING[27]>
class scapy.asn1.ber.BERcodec_IA5_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag IA5_STRING[22]>
class scapy.asn1.ber.BERcodec_INTEGER[source]

Bases: BERcodec_Object[int]

classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[int], bytes][source]
classmethod enc(i: int, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag INTEGER[2]>
class scapy.asn1.ber.BERcodec_IPADDRESS[source]

Bases: BERcodec_STRING

classmethod do_dec(s: bytes, context: Any | None = None, safe: bool = False) Tuple[ASN1_Object[str], bytes][source]
classmethod enc(ipaddr_ascii: str, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag IPADDRESS[64]>
class scapy.asn1.ber.BERcodec_ISO646_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag ISO646_STRING[26]>
class scapy.asn1.ber.BERcodec_NULL[source]

Bases: BERcodec_INTEGER

classmethod enc(i: int, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag NULL[5]>
class scapy.asn1.ber.BERcodec_NUMERIC_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag NUMERIC_STRING[18]>
class scapy.asn1.ber.BERcodec_OID[source]

Bases: BERcodec_Object[bytes]

classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[bytes], bytes][source]
classmethod enc(_oid: AnyStr, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag OID[6]>
class scapy.asn1.ber.BERcodec_Object[source]

Bases: Generic[_K]

classmethod asn1_object(val: _K) ASN1_Object[_K][source]
classmethod check_string(s: bytes) None[source]
classmethod check_type(s: bytes) bytes[source]
classmethod check_type_check_len(s: bytes) Tuple[int, bytes, bytes][source]
classmethod check_type_get_len(s: bytes) Tuple[int, bytes][source]
codec = <ASN1Codec BER[1]>
classmethod dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[_ASN1_ERROR | ASN1_Object[_K], bytes][source]
classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[Any], bytes][source]
classmethod enc(s: _K, size_len: int | None = 0) bytes[source]
classmethod safedec(s: bytes, context: Type[ASN1_Class] | None = None) Tuple[_ASN1_ERROR | ASN1_Object[_K], bytes][source]
tag = <ASN1Tag ANY[0]>
class scapy.asn1.ber.BERcodec_PRINTABLE_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag PRINTABLE_STRING[19]>
class scapy.asn1.ber.BERcodec_SEQUENCE[source]

Bases: BERcodec_Object[bytes | List[BERcodec_Object[Any]]]

classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[bytes | List[Any]], bytes][source]
classmethod enc(_ll: bytes | List[BERcodec_Object[Any]], size_len: int | None = 0) bytes[source]
tag = <ASN1Tag SEQUENCE[48]>
class scapy.asn1.ber.BERcodec_SET[source]

Bases: BERcodec_SEQUENCE

tag = <ASN1Tag SET[49]>
class scapy.asn1.ber.BERcodec_STRING[source]

Bases: BERcodec_Object[str]

classmethod do_dec(s: bytes, context: Type[ASN1_Class] | None = None, safe: bool = False) Tuple[ASN1_Object[Any], bytes][source]
classmethod enc(_s: str | bytes, size_len: int | None = 0) bytes[source]
tag = <ASN1Tag STRING[4]>
class scapy.asn1.ber.BERcodec_T61_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag T61_STRING[20]>
class scapy.asn1.ber.BERcodec_TIME_TICKS[source]

Bases: BERcodec_INTEGER

tag = <ASN1Tag TIME_TICKS[67]>
class scapy.asn1.ber.BERcodec_UNIVERSAL_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag UNIVERSAL_STRING[28]>
class scapy.asn1.ber.BERcodec_UTC_TIME[source]

Bases: BERcodec_STRING

tag = <ASN1Tag UTC_TIME[23]>
class scapy.asn1.ber.BERcodec_UTF8_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag UTF8_STRING[12]>
class scapy.asn1.ber.BERcodec_VIDEOTEX_STRING[source]

Bases: BERcodec_STRING

tag = <ASN1Tag VIDEOTEX_STRING[21]>
class scapy.asn1.ber.BERcodec_metaclass(name: str, bases: Tuple[type, ...], dct: Dict[str, Any])[source]

Bases: type