爆破linux密码 $6$3uwqC9JI$d9iPRmTDAoXs/IbsplxS3iyeErHqw7fUycacXNHyZk1UCSwFEydl515/zXN7OEwHnyUaqYcNG...
生活随笔
收集整理的這篇文章主要介紹了
爆破linux密码 $6$3uwqC9JI$d9iPRmTDAoXs/IbsplxS3iyeErHqw7fUycacXNHyZk1UCSwFEydl515/zXN7OEwHnyUaqYcNG...
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 #!/usr/bin/env python
2 # -*- coding:UTF-8 -*-
3
4 import crypt
5 import sys
6
7 # 哈希密碼的前兩位就是鹽的前兩位,這里我們假設鹽只有兩位。
8 # 程序分兩部分,一部分是打開字典,另一部分是哈希匹配密碼
9
10 #standard DES, two salt
11 def desPass(cryptpass):
12 #get salt from the front place
13 saltf = cryptpass[0:2]
14 return saltf
15
16 #for $6$
17 def sha512Pass(cryptpass):
18 saltf = "$6$"+cryptpass.split("$")[2]
19 return saltf
20
21 #for $5$
22 def sha256Pass(cryptpass):
23 saltf = "$5$"+cryptpass.split("$")[2]
24 # saltf = "$5$rounds=5000$anexamplestringf"
25 return saltf
26
27 def main():
28 banner = '''
29 python CrackPass.py 5
30 one params is type for you are cracking
31 0 ---- standard DES for 2 salt
32 5 ---- sha256 crypt $5$salt$secret
33 6 ---- sha512 crypt $6$salt$secret
34
35 salt contains $5$salt
36 if $salt contain "$",will cause inaccuracy. Maybe you need set the salt by your hand,for example:# saltf = "$5$rounds=5000$anexamplestringf"
37 '''
38 print banner
39 method = sys.argv[1]
40 passfile = open('Password','r')
41 #從文件中一行一行讀取
42 for line in passfile.readlines():
43 cryptpass = line.strip()
44 print "Cracking Password For: %s"%cryptpass
45
46 #select type
47 if method == "0":
48 salt = desPass(cryptpass)
49 elif method == "6":
50 salt = sha512Pass(cryptpass)
51 elif method == "5":
52 salt = sha256Pass(cryptpass)
53 print salt
54 dictfile = open('dictionary','r')
55 for word in dictfile.readlines():
56 word = word.strip('\n')
57 cryWord = crypt.crypt(word,salt)
58
59 if cryptpass == cryWord:
60 print "Found passwd: %s"%word
61 print "ok"
62 return
63 print "Password not found!"
64
65 if __name__ == '__main__':
66 main()
現在只寫了$6$ $5$開頭的和一種普通的DES兩位鹽加密的
爆破linux一般用¥6¥
注意一般密文由3部分組成,以”$”分隔,第一部分為ID,第二部分為鹽值,第三部分為加密密文
真正的鹽值包括ID部分,我上面判斷salt是根據$分割,默認是密文中只有三個$
有時salt中本來就含有$,
這時就需要自己指定salt了,saltf = "$5$rounds=5000$anexamplestringf"
可以觀察出來,觀察不出來,就多嘗試
?
我的 QQ921658495? 希望與大家交流
轉載于:https://www.cnblogs.com/kunspace/p/10583774.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的爆破linux密码 $6$3uwqC9JI$d9iPRmTDAoXs/IbsplxS3iyeErHqw7fUycacXNHyZk1UCSwFEydl515/zXN7OEwHnyUaqYcNG...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: kbmmw中向服务器端传递对象的一种简单
- 下一篇: [51nod1201]整数划分