MCPcopy Create free account
hub / github.com/secdev/scapy / __init__

Method __init__

scapy/layers/ntlm.py:2138–2185  ·  view source on GitHub ↗
(self, UPN=None, *args, timeout=3, ssp=None, **kwargs)

Source from the content-addressed store, hash-verified

2136 """
2137
2138 def __init__(self, UPN=None, *args, timeout=3, ssp=None, **kwargs):
2139 from scapy.layers.kerberos import KerberosSSP
2140
2141 # Either PASSWORD or HASHNT or ssp
2142 if (
2143 "HASHNT" not in kwargs
2144 and "PASSWORD" not in kwargs
2145 and "KEY" not in kwargs
2146 and ssp is None
2147 ):
2148 raise ValueError(
2149 "Must specify either 'HASHNT', 'PASSWORD' or "
2150 "provide a ssp=KerberosSSP()"
2151 )
2152 elif ssp is not None and not isinstance(ssp, KerberosSSP):
2153 raise ValueError("'ssp' can only be None or a KerberosSSP !")
2154
2155 self.KEY = kwargs.pop("KEY", None)
2156 self.PASSWORD = kwargs.get("PASSWORD", None)
2157
2158 # UPN is mandatory
2159 if UPN is None and ssp is not None and ssp.UPN:
2160 UPN = ssp.UPN
2161 elif UPN is None:
2162 raise ValueError("Must specify a 'UPN' !")
2163 kwargs["UPN"] = UPN
2164
2165 # Call parent
2166 super(NTLMSSP_DOMAIN, self).__init__(
2167 *args,
2168 **kwargs,
2169 )
2170
2171 # Treat specific parameters
2172 self.DC_FQDN = kwargs.pop("DC_FQDN", None)
2173 if self.DC_FQDN is None:
2174 # Get DC_FQDN from dclocator
2175 from scapy.layers.ldap import dclocator
2176
2177 dc = dclocator(
2178 self.DOMAIN_FQDN,
2179 timeout=timeout,
2180 debug=kwargs.get("debug", 0),
2181 )
2182 self.DC_FQDN = dc.samlogon.DnsHostName.decode().rstrip(".")
2183
2184 # If logging in via Kerberos
2185 self.ssp = ssp
2186
2187 def _getSessionBaseKey(self, Context, ntlm):
2188 """

Callers

nothing calls this directly

Calls 5

dclocatorFunction · 0.90
popMethod · 0.80
decodeMethod · 0.80
getMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected