信息收集之社工字典

时间:2022-07-26
本文章向大家介绍信息收集之社工字典,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
在渗透测试前期,信息收集是非常重要的工作,需要对目标的各种信息进行分析,拆分和融合,目的是对目标进行全方位的了解,其中一个直接产出就是生成账号密码的字典,为后续的鱼叉,水坑攻击做好准备。很多时候的成功攻击,都是从一个个脆弱的密码开始的。

本次文章依然是由八戒哥哥投稿,如果大家想来七夜安全博客投稿,可以后台联系我们哈。如果文章不错,我就找七夜要几个鹅厂公仔送给大家。

字典项目

对于字典的生成,推荐一个开源项目:https://github.com/LandGrey/pydictor/,这个项目可以帮助我们快速生成爆破字典。

(1) 安装

git clone --depth=1 --branch=master https://www.github.com/landgrey/pydictor.git
cd pydictor/
chmod +x pydictor.py

python pydictor.py:

(2) 典型场景

1. 基础字典

-base 可以指定密码的取值范围,dLc 代表着 [0-9 a-z A-Z],具体如下所示:

  -base Type            Choose from  (d, L, c, dL, dc, Lc, dLc)
                            d     digital             [0 - 9]
                            L     lowercase letters   [a - z]
                            c     capital letters     [A - Z]
                            dL    Mix d and L         [0-9 a-z]
                            dc    Mix d and c         [0-9 A-Z]
                            Lc    Mix L and c         [a-z A-Z]
                            dLc   Mix d, L and dL     [0-9 a-z A-Z]

生成长度为1~3的,包含 数字,大小写字母的字典:

python pydictor.py -base dLc --len 1 3 -o /awesome/pwd

2. 自定义字符集字典

-char 可以指定生成密码的数据源,也就是使用哪些数据生成密码,--tail 指定生成密码的后缀:

python pydictor.py -char "asdf123._@ " --len 1 3 --tail @site.com

3. 排列组合字典

通过排列组合的方式生成字典,通过 -chunk 指定多个参与排列的数据。--head 指定生成内容的前缀,--encode会对生成的数据进行编码。

python pydictor.py -chunk abc 123 '!@#' @ . _ " " --head a --tail @pass --encode md5

4. 字典合并

python pydictor.py -tool combiner /my/mess/dir

5. 字典比较

python pydictor.py -tool comparer big.txt small.txt

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

更多的使用方式,大家可以去项目主页看一下具体用法,或者直接学习pydictor的options参数。

https://github.com/LandGrey/pydictor/blob/master/README_CN.md

https://github.com/LandGrey/pydictor/blob/master/docs/doc/usage.md

(3) 社工字典

最后的社工字典,我要重点说一下,这个是我比较喜欢的功能,在渗透测试中非常有用。上面的字典生成方式,没有针对目标本身进行生成,具有普遍性,从而导致无法精准打击目标。社工字典的方式,通过我们输入目标的一些信息,可以针对这个目标生成定制化的字典。

python pydictor.py --sedb

                              _ _      _
              _ __  _   _  __| (_) ___| |_ ___  _ __
             | '_ | | | |/ _` | |/ __| __/ _ | '__|
             | |_) | |_| | (_| | | (__| || (_) | |
             | .__/ __, |__,_|_|___|_____/|_|
             |_|    |___/                         

                   Social Engineering Dictionary Builder
                                            Build by LandGrey
    ----------------------------[ command ]----------------------------
    [+]help desc             [+]exit/quit            [+]clear/cls
    [+]show option           [+]set option arguments [+]rm option
    [+]len minlen maxlen     [+]head prefix          [+]tail suffix
    [+]encode type           [+]occur L d s          [+]types L d s
    [+]regex string          [+]level code           [+]leet code
    [+]output directory      [+]run

    ----------------------------[ option ]----------------------------
    [+]cname                 [+]ename                [+]sname
    [+]birth                 [+]usedpwd              [+]phone
    [+]uphone                [+]hphone               [+]email
    [+]postcode              [+]nickname             [+]idcard
    [+]jobnum                [+]otherdate            [+]usedchar

pydictor SEDB>>

假如我对目标的已知信息如下,包括 中文名,英文名,手机号,生日,email,宠物名字,曾经用过的密码等。

information items

value

chinese name

李伟

pinyin name

liwei

english name

zwell

birthday

19880916

used password

liwei123456.

used password

liwei@19880916

used password

abc123456

phone number

18852006666

email account

33125500@qq.com

email account

13561207878@163.com

pet name

tiger

我们根据这些信息,通过 pydictor --sedb功能设置参数:

python pydictor.py --sedb
set cname liwei
set ename zwell
set birth 19880916
set usedpwd liwei123456. liwei@19880916 lw19880916_123
set phone 18852006666
set email 33125500@qq.com
set email 13561207878@163.com
set usedchar tiger 

通过show命令查看设置的参数,如果参数设置没有问题,最后运行run即可生成字典。

如果你认为生成的密码还不够,可以和自己收集的弱口令进行随机排列组合,扩大命中率。