realQJ 2017-03-14 08:44 采纳率: 0%
浏览 1086

python写unix口令破解机代码报错(好像是对齐问题可是我确定对齐了啊)

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成为顶级黑客 这本书上敲得,麻烦各位大神给指点一下,谢谢了~

  • 写回答

2条回答

  • realQJ 2017-03-14 08:47
    关注

    图片说明

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog