在linux python中运行文件时遇到问题
当我键入python cracked.py打开文件时,该文件不会打开,而是转到新行。它为什么这样做?这是我试图运行的代码:在linux python中运行文件时遇到问题,python,linux,python-2.7,kali-linux,Python,Linux,Python 2.7,Kali Linux,当我键入python cracked.py打开文件时,该文件不会打开,而是转到新行。它为什么这样做?这是我试图运行的代码: import crypt def testPass(cryptPass): salt = cryptPass[0:2] dictFile = open('dictionary-1.txt', 'r') for word in dictFile.readlines(): word = word.strip('\n')
import crypt
def testPass(cryptPass):
salt = cryptPass[0:2]
dictFile = open('dictionary-1.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('/root/homework/HomeworkW8.zip')
for line in passFile.readlines():
if ":" in line:
user = line.split(':')[0]
cryptPass = line.split(':')[1].strip(' ')
print "[*] Crackin Password For: "+user
testPass(cryptPass)
if __name__ == "__main__":
main()
passFile包含一个zip文件。无法读取zip文件。您需要首先解压缩“HomeworkW8.zip”文件并打开其中的文件(如.txt或.csv或.xls等) 如果你想知道如何解压文件,这里是链接
仅使用以下方法导入时:
import crypt
其他模块将被导入,因为python内置了crypt模块,该模块实现了到crypt(3)例程的接口,该例程是基于修改的DES算法的单向散列函数
也许你可以重命名你的模块