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", P
| 1741 | |
| 1742 | |
| 1743 | class LDAP_Client(object): |
| 1744 | """ |
| 1745 | A basic LDAP client |
| 1746 | |
| 1747 | The complete documentation is available at |
| 1748 | https://scapy.readthedocs.io/en/latest/layers/ldap.html |
| 1749 | |
| 1750 | Example 1 - SICILY - NTLM (with encryption):: |
| 1751 | |
| 1752 | client = LDAP_Client() |
| 1753 | client.connect("192.168.0.100") |
| 1754 | ssp = NTLMSSP(UPN="Administrator", PASSWORD="Password1!") |
| 1755 | client.bind( |
| 1756 | LDAP_BIND_MECHS.SICILY, |
| 1757 | ssp=ssp, |
| 1758 | encrypt=True, |
| 1759 | ) |
| 1760 | |
| 1761 | Example 2 - SASL_GSSAPI - Kerberos (with signing):: |
| 1762 | |
| 1763 | client = LDAP_Client() |
| 1764 | client.connect("192.168.0.100") |
| 1765 | ssp = KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!", |
| 1766 | SPN="ldap/dc1.domain.local") |
| 1767 | client.bind( |
| 1768 | LDAP_BIND_MECHS.SASL_GSSAPI, |
| 1769 | ssp=ssp, |
| 1770 | sign=True, |
| 1771 | ) |
| 1772 | |
| 1773 | Example 3 - SASL_GSS_SPNEGO - NTLM / Kerberos:: |
| 1774 | |
| 1775 | client = LDAP_Client() |
| 1776 | client.connect("192.168.0.100") |
| 1777 | ssp = SPNEGOSSP([ |
| 1778 | NTLMSSP(UPN="Administrator", PASSWORD="Password1!"), |
| 1779 | KerberosSSP(UPN="Administrator@domain.local", PASSWORD="Password1!", |
| 1780 | SPN="ldap/dc1.domain.local"), |
| 1781 | ]) |
| 1782 | client.bind( |
| 1783 | LDAP_BIND_MECHS.SASL_GSS_SPNEGO, |
| 1784 | ssp=ssp, |
| 1785 | ) |
| 1786 | |
| 1787 | Example 4 - Simple bind over TLS:: |
| 1788 | |
| 1789 | client = LDAP_Client() |
| 1790 | client.connect("192.168.0.100", use_ssl=True) |
| 1791 | client.bind( |
| 1792 | LDAP_BIND_MECHS.SIMPLE, |
| 1793 | simple_username="Administrator", |
| 1794 | simple_password="Password1!", |
| 1795 | ) |
| 1796 | """ |
| 1797 | |
| 1798 | def __init__( |
| 1799 | self, |
| 1800 | verb=True, |