Day 24 Password Attacks - 密码生成器 (Wordlists, CeWL, Crunch)

前言

为了破解密码,我们必须尝试很多可能才能找到正确的密码。当攻击者使用数千或数百万个单字或组合来破解密码时,无法确定这数百万个组合中的任何一个是否有效。这种不同字符组合的集合称为wordlists。为了破解密码或杂凑,我们需要有一个可以破解密码的好的wordlists

工具介绍 (Wordlists)

Wordlists不算是工具,直接执行会显示其具体位置/usr/share/wordlists,里面放了各工具的字典所在位置

wordlists ~ Contains the rockyou wordlist
/usr/share/wordlists
  |--dirb
  |--dirbuster
  |--fasttrack.txt
  |--fern-wifi
  |--metasploit
  |--nmap.lst
  |--rockyou.txt.gz
  |--wfuzz

想得到具体字典的位置的话可以输入以下指令

ls -al /usr/share/wordlists 

这样就能看到各工具wordlists的具体位置

lrwxrwxrwx   1 root root       25 May 30 17:27 dirb -> /usr/share/dirb/wordlists
lrwxrwxrwx   1 root root       30 May 30 17:27 dirbuster -> /usr/share/dirbuster/wordlists
lrwxrwxrwx   1 root root       41 May 30 17:27 fasttrack.txt -> /usr/share/set/src/fasttrack/wordlist.txt
lrwxrwxrwx   1 root root       45 May 30 17:27 fern-wifi -> /usr/share/fern-wifi-cracker/extras/wordlists
lrwxrwxrwx   1 root root       46 May 30 17:27 metasploit -> /usr/share/metasploit-framework/data/wordlists
lrwxrwxrwx   1 root root       41 May 30 17:27 nmap.lst -> /usr/share/nmap/nselib/data/passwords.lst
-rw-r--r--   1 root root 53357329 Jul 17  2019 rockyou.txt.gz
lrwxrwxrwx   1 root root       25 May 30 17:27 wfuzz -> /usr/share/wfuzz/wordlist

有了wordlists这个捷径工具,就不用特别记各个工具的字典档位置了


工具介绍 (CeWL)

CeWL是一个密码字典生成器,用爬虫方式将网站出现的单字列出来并可输出成档案供其他工具如john来当密码档使用,简单的用法如下
-d指定深度,预设为2
-m可以限制单字的最小长度,所以这边长度至少要到8才会被列出
-w是将单字输出至指定档案
-e是指定爬虫过程也处理email,搭配--email_file将结果输出到档案
最後指定一个目标网站来进行蒐集

cewl -d 1 -m 8 -w /tmp/my.lst -e --email_file /tmp/email.lst https://digi.ninja/

字典档产生的结果/tmp/my.lst节录如下,而/tmp/email.lst里则记录着email

ADDITIONAL
upgraded
normally
restarted
instance
expecting
disaster
disconnected
workstation
literally
affected

看到这结果,有种不是在产生密码字典档的感觉,反而比较像英文单字库...,当然这是因为目标网站内容导致的,如果目标网站有着使用者清单,或是乾脆就有使用者资讯,透过这个工具还是挺方便可以产生需要的资料结果。

CeWL还有其他用法,像是可以计算网页单字的数量

cewl https://digi.ninja/ -c

结果如下,统计次数越高越不会考

CeWL 5.4.8 (Inclusion) Robin Wood ([email protected]) (https://digi.ninja/)
the, 4138 
and, 1894
you, 1107
with, 923
this, 829
for, 739
that, 732
Share, 730

工具介绍 (Crunch)

接下来介绍另一个工具Crunch,跟前面用爬虫去捞现成单字的做法不同,使用列举方式,真正的无中生有去产生密码字典,简单的用法就是指定最小及最大的长度,例如想要产生6-8长度的字串,可以这样做

crunch 6 8

产生的结果如下

abhdab
abhdac
abhdad
abhdae
abhdaf

而进阶的用法chunch -h并没有多着墨,因此需要透过man chunch来了解其他用法

  1. 产出全由数字组成的4-6长度的字串
cruch 4 6 0123456789

结果节录如下

43204
43205
43206
43207
43208
  1. -t指定pattern
  • @: will insert lower case characters
  • ,: will insert upper case characters
  • %: will insert numbers
  • ^: will insert symbols
    使用方式
crunch 8 8 -t abcd,@%^

结果如下

abcdFr9|
abcdFr9\
abcdFr9:
abcdFr9;
abcdFr9"
abcdFr9'
abcdFr9<
  1. 组合生成
    -p指定组合方式
crunch 1 10 -p abc 123 XYZ            
Crunch will now generate the following number of lines: 6 
123XYZabc
123abcXYZ
XYZ123abc
XYZabc123
abc123XYZ
abcXYZ123

那今天就先介绍到这边,大家晚安~


<<:  DAY24:模型训练ResNet152

>>:  Day25 工具介绍:Bootstrap(一)

05 竞赛程序经验谈

我第一次听过程序竞赛时是在我刚进到国三的下学期。 在这之前我对於程序的相关经验除了国中科展学的 PH...

[DAY 01] 线上测验的难点与可能降低作弊的方法

因为疫情的关系,学校从5月中旬就开始了远(ㄕㄨˇ)距(ㄐㄧㄚˋ) 各级学校除了最开始的设备、网路问题...

食谱系统制作_下

制作目标 完成系统 发现问题 Icebear将readline的终止程序放在回圈以前,造成输入料理名...

视觉化KBARS(2)-python api

上篇大概介绍一下我们所运用的js与方法, 今天我们要先来写python api的部分。 (1)首先新...

Data layer implementation (1)

在上一篇,我们把 Ktor client 加到 Dagger 的 object graph 内。现在...