How can I calculate NTLM hash of a passowrd in python? Is there any library or sample code?
I want it for writing a NTLM brute force tools with python (Like Cain & Abel )
It is actually very quite simple use hashlib
here
import hashlib,binascii
hash = hashlib.new('md4', "password".encode('utf-16le')).digest()
print binascii.hexlify(hash)
Or you can additionally use the python-ntlm
library here
You can make use of the hashlib and binascii modules to compute your NTLM hash:
import binascii, hashlib
input_str = "SOMETHING_AS_INPUT_TO_HASH"
ntlm_hash = binascii.hexlify(hashlib.new('md4', input_str.encode('utf-16le')).digest())
print ntlm_hash