在滲透測試前期,信息收集是非常重要的工作,需要對目標的各種信息進行分析,拆分和融合,目的是對目標進行全方位的了解,其中一個直接產出就是生成賬號密碼的字典,為后續的魚叉,水坑攻擊做好準備。很多時候的成功攻擊,都是從一個個脆弱的密碼開始的。

接下來介紹的工具叫做pydictor

地址https://github.com/LandGrey/pydictor/
他可以幫助我們快速的生成普通爆破字典、基于網站內容的自定義字典、社會工程學字典等等一系列高級字典
還可以使用內置工具,對字典進行安全刪除、合并、去重、合并并去重、高頻詞篩選
生成獨一無二的高度定制、高效率和復雜字典,生成密碼字典的好壞和你的自定義規則、能不能熟練使用pydictor有很大關系
兼容性強python 2.7版本還是python 3.4 以上版本,pydictor都可以在Windows、Linux 或者是Mac上運行

pydictor可以生成的所有字典的類型及其說明

字典操作功能及說明對照表

支持的編碼或加密方式

核心功能字典

1. 基礎字典
python pydictor.py -base L --len 2 3 --encode b64
python pydictor.py -base dLc --len 1 3 -o /awesome/pwd
python pydictor.py -base d --len 4 4 --head Pa5sw0rd --output D:\exists\orot\dict.txt
2. 自定義字符集字典
python pydictor.py -char "asdf123._@ " --len 1 3 --tail @site.com
3. 排列組合字典
python pydictor.py -chunk abc 123 "!@#" @ . _ " " --head a --tail @pass --encode md5
4. 語法引擎解析字典
python pydictor.py --conf                                  用默認的"/funcfg/build.conf"文件建立字典
python pydictor.py --conf /my/other/awesome.conf
python pydictor.py --conf "[0-9]{6,6}[a-f,abc,123,!@#]{1,1}" --encode md5 --output parsing.txt
5. 模式字典快速生成
# note that: 
# 1. using python3 is fast than python2
# 2. one element only support single character, like: [***]{1,1}<***>
# generate pattern: abc[%d][%d][%l][%d][%d][%l][%d][%d]
python3 pydictor.py --head abc --pattern "[0-9]{1,1}[0-9]{1,1}[a-z]{1,1}[0-9]{1,1}[0-9]{1,1}[a-z]{1,1}[0-9]{1,1}[0-9]{1,1}" -o output.txt
6. 規則擴展字典
python pydictor.py -extend bob --level 4 --len 4 12
python pydictor.py -extend liwei zwell.com --more --leet 0 1 2 11 21 --level 2 --len 6 16 --occur "<=10" ">0" "<=2" -o /possbile/wordlist.lst

插件型字典(可自己根據API文檔開發)

1. 一段時間內生日字典
python pydictor.py -plug birthday 19800101 20001231 --len 6 8
2. 身份證后4/6/8位字典
python pydictor.py -plug pid4
python pydictor.py -plug pid6 --encode b64
python pydictor.py -plug pid8 --encode sha1 -o pid8.txt
3. 網頁原始關鍵詞字典
python pydictor.py -plug scratch                             用/funcfg/scratch.sites 文件中的多行 url 作為輸入
python pydictor.py -plug scratch http://www.example.com
內置工具(可自己根據API文檔開發)
1. 字典合并工具
python pydictor.py -tool combiner /my/mess/dir
2. 字典比較工具
python pydictor.py -tool comparer big.txt small.txt
3. 詞頻統計工具
python pydictor.py -tool counter s huge.txt 1000
python pydictor.py -tool counter v /tmp/mess.txt 100
python pydictor.py -tool counter vs huge.txt 100 --encode url -o fre.txt
4. 字典處理工具
python pydictor.py -tool handler raw.txt --tail @awesome.com --encode md5
python pydictor.py -tool handler raw.txt --len 6 16 --occur "" "=6" "<0" --encode b64 -o ok.txt
5. 安全擦除字典工具
python pydictor.py -tool shredder                    擦除當前輸出目錄下所有字典文件
python pydictor.py -tool shredder base                  擦除當前輸出目錄下所有以"base"開頭的字典文件
python pydictor.py -tool shredder /data/mess
python pydictor.py -tool shredder D:\mess\1.zip
6. 合并去重工具
python pydictor.py -tool uniqbiner /my/all/dict/
7. 字典去重工具
python pydictor.py -tool uniqifer /tmp/dicts.txt --output /tmp/uniq.txt
8. 多字典文件組合工具
python pydictor.py -tool hybrider heads.txt some_others.txt tails.txt

社工字典

這個社工字典的功能,在滲透測試中非常有用。生成出來的命中率也是非常高的。上面的字典生成方式,沒有針對目標本身進行生成,具有普遍性,從而導致無法精準打擊目標。社工字典的方式,通過我們輸入目標的一些信息,可以針對這個目標生成定制化的字典。

python pydictor.py --sedb

可以看到有非常多的選項提供,根據目標任務的信息生成定制化的字典去爆破成功率高很多

例如設置以下信息

cname kevin
birth 20200101
phone 13888888888
email 123@qq.com
usedpwd qwer123456.

在results文件夾目錄下會生成我們的字典

可以看到生成的字典都是根據我們提供的信息來生成的。生成了6022條還是非常強大的

包括生成身份證后x位,生日等的功能也是非常實用的