scapy.layers.ldap

LDAP

RFC 1777 - LDAP v2 RFC 4511 - LDAP v3

Note: to mimic Microsoft Windows LDAP packets, you must set:

conf.ASN1_default_long_size = 4
class scapy.layers.ldap.ASN1F_LDAP_Authentication_krbv42DSA(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag krbv42DSA[130]>
class scapy.layers.ldap.ASN1F_LDAP_Authentication_krbv42LDAP(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag krbv42LDAP[129]>
class scapy.layers.ldap.ASN1F_LDAP_Authentication_sicilyNegotiate(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag sicilyNegotiate[138]>
class scapy.layers.ldap.ASN1F_LDAP_Authentication_sicilyPackageDiscovery(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag sicilyPackageDiscovery[137]>
class scapy.layers.ldap.ASN1F_LDAP_Authentication_sicilyResponse(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag sicilyResponse[139]>
class scapy.layers.ldap.ASN1F_LDAP_Authentication_simple(name: str, default: _A | None, context: Type[ASN1_Class] | None = None, implicit_tag: int | None = None, explicit_tag: int | None = None, flexible_tag: bool | None = False, size_len: int | None = None)[source]

Bases: ASN1F_STRING

ASN1_tag = <ASN1Tag simple[128]>
class scapy.layers.ldap.ASN1_Class_LDAP[source]

Bases: ASN1_Class

AbandonRequest = <ASN1Tag AbandonRequest[113]>
AddRequest = <ASN1Tag AddRequest[105]>
AddResponse = <ASN1Tag AddResponse[106]>
BindRequest = <ASN1Tag BindRequest[96]>
BindResponse = <ASN1Tag BindResponse[97]>
CompareRequest = <ASN1Tag CompareRequest[111]>
CompareResponse = <ASN1Tag CompareResponse[112]>
DelRequest = <ASN1Tag DelRequest[107]>
DelResponse = <ASN1Tag DelResponse[108]>
ExtendedRequest = <ASN1Tag ExtendedRequest[114]>
ExtendedResponse = <ASN1Tag ExtendedResponse[115]>
ModifyDNRequest = <ASN1Tag ModifyDNRequest[109]>
ModifyDNResponse = <ASN1Tag ModifyDNResponse[110]>
ModifyRequest = <ASN1Tag ModifyRequest[103]>
ModifyResponse = <ASN1Tag ModifyResponse[104]>
SearchRequest = <ASN1Tag SearchRequest[99]>
SearchResultDone = <ASN1Tag SearchResultDone[101]>
SearchResultEntry = <ASN1Tag SearchResultEntry[100]>
SearchResultReference = <ASN1Tag SearchResultReference[102]>
UnbindRequest = <ASN1Tag UnbindRequest[66]>
name = 'LDAP'
class scapy.layers.ldap.ASN1_Class_LDAP_Authentication[source]

Bases: ASN1_Class

krbv42DSA = <ASN1Tag krbv42DSA[130]>
krbv42LDAP = <ASN1Tag krbv42LDAP[129]>
name = 'LDAP Authentication'
sasl = <ASN1Tag sasl[163]>
sicilyNegotiate = <ASN1Tag sicilyNegotiate[138]>
sicilyPackageDiscovery = <ASN1Tag sicilyPackageDiscovery[137]>
sicilyResponse = <ASN1Tag sicilyResponse[139]>
simple = <ASN1Tag simple[128]>
class scapy.layers.ldap.ASN1_Class_LDAP_Filter[source]

Bases: ASN1_Class

And = <ASN1Tag And[160]>
ApproxMatch = <ASN1Tag ApproxMatch[168]>
EqualityMatch = <ASN1Tag EqualityMatch[163]>
GreaterOrEqual = <ASN1Tag GreaterOrEqual[165]>
LessOrEqual = <ASN1Tag LessOrEqual[166]>
Not = <ASN1Tag Not[162]>
Or = <ASN1Tag Or[161]>
Present = <ASN1Tag Present[135]>
Substrings = <ASN1Tag Substrings[164]>
name = 'LDAP Filter'
class scapy.layers.ldap.AttributeValueAssertion(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
AttributeValueAssertion fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.BERcodec_LDAP_Authentication_krbv42DSA[source]

Bases: BERcodec_STRING

tag = <ASN1Tag krbv42DSA[130]>
class scapy.layers.ldap.BERcodec_LDAP_Authentication_krbv42LDAP[source]

Bases: BERcodec_STRING

tag = <ASN1Tag krbv42LDAP[129]>
class scapy.layers.ldap.BERcodec_LDAP_Authentication_sicilyNegotiate[source]

Bases: BERcodec_STRING

tag = <ASN1Tag sicilyNegotiate[138]>
class scapy.layers.ldap.BERcodec_LDAP_Authentication_sicilyPackageDiscovery[source]

Bases: BERcodec_STRING

tag = <ASN1Tag sicilyPackageDiscovery[137]>
class scapy.layers.ldap.BERcodec_LDAP_Authentication_sicilyResponse[source]

Bases: BERcodec_STRING

tag = <ASN1Tag sicilyResponse[139]>
class scapy.layers.ldap.BERcodec_LDAP_Authentication_simple[source]

Bases: BERcodec_STRING

tag = <ASN1Tag simple[128]>
class scapy.layers.ldap.CLDAP(_pkt, /, *, messageID=0x0 <ASN1_INTEGER[0]>, user=<ASN1_STRING['']>, protocolOp=<LDAP_SearchRequest  filter=<LDAP_Filter  filter=<LDAP_FilterPresent  |> |> |>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_CHOICE object>)>
aliastypes
answers(other)[source]
fields_desc
CLDAP fields

messageID

ASN1F_INTEGER

0x0 <ASN1_INTEGER[0]>

user

ASN1F_STRING

<ASN1_STRING['']>

protocolOp

ASN1F_CHOICE

<LDAP_SearchRequest  filter=<LDAP_Filter  filter=<LDAP_FilterPresent  |> |> |>

payload_guess

Possible sublayers: CLDAP

class scapy.layers.ldap.LDAP(_pkt, /, *, messageID=0x0 <ASN1_INTEGER[0]>, protocolOp=<LDAP_SearchRequest  filter=<LDAP_Filter  filter=<LDAP_FilterPresent  |> |> |>, Controls=None)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_CHOICE object>, <scapy.asn1fields.ASN1F_optional object>)>
aliastypes
answers(other)[source]
fields_desc
LDAP fields

messageID

ASN1F_INTEGER

0x0 <ASN1_INTEGER[0]>

protocolOp

ASN1F_CHOICE

<LDAP_SearchRequest  filter=<LDAP_Filter  filter=<LDAP_FilterPresent  |> |> |>

Controls

ASN1F_SEQUENCE_OF

None

mysummary()[source]
payload_guess

Possible sublayers: LDAP

class scapy.layers.ldap.LDAPReferral(_pkt, /, *, uri=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAPReferral fields

uri

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_AbandonRequest(_pkt, /, *, messageID=0x0 <ASN1_INTEGER[0]>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>,)>
aliastypes
fields_desc
LDAP_AbandonRequest fields

messageID

ASN1F_INTEGER

0x0 <ASN1_INTEGER[0]>

class scapy.layers.ldap.LDAP_Authentication_SaslCredentials(_pkt, /, *, mechanism=<ASN1_STRING['']>, credentials=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_optional object>)>
aliastypes
fields_desc
LDAP_Authentication_SaslCredentials fields

mechanism

ASN1F_STRING

<ASN1_STRING['']>

credentials

_SaslCredentialsField

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_Authentication_krbv42DSA(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag krbv42DSA[130]>
class scapy.layers.ldap.LDAP_Authentication_krbv42LDAP(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag krbv42LDAP[129]>
class scapy.layers.ldap.LDAP_Authentication_sicilyNegotiate(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag sicilyNegotiate[138]>
class scapy.layers.ldap.LDAP_Authentication_sicilyPackageDiscovery(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag sicilyPackageDiscovery[137]>
class scapy.layers.ldap.LDAP_Authentication_sicilyResponse(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag sicilyResponse[139]>
class scapy.layers.ldap.LDAP_Authentication_simple(val: _K)[source]

Bases: ASN1_STRING

tag = <ASN1Tag simple[128]>
class scapy.layers.ldap.LDAP_BIND_MECHS(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

NONE = 'NONE'
SASL_DIGEST_MD5 = 'DIGEST-MD5'
SASL_EXTERNAL = 'EXTERNAL'
SASL_GSSAPI = 'GSSAPI'
SASL_GSS_SPNEGO = 'GSS-SPNEGO'
SICILY = 'SICILY'
SIMPLE = 'SIMPLE'
class scapy.layers.ldap.LDAP_BindRequest(_pkt, /, *, version=0x3 <ASN1_INTEGER[3]>, bind_name=<ASN1_STRING['']>, authentication=None)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_CHOICE object>)>
aliastypes
fields_desc
LDAP_BindRequest fields

version

ASN1F_INTEGER

0x3 <ASN1_INTEGER[3]>

bind_name

ASN1F_STRING

<ASN1_STRING['']>

authentication

ASN1F_CHOICE

None

class scapy.layers.ldap.LDAP_BindResponse(_pkt, /, *, resultCode=0x0 <ASN1_ENUMERATED[0]>, matchedDN=<ASN1_STRING['']>, diagnosticMessage=<ASN1_STRING['']>, referral=[], serverSaslCredsWrap=<ASN1_STRING['']>, serverSaslCreds=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_ENUMERATED object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>)>
aliastypes
fields_desc
LDAP_BindResponse fields

resultCode

ASN1F_ENUMERATED

0x0 <ASN1_ENUMERATED[0]>

matchedDN

ASN1F_STRING

<ASN1_STRING['']>

diagnosticMessage

ASN1F_STRING

<ASN1_STRING['']>

referral

ASN1F_SEQUENCE_OF

[]

serverSaslCredsWrap

ASN1F_STRING

<ASN1_STRING['']>

serverSaslCreds

ASN1F_STRING

<ASN1_STRING['']>

property serverCreds

serverCreds field in SicilyBindResponse

property serverSaslCredsData

Get serverSaslCreds or serverSaslCredsWrap depending on what’s available

class scapy.layers.ldap.LDAP_Client(mech, verb=True, ssl=False, sslcontext=None, ssp=None, sign=False, encrypt=False)[source]

Bases: object

A basic LDAP client

Parameters:
  • mech – one of LDAP_BIND_MECHS

  • ssl – whether to use LDAPS or not

  • ssp – the SSP object to use for binding

  • sign – request signing when binding

  • encrypt – request encryption when binding

Example 1 - SICILY - NTLM:

ssp = NTLMSSP(UPN="Administrator", PASSWORD="Password1!")
client = LDAP_Client(
    LDAP_BIND_MECHS.SICILY,
    ssp=ssp,
)
client.connect("192.168.0.100")
client.bind()

Example 2 - SASL_GSSAPI - Kerberos:

ssp = KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!",
                  SPN="ldap/dc1.domain.local")
client = LDAP_Client(
    LDAP_BIND_MECHS.SASL_GSSAPI,
    ssp=ssp,
)
client.connect("192.168.0.100")
client.bind()

Example 3 - SASL_GSS_SPNEGO - NTLM / Kerberos:

ssp = SPNEGOSSP([
    NTLMSSP(UPN="Administrator", PASSWORD="Password1!"),
    KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!",
                  SPN="ldap/dc1.domain.local"),
])
client = LDAP_Client(
    LDAP_BIND_MECHS.SASL_GSS_SPNEGO,
    ssp=ssp,
)
client.connect("192.168.0.100")
client.bind()

Example 4 - Simple bind:

client = LDAP_Client(LDAP_BIND_MECHS.SIMPLE)
client.connect("192.168.0.100")
client.bind(simple_username="Administrator",
            simple_password="Password1!")
bind(simple_username=None, simple_password=None)[source]

Send Bind request. This acts differently based on the :mech: provided during initialization.

close()[source]
connect(ip, port=None, timeout=5)[source]

Initiate a connection

sr1(protocolOp, controls=None, **kwargs)[source]
class scapy.layers.ldap.LDAP_Control(_pkt, /, *, controlType=<ASN1_STRING['']>, criticality=False <ASN1_BOOLEAN[False]>, controlValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>)>
aliastypes
fields_desc
LDAP_Control fields

controlType

ASN1F_STRING

<ASN1_STRING['']>

criticality

ASN1F_BOOLEAN

False <ASN1_BOOLEAN[False]>

controlValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_Filter(_pkt, /, *, filter=<LDAP_FilterPresent  |>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_CHOICE object>
aliastypes
fields_desc
LDAP_Filter fields

filter

ASN1F_CHOICE

<LDAP_FilterPresent  |>

class scapy.layers.ldap.LDAP_FilterAnd(_pkt, /, *, and_=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SET_OF and_>
aliastypes
fields_desc
LDAP_FilterAnd fields

and_

ASN1F_SET_OF

[]

class scapy.layers.ldap.LDAP_FilterApproxMatch(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
LDAP_FilterApproxMatch fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_FilterEqual(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
LDAP_FilterEqual fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_FilterGreaterOrEqual(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
LDAP_FilterGreaterOrEqual fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_FilterLessOrEqual(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
LDAP_FilterLessOrEqual fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_FilterLesserOrEqual(_pkt, /, *, attributeType=<ASN1_STRING['organizationName']>, attributeValue=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>)>
aliastypes
fields_desc
LDAP_FilterLesserOrEqual fields

attributeType

ASN1F_STRING

<ASN1_STRING['organizationName']>

attributeValue

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_FilterOr(_pkt, /, *, or_=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SET_OF or_>
aliastypes
fields_desc
LDAP_FilterOr fields

or_

ASN1F_SET_OF

[]

class scapy.layers.ldap.LDAP_FilterPresent(_pkt, /, *, present=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_FilterPresent fields

present

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SASL_GSSAPI_SsfCap(_pkt, /, *, supported_security_layers=<Flag 0 ()>, max_output_token_size=0)[source]

Bases: Packet

RFC2222 sect 7.2.1 and 7.2.2 negotiate token

aliastypes
fields_desc
Display RFC-like schema
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|SUPPORTED SECUR|             MAX OUTPUT TOKEN SIZE             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               |
+-+-+-+-+-+-+-+-+

                   Fig. LDAP_SASL_GSSAPI_SsfCap                   
LDAP_SASL_GSSAPI_SsfCap fields

supported_security_layers

FlagsField

<Flag 0 ()>

max_output_token_size

ThreeBytesField

0

class scapy.layers.ldap.LDAP_SearchRequest(_pkt, /, *, baseObject=<ASN1_STRING['']>, scope=0x0 <ASN1_ENUMERATED[0]>, derefAliases=0x0 <ASN1_ENUMERATED[0]>, sizeLimit=0x0 <ASN1_INTEGER[0]>, timeLimit=0x0 <ASN1_INTEGER[0]>, attrsOnly=False <ASN1_BOOLEAN[False]>, filter=<LDAP_Filter  filter=<LDAP_FilterPresent  |> |>, attributes=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_ENUMERATED object>, <scapy.asn1fields.ASN1F_ENUMERATED object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_BOOLEAN object>, <scapy.asn1fields.ASN1F_PACKET object>, <ASN1F_SEQUENCE_OF attributes>)>
aliastypes
fields_desc
LDAP_SearchRequest fields

baseObject

ASN1F_STRING

<ASN1_STRING['']>

scope

ASN1F_ENUMERATED

0x0 <ASN1_ENUMERATED[0]>

derefAliases

ASN1F_ENUMERATED

0x0 <ASN1_ENUMERATED[0]>

sizeLimit

ASN1F_INTEGER

0x0 <ASN1_INTEGER[0]>

timeLimit

ASN1F_INTEGER

0x0 <ASN1_INTEGER[0]>

attrsOnly

ASN1F_BOOLEAN

False <ASN1_BOOLEAN[False]>

filter

ASN1F_PACKET

<LDAP_Filter  filter=<LDAP_FilterPresent  |> |>

attributes

ASN1F_SEQUENCE_OF

[]

class scapy.layers.ldap.LDAP_SearchRequestAttribute(_pkt, /, *, type=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_SearchRequestAttribute fields

type

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SearchResponseEntry(_pkt, /, *, objectName=<ASN1_STRING['']>, attributes=<LDAP_SearchResponseEntryAttribute  |>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <ASN1F_SEQUENCE_OF attributes>)>
aliastypes
fields_desc
LDAP_SearchResponseEntry fields

objectName

ASN1F_STRING

<ASN1_STRING['']>

attributes

ASN1F_SEQUENCE_OF

<LDAP_SearchResponseEntryAttribute  |>

class scapy.layers.ldap.LDAP_SearchResponseEntryAttribute(_pkt, /, *, type=<ASN1_STRING['']>, values=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <ASN1F_SET_OF values>)>
aliastypes
fields_desc
LDAP_SearchResponseEntryAttribute fields

type

ASN1F_STRING

<ASN1_STRING['']>

values

ASN1F_SET_OF

[]

class scapy.layers.ldap.LDAP_SearchResponseEntryAttributeValue(_pkt, /, *, value=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_SearchResponseEntryAttributeValue fields

value

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SearchResponseResultDone(_pkt, /, *, resultCode=0x0 <ASN1_ENUMERATED[0]>, matchedDN=<ASN1_STRING['']>, diagnosticMessage=<ASN1_STRING['']>, referral=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_ENUMERATED object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_optional object>)>
aliastypes
fields_desc
LDAP_SearchResponseResultDone fields

resultCode

ASN1F_ENUMERATED

0x0 <ASN1_ENUMERATED[0]>

matchedDN

ASN1F_STRING

<ASN1_STRING['']>

diagnosticMessage

ASN1F_STRING

<ASN1_STRING['']>

referral

ASN1F_SEQUENCE_OF

[]

class scapy.layers.ldap.LDAP_SubstringFilter(_pkt, /, *, type=<ASN1_STRING['']>, filters=[])[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_STRING object>, <ASN1F_SEQUENCE_OF filters>)>
aliastypes
fields_desc
LDAP_SubstringFilter fields

type

ASN1F_STRING

<ASN1_STRING['']>

filters

ASN1F_SEQUENCE_OF

[]

class scapy.layers.ldap.LDAP_SubstringFilterAny(_pkt, /, *, any=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_SubstringFilterAny fields

any

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SubstringFilterFinal(_pkt, /, *, final=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_SubstringFilterFinal fields

final

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SubstringFilterInitial(_pkt, /, *, initial=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
aliastypes
fields_desc
LDAP_SubstringFilterInitial fields

initial

ASN1F_STRING

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_SubstringFilterStr(_pkt, /, *, str=<ASN1_STRING['']>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <scapy.asn1fields.ASN1F_CHOICE object>
aliastypes
fields_desc
LDAP_SubstringFilterStr fields

str

ASN1F_CHOICE

<ASN1_STRING['']>

class scapy.layers.ldap.LDAP_UnbindRequest(_pkt, /, *, info=<ASN1_NULL[0]>)[source]

Bases: ASN1_Packet

ASN1_codec = <ASN1Codec BER[1]>
ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_NULL object>,)>
aliastypes
fields_desc
LDAP_UnbindRequest fields

info

ASN1F_NULL

<ASN1_NULL[0]>

class scapy.layers.ldap.LdapPing_am(self, NetbiosDomainName='DOMAIN', DomainGuid=UUID('192bc4b3-0085-4521-83fe-062913ef59f2'), DcSiteName='Default-First-Site-Name', NetbiosComputerName='SRV1', DnsForestName=None, DnsHostName=None, src_ip=None, src_ip6=None)[source]

Bases: AnsweringMachine

filter: str | None = 'udp port 389 or 138'
function_name = 'ldappingd'
is_request(req)[source]
make_mailslot_ping_reply(req: Packet) Packet[source]
make_reply(req)[source]
optam0: Dict[str, Any]
optam1: Dict[str, Any]
optam2: Dict[str, Any]
optsend: Dict[str, Any]
optsniff: Dict[str, Any]
parse_options(NetbiosDomainName='DOMAIN', DomainGuid=UUID('192bc4b3-0085-4521-83fe-062913ef59f2'), DcSiteName='Default-First-Site-Name', NetbiosComputerName='SRV1', DnsForestName=None, DnsHostName=None, src_ip=None, src_ip6=None)[source]
static send_function(x: Sequence[Packet] | Packet | SetGen[Packet] | _PacketList[Packet], iface: NetworkInterface | str | None = None, **kargs: Any) PacketList | None[source]

Send packets at layer 3

Parameters:
  • x – the packets

  • inter – time (in s) between two packets (default 0)

  • loop – send packet indefinitely (default 0)

  • count – number of packets to send (default None=1)

  • verbose – verbose mode (default None=conf.verb)

  • realtime – check that a packet was sent before sending the next one

  • return_packets – return the sent packets

  • socket – the socket to use (default is conf.L3socket(kargs))

  • iface – the interface to send the packets on

  • monitor – (not on linux) send in monitor mode

Returns:

None

scapy.layers.ldap.dclocator(realm, qtype='A', mode='ldap', port=None, timeout=1, NtVersion=None, debug=0)[source]

Perform a DC Locator as per [MS-ADTS] sect 6.3.6 or RFC4120.

Parameters:
  • realm – the kerberos realm to locate

  • mode – Detect if a server is up and joinable thanks to one of:

  • ‘nocheck’: Do not check that servers are online.

  • ‘ldap’: Use the LDAP ping (CLDAP) per [MS-ADTS]. Default.

    This will however not work with MIT Kerberos servers.

  • ‘connect’: connect to specified port to test the connection.

Parameters:
  • mode – in connect mode, the port to connect to. (e.g. 88)

  • debug – print debug logs

This is cached in conf.netcache.dclocator.