本文整理汇总了Python中impacket.ntlm.compute_nthash方法的典型用法代码示例。如果您正苦于以下问题:Python ntlm.compute_nthash方法的具体用法?Python ntlm.compute_nthash怎么用?Python ntlm.compute_nthash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类impacket.ntlm
的用法示例。
在下文中一共展示了ntlm.compute_nthash方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from impacket import ntlm [as 别名]
# 或者: from impacket.ntlm import compute_nthash [as 别名]
def __init__(self, logger, share_name, share_path='/tmp/.ar3', share_comment = '', username= '', password='', listen_address='0.0.0.0', listen_port=445, verbose=False):
self.running = True
self._smb2support = False
self._share_path = share_path
try:
threading.Thread.__init__(self)
# If suggested share_path not exist, create
if not os.path.exists(share_path):
os.makedirs(share_path)
# Setup SMB Server
self.server = smbserver.SimpleSMBServer(listen_address, int(listen_port))
self.server.addShare(share_name, share_path, share_comment)
if verbose:
self.server.setLogFile('')
self.server.setSMB2Support(self._smb2support)
self.server.setSMBChallenge('')
if username:
if password:
lmhash = compute_lmhash(password)
nthash = compute_nthash(password)
self.server.addCredential(username, 0, lmhash, nthash)
except Exception as e:
errno, message = e.args
if errno == 98 and message == 'Address already in use':
logger.fail('Error starting SMB server on port 445: the port is already in use')
else:
logger.fail('Error starting SMB server on port 445: {}'.format(message))
exit(1)