import crypt
def testPass(cryptPass):
salt=cryptPass[0:2]
dictFile=open('dictionary.txt','r')
for word in dictFile.readlines():
word=word.strip('\n')
cryptWord=crypt.crypt(word,salt)
if(cryptWord==cryptPass):
print "+ found password : "+word+"\n"
return
print"-Password Not Found.\n"
return
def main():
passFile=open('passwords.txt')
for line in passFile.readlines():
if ":" in line:
user=line.split(':')[0]
cryptPass=line.split(':')[1].strip(' ')
print "* Cracking password for: "+user
testPass(cryptPass)
if name=="__main__":
main()
报错截图:
我用的ubuntu14运行的,代码是从Python绝技运用python成为顶级黑客 这本书上敲得,麻烦各位大神给指点一下,谢谢了~