yongz
发布于 2023-11-12 / 0 阅读
0

Cewl 工具简单使用

Cewl 工具简单使用

  • 最近在打 Vulnhub,需要使用到 Cewl 进行页面关键字爬取,记录一下。

  • 本篇文章参考:

1 工具介绍

  • Cewl(Custom Wordlist Generator)是一款用于生成自定义字典(wordlist)的工具。它可以分析文本、网页或其他文档,并提取其中的单词和短语,然后将它们组合成一个字典以供密码破解和渗透测试等用途使用。

  • Cewl 工具的主要功能如下:

    • 自定义字典生成:Cewl 可以基于指定的输入文本或网页源代码,提取其中的单词和短语,并将它们组合成一个自定义的字典。这个字典可以包含常见的单词、专业术语、组织名称、个人姓名等,从而增加密码破解和渗透测试的成功率。

    • 网页分析:Cewl 可以分析给定的网页或整个网站,并提取其中的文本内容。它会忽略 HTML 标签和其他非文本元素,仅关注实际的单词和短语。

    • 单词频率统计:Cewl 可以统计提取的单词和短语在源文本中出现的频率。这有助于确定哪些单词更常见,从而优化生成的字典的内容。

    • 忽略常见单词:Cewl 具有一个内置的常见单词列表,可以用于过滤掉常见的单词,从而生成更加精确和有针对性的字典。

2 工具安装

  • Cewl 是 Kali Linux 默认自带的一款漏洞扫描工具,由于 Kali 中自带了 Cewl,所以怎么安装就不讲了,直接说说怎么使用:

root at kali in ~/Desktop 
$ cewl                                                 
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)

Missing URL argument (try --help)

3 工具使用

3.1 常用参数

  • 使用 wpscan -h 查看参数用法:

root at kali in ~/Desktop 
$ cewl -h
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
Usage: cewl [OPTIONS] ... <url>

    OPTIONS:
        -h, --help: Show help.
        -k, --keep: Keep the downloaded file.
        -d <x>,--depth <x>: Depth to spider to, default 2.
        -m, --min_word_length: Minimum word length, default 3.
        -x, --max_word_length: Maximum word length, default unset.
        -o, --offsite: Let the spider visit other sites.
        --exclude: A file containing a list of paths to exclude
        --allowed: A regex pattern that path must match to be followed
        -w, --write: Write the output to the file.
        -u, --ua <agent>: User agent to send.
        -n, --no-words: Don't output the wordlist.
        -g <x>, --groups <x>: Return groups of words as well
        --lowercase: Lowercase all parsed words
        --with-numbers: Accept words with numbers in as well as just letters
        --convert-umlauts: Convert common ISO-8859-1 (Latin-1) umlauts (ä-ae, ö-oe, ü-ue, ß-ss)
        -a, --meta: include meta data.
        --meta_file file: Output file for meta data.
        -e, --email: Include email addresses.
        --email_file <file>: Output file for email addresses.
        --meta-temp-dir <dir>: The temporary directory used by exiftool when parsing files, default /tmp.
        -c, --count: Show the count for each word found.
        -v, --verbose: Verbose.
        --debug: Extra debug information.

        Authentication
        --auth_type: Digest or basic.
        --auth_user: Authentication username.
        --auth_pass: Authentication password.

        Proxy Support
        --proxy_host: Proxy host.
        --proxy_port: Proxy port, default 8080.
        --proxy_username: Username for proxy, if required.
        --proxy_password: Password for proxy, if required.

        Headers
        --header, -H: In format name:value - can pass multiple.

    <url>: The site to spider.
  • 参数说明如下:

参数名称

参数说明

-h

显示帮助信息

-k

保存下载的文件

-d

指定爬取的深度,默认为 2

-m

指定单词的最小长度,默认为 3

-x

指定单词的最大长度,默认未设置

-o

允许爬虫访问其他站点

–exclude

指定包含要排除的路径列表的文件

–allowed

指定要遵循的路径必须匹配的正则表达式模式

-w

将输出写入文件,也就是保存输出

-u

指定要发送的 ua 头部

-n

不输出单词列表

-g

返回单词的分组

–lowercase

将所有解析的单词转换为小写

–with-numbers

接受带有数字的单词,而不仅仅是字母

–convert-umlauts

将常见的 ISO-8859-1(Latin-1)umlauts(ä-ae,ö-oe,ü-ue,ß-ss)转换为对应的字符。

-a

包括元数据

–meta_file

元数据的输出文件

-e

包括电子邮件地址

–eamil_file

电子邮件地址的输出文件

–meta-temp-dir

exiftool 在解析文件时使用的临时目录,默认为 /tmp。

