scapy.layers.ldap module
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
Note
You will find more complete documentation for this layer over at LDAP
- 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[80]>
- AddRequest = <ASN1Tag AddRequest[104]>
- AddResponse = <ASN1Tag AddResponse[105]>
- BindRequest = <ASN1Tag BindRequest[96]>
- BindResponse = <ASN1Tag BindResponse[97]>
- CompareRequest = <ASN1Tag CompareRequest[110]>
- CompareResponse = <ASN1Tag CompareResponse[127]>
- DelRequest = <ASN1Tag DelRequest[74]>
- DelResponse = <ASN1Tag DelResponse[107]>
- ExtendedRequest = <ASN1Tag ExtendedRequest[119]>
- ExtendedResponse = <ASN1Tag ExtendedResponse[120]>
- ModifyDNRequest = <ASN1Tag ModifyDNRequest[108]>
- ModifyDNResponse = <ASN1Tag ModifyDNResponse[109]>
- ModifyRequest = <ASN1Tag ModifyRequest[102]>
- ModifyResponse = <ASN1Tag ModifyResponse[103]>
- SearchRequest = <ASN1Tag SearchRequest[99]>
- SearchResultDone = <ASN1Tag SearchResultDone[101]>
- SearchResultEntry = <ASN1Tag SearchResultEntry[100]>
- SearchResultReference = <ASN1Tag SearchResultReference[115]>
- 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]>
- ExtensibleMatch = <ASN1Tag ExtensibleMatch[169]>
- 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
- 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
- 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
- fields_desc
messageID
0x0 <ASN1_INTEGER[0]>
protocolOp
<LDAP_SearchRequest filter=<LDAP_Filter filter=<LDAP_FilterPresent |> |> |>
Controls
None
- show_indent = 0
- property unsolicited
- 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
- 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
- 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
- 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=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- NONE = 'UNAUTHENTICATED'
- 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
- 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
resultCode
0x0 <ASN1_ENUMERATED[0]>
matchedDN
<ASN1_STRING['']>
diagnosticMessage
<ASN1_STRING['']>
referral
[]
serverSaslCredsWrap
<ASN1_STRING['']>
serverSaslCreds
<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(verb=True)[source]
Bases:
object
A basic LDAP client
The complete documentation is available at https://scapy.readthedocs.io/en/latest/layers/ldap.html
Example 1 - SICILY - NTLM (with encryption):
client = LDAP_Client() client.connect("192.168.0.100") ssp = NTLMSSP(UPN="Administrator", PASSWORD="Password1!") client.bind( LDAP_BIND_MECHS.SICILY, ssp=ssp, encrypt=True, )
Example 2 - SASL_GSSAPI - Kerberos (with signing):
client = LDAP_Client() client.connect("192.168.0.100") ssp = KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!", SPN="ldap/dc1.domain.local") client.bind( LDAP_BIND_MECHS.SASL_GSSAPI, ssp=ssp, sign=True, )
Example 3 - SASL_GSS_SPNEGO - NTLM / Kerberos:
client = LDAP_Client() client.connect("192.168.0.100") ssp = SPNEGOSSP([ NTLMSSP(UPN="Administrator", PASSWORD="Password1!"), KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!", SPN="ldap/dc1.domain.local"), ]) client.bind( LDAP_BIND_MECHS.SASL_GSS_SPNEGO, ssp=ssp, )
Example 4 - Simple bind over TLS:
client = LDAP_Client() client.connect("192.168.0.100", use_ssl=True) client.bind( LDAP_BIND_MECHS.SIMPLE, simple_username="Administrator", simple_password="Password1!", )
- bind(mech, ssp=None, sign=False, encrypt=False, simple_username=None, simple_password=None)[source]
Send Bind request.
- Parameters:
mech – one of LDAP_BIND_MECHS
ssp – the SSP object to use for binding
sign – request signing when binding
encrypt – request encryption when binding
: This acts differently based on the :mech: provided during initialization.
- connect(ip, port=None, use_ssl=False, sslcontext=None, timeout=5)[source]
Initiate a connection
- Parameters:
ip – the IP to connect to.
port – the port to connect to. (Default: 389 or 636)
use_ssl – whether to use LDAPS or not. (Default: False)
sslcontext – an optional SSLContext to use.
- search(baseObject: str = '', filter: str = '', scope=0, derefAliases=0, sizeLimit=3000, timeLimit=3000, attrsOnly=0, attributes: List[str] = [], controls: List[LDAP_Control] = [])[source]
Perform a LDAP search.
- Parameters:
baseObject – the dn of the base object to search in.
filter – the filter to apply to the search (currently unsupported)
scope – 0=baseObject, 1=singleLevel, 2=wholeSubtree
- sr1(protocolOp, controls: List[LDAP_Control] = 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
- exception scapy.layers.ldap.LDAP_Exception(*args, **kwargs)[source]
Bases:
RuntimeError
- diagnosticMessage
- resultCode
- class scapy.layers.ldap.LDAP_ExtendedResponse(_pkt, /, *, resultCode=0x0 <ASN1_ENUMERATED[0]>, matchedDN=<ASN1_STRING['']>, diagnosticMessage=<ASN1_STRING['']>, referral=[], responseName=None, responseValue=None)[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
- 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
- class scapy.layers.ldap.LDAP_FilterAnd(_pkt, /, *, vals=[])[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SET_OF vals>
- aliastypes
- 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
- 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
- class scapy.layers.ldap.LDAP_FilterExtensibleMatch(_pkt, /, *, matchingRule=<ASN1_STRING['']>, type=<ASN1_STRING['']>, matchValue=<ASN1_STRING['']>, dnAttributes=False <ASN1_BOOLEAN[False]>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_optional object>, <scapy.asn1fields.ASN1F_STRING object>, <scapy.asn1fields.ASN1F_BOOLEAN object>)>
- aliastypes
- 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
- 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
- class scapy.layers.ldap.LDAP_FilterNot(_pkt, /, *, val=None)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_PACKET object>,)>
- aliastypes
- class scapy.layers.ldap.LDAP_FilterOr(_pkt, /, *, vals=[])[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SET_OF vals>
- aliastypes
- class scapy.layers.ldap.LDAP_FilterPresent(_pkt, /, *, present=<ASN1_STRING['objectClass']>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
- aliastypes
- class scapy.layers.ldap.LDAP_SASL_Buffer(_pkt, /, *, BufferLength=None, Buffer=None)[source]
Bases:
Packet
RFC 4422 sect 3.7
- 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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BUFFERLENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | BUFFER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LDAP_SASL_Buffer
BufferLength
None
Buffer
_GSSAPI_Field
None
- 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
supported_security_layers
<Flag 0 ()>
max_output_token_size
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
- 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
- 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
- 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
- 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
- class scapy.layers.ldap.LDAP_SearchResponseReference(_pkt, /, *, uris=[])[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE_OF uris>
- aliastypes
- 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
- 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
- class scapy.layers.ldap.LDAP_SubstringFilterAny(_pkt, /, *, val=<ASN1_STRING['']>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
- aliastypes
- class scapy.layers.ldap.LDAP_SubstringFilterFinal(_pkt, /, *, val=<ASN1_STRING['']>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
- aliastypes
- class scapy.layers.ldap.LDAP_SubstringFilterInitial(_pkt, /, *, val=<ASN1_STRING['']>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <scapy.asn1fields.ASN1F_STRING object>
- aliastypes
- 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
- 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
- class scapy.layers.ldap.LDAP_realSearchControlValue(_pkt, /, *, size=0x0 <ASN1_INTEGER[0]>, cookie=<ASN1_STRING['']>)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_INTEGER object>, <scapy.asn1fields.ASN1F_STRING object>)>
- aliastypes
- class scapy.layers.ldap.LDAP_serverSDFlagsControl(_pkt, /, *, flags=None)[source]
Bases:
ASN1_Packet
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_FLAGS object>,)>
- aliastypes
- 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'
- 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], **kargs: Any) PacketList | None [source]
Send packets at layer 3
This determines the interface (or L2 source to use) based on the routing table: conf.route / conf.route6
- 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))
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.