我需要帮助理解并解决以下错误:
Traceback (most recent call last):
File "./pwdCracker.py", line 48, in <module>
main()
File "./pwdCracker.py", line 45, in main
testPass(cryptPass,user)
File "./pwdCracker.py", line 22, in testPass
cryptWord = crypt.crypt(word,insalt)
TypeError: 'module' object is not callable
每次运行此代码时都会出现:
def main():
parse = argparse.ArgumentParser(description='A simple brute force /etc/shadow .')
parse.add_argument('-f', action='store', dest='path', help='Path to shadow file, example: \'/etc/shadow\'')
argus=parse.parse_args()
if argus.path == None:
parse.print_help()
exit
else:
passFile = open (argus.path, 'r')
for line in passFile.readlines():
line = line.replace("\n","").split(":")
if not line[1] in [ 'x', '*', '!']:
user = line[0]
cryptPass = line[1]
testPass(cryptPass,user)
if __name__== "__main__":
main()
答案 0 :(得分:1)
您的本地目录中可能有一个名为crypt.py
的文件,其中有一行import crypt
。这是循环导入并屏蔽标准库crypt
模块。
找到它:
import crypt; print(crypt.__file__)
在脚本的顶部,然后重命名该文件。