-c

显示每个单词的计数

-v

显示详细信息

–debug

显示额外的调试信息

–auth_type

指定身份验证类型,可以是 Digest 或 Basic

–auth_user

身份验证用户名

–auth_pass

身份验证密码

–proxy_host

代理主机

–proxy_port

代理端口,默认为 8080

–proxy_username

代理用户名(如果需要)

–proxy_password

代理密码(如果需要)

–header

以 name:value 的格式指定请求头,可以指定多个

url

要爬取的网站的 URL

3.2 使用示例

  • 这里以 VulnHub 靶机的 DC-2 为例。

3.2.1 默认使用

  • 生成一个单词列表,这些单词会将给定的 URL 爬行到指定的深度,我们可以将其用作破解密码的目录:

root at kali in ~/Desktop 
$ cewl http://dc-2       
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
sit
amet
nec
quis
vel
orci
site
non
sed
vitae
luctus
sem
Sed
leo
ante
content
nisi
Donec
turpis
Aenean
wrap
.......

3.2.2 输出单词表

  • 将所有单词列表保存在文件中,我们将使用 -w 选项将输出保存在文本文件中:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
sit
amet
nec
quis
vel
orci
site
non
sed
vitae

3.2.3 构造特定长单词表

  • 创建特定长度的词表,则可以选择使用选项 -m 并提供关键字的最小长度,因此它将创建一定长度的词表:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt -m 5 ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
vitae
luctus
content
Donec
turpis
Aenean
tincidunt
finibus
dictum
egestas

3.2.4 输出电子邮件

  • 从网站检索电子邮件,我们可以使用 -e 选项,而 -n 选项将隐藏在抓取提供的网站时创建的列表:

注:这个靶机没邮箱,扫自己吧。

root at kali in ~/Desktop 
$ cewl https://www.yongz.fun -e -n
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
Email addresses found
---------------------
123456@qq.com
1234@qq.com
FireFart@gmail.com
Root@Blackploit.com
admin@admin.com
admin@example.com
admin@localhost.com
admin@wordpress.org
bug-findutils@gnu.org
fred@example.org
git@xxx.xxx.xxx.xxx
mozilla@example.com
nick@nickbloor.co.uk
testuser@localhost.com
x@hdm.io

3.2.5 单词表计数

  • 要计算一个单词在网站上重复的次数,请使用 -c 选项来启用 count 参数:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt -m 5 -c ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
vitae, 25
luctus, 24
content, 22
Donec, 21
turpis, 21
Aenean, 21
tincidunt, 19
finibus, 19
dictum, 19
egestas, 19

3.2.6 指定深度

  • 可以将 -d 选项与深度编号一起使用来激活深度参数以进行更快速和更密集的爬网,从而创建大量单词。

  • 默认情况下,深度级别设置为 2:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt -d 3 ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
sit
amet
nec
quis
vel
orci
site
non
sed
vitae

3.2.7 详细模式

  • -v 选项来扩展网站爬取结果并检索网站的完整详细信息:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt -v ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
Starting at http://dc-2
Visiting: http://dc-2, got response code 200
Attribute text found:
DC-2 DC-2 » Feed DC-2 » Comments Feed RSD 

Visiting: http://dc-2/index.php/what-we-do/ referred from http://dc-2, got response code 200
Attribute text found:
DC-2 DC-2 » Feed DC-2 » Comments Feed RSD 

Visiting: http://dc-2/index.php/our-people/ referred from http://dc-2, got response code 200
Attribute text found:
DC-2 DC-2 » Feed DC-2 » Comments Feed RSD 

Visiting: http://dc-2/index.php/our-products/ referred from http://dc-2, got response code 200
Attribute text found:
DC-2 DC-2 » Feed DC-2 » Comments Feed RSD 

Visiting: http://dc-2/index.php/flag/ referred from http://dc-2, got response code 200
Attribute text found:
DC-2 DC-2 » Feed DC-2 » Comments Feed RSD 

Offsite link, not following: https://wordpress.org/
Offsite link, not following: https://wordpress.org/
Offsite link, not following: https://wordpress.org/
Offsite link, not following: https://wordpress.org/
Offsite link, not following: https://wordpress.org/
Writing words to file
sit
amet
nec
quis
vel
orci
site
non
sed
vitae

3.2.8 构建数字字母表

  • –with-numbers 选项来获取字母数字词表:

root at kali in ~/Desktop 
$ cewl http://dc-2 -w password.txt --with-numbers ; head -n 10 password.txt
CeWL 6.1 (Max Length) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
sit
amet
nec
quis
vel
orci
site
non
sed
vitae