Created
May 11, 2020 08:05
-
-
Save Harish2997/0d7fae443f3d99ec51826a67fa2a3cf9 to your computer and use it in GitHub Desktop.
NTLM version1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
from ntlm_auth.ntlm import NtlmContext | |
username = 'User' | |
password = 'Password' | |
domain = 'Domain' # Can be blank if you are not in a domain | |
workstation = socket.gethostname().upper() # Can be blank if you wish to not send this info | |
ntlm_context = NtlmContext(username, password, domain, workstation, ntlm_compatibility=0) # Put the ntlm_compatibility level here, 0-2 for LM Auth/NTLMv1 Auth | |
negotiate_message = ntlm_context.step() | |
# Attach the negotiate_message to your NTLM/NEGOTIATE HTTP header and send to the server. Get the challenge response back from the server | |
challenge_message = http.response.headers['HEADERFIELD'] | |
authenticate_message = ntlm_context.step(challenge_message) | |
# Attach the authenticate_message ot your NTLM_NEGOTIATE HTTP header and send to the server. You are now authenticated with NTLMv1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment