John the Ripper 这个密码破解工具,应该是渗透测试工程师和黑客们最喜欢的一个了。它有很多功能,例如自动识别最常见的加密和哈希算法,可以使用字典,暴力破解攻击。它能让我们在字典里已有的词汇上外加规则,修改基础词汇,得到更加丰富的词汇集。这边文章里,我们将使用这个工具对上一节生成的简单的单词列表做一个扩展。
下面,我们使用上一篇文章中 CeWL 生成的单词列表,生成一个可能的密码字典。
实施步骤
首先,打开我们的漏洞靶机:Vulnerable_VM 【配置参见:测试环境搭建】
按照惯例,我们先看一下 John 的帮助信息:
root@kali:~# john --help
Created directory: /root/.john
John the Ripper password cracker, version 1.8.0.6-jumbo-1-bleeding [linux-x86-64-avx]
Copyright (c) 1996-2015 by Solar Designer and others
Homepage: http://www.openwall.com/john/
Usage: john [OPTIONS] [PASSWORD-FILES]
--single[=SECTION] "single crack" mode
--wordlist[=FILE] --stdin wordlist mode, read words from FILE or stdin
--pipe like --stdin, but bulk reads, and allows rules
--loopback[=FILE] like --wordlist, but fetch words from a .pot file
--dupe-suppression suppress all dupes in wordlist (and force preload)
--prince[=FILE] PRINCE mode, read words from FILE
--encoding=NAME input encoding (eg. UTF-8, ISO-8859-1). See also
doc/ENCODING and --list=hidden-options.
--rules[=SECTION] enable word mangling rules for wordlist modes
--incremental[=MODE] "incremental" mode [using section MODE]
--mask=MASK mask mode using MASK
--markov[=OPTIONS] "Markov" mode (see doc/MARKOV)
--external=MODE external mode or word filter
--stdout[=LENGTH] just output candidate passwords [cut at LENGTH]
--restore[=NAME] restore an interrupted session [called NAME]
--session=NAME give a new session the NAME
--status[=NAME] print status of a session [called NAME]
--make-charset=FILE make a charset file. It will be overwritten
--show[=LEFT] show cracked passwords [if =LEFT, then uncracked]
--test[=TIME] run tests and benchmarks for TIME seconds each
--users=[-]LOGIN|UID[,..] [do not] load this (these) user(s) only
--groups=[-]GID[,..] load users [not] of this (these) group(s) only
--shells=[-]SHELL[,..] load users with[out] this (these) shell(s) only
--salts=[-]COUNT[:MAX] load salts with[out] COUNT [to MAX] hashes
--save-memory=LEVEL enable memory saving, at LEVEL 1..3
--node=MIN[-MAX]/TOTAL this node's number range out of TOTAL count
--fork=N fork N processes
--pot=NAME pot file to use
--list=WHAT list capabilities, see --list=help or doc/OPTIONS
--format=NAME force hash of type NAME. The supported formats can
be seen with --list=formats and --list=subformats
输入下面的命令,打印原始字典内的单词:
root@kali:~# john --stdout --wordlist=cewl_WackoPicko.txt
WackoPicko
Users
person
unauthorized
Login
Guestbook
Admin
access
password
Upload
agree
Member
posted
personal
responsible
account
illegal
applications
Membership
profile
21p 0:00:00:00 100.00% (2016-07-20 22:28) 60.00p/s
下面我们添加 --rules 来生成一个更加完全的字典:
root@kali:~# john --stdout --wordlist=cewl_WackoPicko.txt --rules
WackoPicko
Users
person
unauthorized
. . .
. . .
. . .
Membershipping
Profiling
1000p 0:00:00:00 100.00% (2016-07-20 22:31) 12500p/s Profiling
下面,我们将生成的这1000个单词存放在文件里面,供后续使用:
root@kali:~# john --stdout --wordlist=cewl_WackoPicko.txt --rules > dict_WackoPicko.txt
Press 'q' or Ctrl-C to abort, almost any other key for status
1000p 0:00:00:00 100.00% (2016-07-20 22:38) 12500p/s Profiling
生成的这个新字典,在后面针对应用登陆页面的密码猜解攻击中会用到。
Ripper 的目标不是作为一个字典生成器使用,而是用已有的单词清单破解密码。Ripper 的特点,使得我们可以扩展已有的词汇清单,使其贴近高级用户使用的密码。
这里我们使用默认规格,John 的规则在配置文件里面定义好了,配置文件地址是:/etc/john/john.conf 。
更多关于 创建和修改规则的信息参见:
http://www.openwall.com/john/doc/RULES.shtml