How to calculate NTLM hash in python? [closed]

ぐ巨炮叔叔 提交于 2019-12-22 10:33:38

问题


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 )


回答1:


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




回答2:


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


来源:https://stackoverflow.com/questions/15603628/how-to-calculate-ntlm-hash-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!