Python与Hack之Unix口令
1.在实验时候,先导入crypt库:必须在Unix环境下才能实现这个模块
2.代码贴一下,以后有了Unix环境试试吧:
import crypt
import sys
sys.modules['Crypto']=crypto
def testPass(cryptPass):
salt=cryptPass[0:2]
dictFile=open('dictionary.txt','r')
for word in dictFile.readline():
word=word.strip('\n')
cryptWord=crypto.crypto(word,salt)
if(cryptWord==cryptPass):
print("[+] Found Password:"+word+"\n")
print("[-] Password Not Found.\n")
def main():
passFile=open('passwords.txt')
for line in passFile.readline():
if ":" in line:
user=line.split(':')[0]
cryptPass=line.split(':')[1].strip(' ')
print("[+] Cracking Password For:"+user)
testPass(cryptPass)
if __name__=="__main__":
main()
有些人之所以不断成长,就绝对是有一种坚持下去的力量。好读书,肯下功夫,不仅读,还做笔记。人要成长,必有原因,背后的努力与积累一定数倍于普通人。所以,关键还在于自己。