这个输出在空闲脚本工具中意味着什么?

时间:2017-06-07 13:50:02

标签: python security scripting passwords python-idle

我正在尝试运行这个程序,这是一本来自书籍暴力python的密码破解器示例。它没有任何语法错误,也没有出现错误,但是当我使用“运行模块”在空闲状态下运行脚本时,我会看到这个输出,这是什么意思?

 RESTART: /home/ionzi/Desktop/violentpython/violentpython/chapter1/passwordcracker.py 

下面是我正在运行的代码,dir包含'dictionary.txt'和'passwords.txt'文件。

    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()

这段代码很简单,所以我对这个输出意味着什么以及它无法正常工作感到非常困惑。

我的passwords.txt文件的内容是:

victim: HX9LLTdc/jiDE: 503:100:Iama Victim:/home/victim:/bin/sh
root: DFNFxgW7C05fo: 504:100: Markus Hess:/root:/bin/bash

和我的dictionary.txt文件:

apple banana
orange
egg
lemon
grapes
secret
strawberry
password

0 个答案:

没有答案