| 159 | |
| 160 | class CustomNTLMContext: |
| 161 | def __init__( |
| 162 | self, |
| 163 | ctx, |
| 164 | preferred_type: str = "NTLM", |
| 165 | cbt_data: gss_channel_bindings.GssChannelBindingsStruct = None, |
| 166 | ): |
| 167 | # TODO:// take care the cbt_data |
| 168 | auth: str = ctx.options.upstream_ntlm_auth |
| 169 | domain: str = str(ctx.options.upstream_ntlm_domain).upper() |
| 170 | ntlm_compatibility: int = ctx.options.upstream_ntlm_compatibility |
| 171 | username, password = tuple(auth.split(":")) |
| 172 | workstation = socket.gethostname().upper() |
| 173 | logging.debug(f'\nntlm context with the details: "{domain}\\{username}", *****') |
| 174 | self.preferred_type = preferred_type |
| 175 | self.ntlm_context = ntlm.NtlmContext( |
| 176 | username=username, |
| 177 | password=password, |
| 178 | domain=domain, |
| 179 | workstation=workstation, |
| 180 | ntlm_compatibility=ntlm_compatibility, |
| 181 | cbt_data=cbt_data, |
| 182 | ) |
| 183 | |
| 184 | def get_ntlm_start_negotiate_message(self) -> str: |
| 185 | negotiate_message = self.ntlm_context.step() |