【网络安全 | 指纹识别工具】WhatWeb使用详析

本文涉及的产品
云数据库 MongoDB,通用型 2核4GB
简介: 【网络安全 | 指纹识别工具】WhatWeb使用详析

前言

WhatWeb 是一款用于识别 Web 应用程序和 Web 服务器的开源工具。它可以识别网站使用的编程语言、Web 框架、Web 服务器软件、Web 应用程序等信息,从而帮助安全测试人员快速了解目标网站的技术特征,发现可能存在的漏洞。

本文将对 WhatWeb 的使用方法进行讲解


正文

Kali虚拟机自带whatweb工具,不需要安装、直接使用即可。

扫描网站指纹

  • 在终端或命令行中输入 whatweb 命令,加上要扫描的网站 URL 或 IP 地址,例如:whatweb example.com
  • WhatWeb 会自动识别目标网站的相关信息,并输出到终端或命令行中。
  • 可以使用 -v 参数来显示所有信息,例如:whatweb -v example.com

实例

whatweb www.alibaba.com

回显如下:

解释如下:

对于 http://www.alibaba.com:
    状态码(Status Code):301 Moved Permanently
    国家(Country):中国(CN)
    HTTP 服务器(HTTP Server):Tengine
    IP 地址(IP):59.82.122.231
    由 Tengine 提供支持(Powered By Tengine)
    重定向地址(Redirect Location):https://www.alibaba.com/
    Tengine Web 服务器
    页面标题(Title):301 Moved Permanently
    不常见的头部信息(Uncommon Headers):timing-allow-origin、eagleid、server-timing
对于 https://www.alibaba.com/:
    状态码(Status Code):200 OK
    Cookies:ali_apache_id、cna、ug_se_c
    国家(Country):中国(CN)
    使用 HTML5 技术
    HttpOnly:ug_se_c
    IP 地址(IP):59.82.122.231
    Open Graph Protocol:site(100002227819697, 124207444332529)
    脚本类型:application/ld+json、text/javascript
    严格传输安全性(Strict Transport Security):max-age=31536000
    页面标题(Title):Alibaba.com: Manufacturers, Suppliers, Exporters & Importers from the world's largest online B2B marketplace
    不常见的头部信息(Uncommon Headers):render-policy、x-content-type-options、timing-allow-origin、eagleid、server-timing
    X-Frame-Options:DENY
    X-XSS-Protection:1; mode=block

加上-v可以显示详细的输出信息:

whatweb -v www.alibaba.com

设置扫描强度

加上-a可以指定扫描等级,WhatWeb有3种扫描级别,通过数字1、3、4选择

如:

whatweb www.alibaba.com -a 3

  • 1表示发送1次http请求
  • 3表示发送少量http请求
  • 4表示发送大量http请求

扫描内网网段

命令行:

whatweb --no-errors -t 255 内网网段

批量扫描

扫描多个不同网站时,将要扫描网站的域名或IP保存到文件(如1.txt)中,再使用-i参数来连接该文件即可,如:

whatweb -i "root/1.txt"

常用命令

  • whatweb [URL]:扫描指定的 URL,输出识别结果。
  • whatweb -v [URL] :以详细模式扫描指定的 URL,显示更多信息。
  • whatweb [URL] -a "User-Agent":指定自定义的用户代理进行扫描。
  • whatweb [URL] -t 10:设置超时时间为 10 秒。
  • whatweb [URL] -x "/path/to/exclude":指定要排除的目录或文件。
  • whatweb [URL] -p 80,443:指定要扫描的端口号,多个端口使用逗号分隔。
  • whatweb -iL [file.txt]:从文件中读取多个 URL 进行扫描。
  • whatweb --color=never:禁用彩色输出。

编写插件

whatweb对国内的网站识别并不友好,我们可以自己写插件,兼容更多国内的网站。

whatweb的官方模板:

Plugin.define "Plugin-Template" do
    author "Enter Your Name"
    version "0.1"
    description "Describe what the plugin identifies. Include the homepage of the software package"
    examples %w| include-some.net example-websites.com here.com |
    \# a comment block here is a good place to make notes for yourself and others 
    \# There are four types of matches: regexp, text, ghdb 
    \# Matches are enclosed in {} brackets and separated by commas 
    matches [
    {:name=>"a brief description of the match, eg. powered by in footer",
    :certainty=>100, # 100 is certain, 75 is probably and 25 is maybe. if omitted, it defaults to 100. 
    :regexp=>/This page was generated by http://www.genericcms.com\/en\/products\/generic-cms\/">Generic CMS<\/a>/ },
    {:name=>"title",
    :certainty=>75,
    :text=>"<title>Generic Homepage</title>" }
    ]
    end

帮助

更多语法在帮助里可以找到,使用以下命令以获得帮助:

whatweb -h
WhatWeb - Next generation web scanner version 0.5.5.
Developed by Andrew Horton (urbanadventurer) and Brendan Coles (bcoles).
Homepage: https://www.morningstarsecurity.com/research/whatweb
Usage: whatweb [options] <URLs>
TARGET SELECTION:
  <TARGETs>                     Enter URLs, hostnames, IP addresses, filenames or
                                IP ranges in CIDR, x.x.x-x, or x.x.x.x-x.x.x.x
                                format.
  --input-file=FILE, -i         Read targets from a file. You can pipe
                                hostnames or URLs directly with -i /dev/stdin.
TARGET MODIFICATION:
  --url-prefix                  Add a prefix to target URLs.
  --url-suffix                  Add a suffix to target URLs.
  --url-pattern                 Insert the targets into a URL.
                                e.g. example.com/%insert%/robots.txt
AGGRESSION:
The aggression level controls the trade-off between speed/stealth and
reliability.
  --aggression, -a=LEVEL        Set the aggression level. Default: 1.
  1. Stealthy                   Makes one HTTP request per target and also
                                follows redirects.
  3. Aggressive                 If a level 1 plugin is matched, additional
                                requests will be made.
  4. Heavy                      Makes a lot of HTTP requests per target. URLs
                                from all plugins are attempted.
HTTP OPTIONS:
  --user-agent, -U=AGENT        Identify as AGENT instead of WhatWeb/0.5.5.
  --header, -H                  Add an HTTP header. eg "Foo:Bar". Specifying a
                                default header will replace it. Specifying an
                                empty value, e.g. "User-Agent:" will remove it.
  --follow-redirect=WHEN        Control when to follow redirects. WHEN may be
                                `never', `http-only', `meta-only', `same-site',
                                or `always'. Default: always.
  --max-redirects=NUM           Maximum number of redirects. Default: 10.
AUTHENTICATION:
  --user, -u=<user:password>    HTTP basic authentication.
  --cookie, -c=COOKIES          Use cookies, e.g. 'name=value; name2=value2'.
  --cookie-jar=FILE             Read cookies from a file.
PROXY:
  --proxy                       <hostname[:port]> Set proxy hostname and port.
                                Default: 8080.
  --proxy-user                  <username:password> Set proxy user and password.
PLUGINS:
  --list-plugins, -l            List all plugins.
  --info-plugins, -I=[SEARCH]   List all plugins with detailed information.
                                Optionally search with keywords in a comma
                                delimited list.
  --search-plugins=STRING       Search plugins for a keyword.
  --plugins, -p=LIST            Select plugins. LIST is a comma delimited set
                                of selected plugins. Default is all.
                                Each element can be a directory, file or plugin
                                name and can optionally have a modifier, +/-.
                                Examples: +/tmp/moo.rb,+/tmp/foo.rb
                                title,md5,+./plugins-disabled/
                                ./plugins-disabled,-md5
                                -p + is a shortcut for -p +plugins-disabled.
  --grep, -g=STRING|REGEXP      Search for STRING or a Regular Expression. Shows
                                only the results that match.
                                Examples: --grep "hello"
                                --grep "/he[l]*o/"
  --custom-plugin=DEFINITION    Define a custom plugin named Custom-Plugin,
                                Examples: ":text=>'powered by abc'"
                                ":version=>/powered[ ]?by ab[0-9]/"
                                ":ghdb=>'intitle:abc \"powered by abc\"'"
                                ":md5=>'8666257030b94d3bdb46e05945f60b42'"
                                "{:text=>'powered by abc'}"
  --dorks=PLUGIN                List Google dorks for the selected plugin.
OUTPUT:
  --verbose, -v                 Verbose output includes plugin descriptions.
                                Use twice for debugging.
  --colour,--color=WHEN         control whether colour is used. WHEN may be
                                `never', `always', or `auto'.
  --quiet, -q                   Do not display brief logging to STDOUT.
  --no-errors                   Suppress error messages.
LOGGING:
  --log-brief=FILE              Log brief, one-line output.
  --log-verbose=FILE            Log verbose output.
  --log-errors=FILE             Log errors.
  --log-xml=FILE                Log XML format.
  --log-json=FILE               Log JSON format.
  --log-sql=FILE                Log SQL INSERT statements.
  --log-sql-create=FILE         Create SQL database tables.
  --log-json-verbose=FILE       Log JSON Verbose format.
  --log-magictree=FILE          Log MagicTree XML format.
  --log-object=FILE             Log Ruby object inspection format.
  --log-mongo-database          Name of the MongoDB database.
  --log-mongo-collection        Name of the MongoDB collection.
                                Default: whatweb.
  --log-mongo-host              MongoDB hostname or IP address.
                                Default: 0.0.0.0.
  --log-mongo-username          MongoDB username. Default: nil.
  --log-mongo-password          MongoDB password. Default: nil.
  --log-elastic-index           Name of the index to store results. Default: whatweb
  --log-elastic-host            Host:port of the elastic http interface. Default: 127.0.0.1:9200
PERFORMANCE & STABILITY:
  --max-threads, -t             Number of simultaneous threads. Default: 25.
  --open-timeout                Time in seconds. Default: 15.
  --read-timeout                Time in seconds. Default: 30.
  --wait=SECONDS                Wait SECONDS between connections.
                                This is useful when using a single thread.
HELP & MISCELLANEOUS:
  --short-help                  Short usage help.
  --help, -h                    Complete usage help.
  --debug                       Raise errors in plugins.
  --version                     Display version information.
EXAMPLE USAGE:
* Scan example.com.
  ./whatweb example.com
* Scan reddit.com slashdot.org with verbose plugin descriptions.
  ./whatweb -v reddit.com slashdot.org
* An aggressive scan of wired.com detects the exact version of WordPress.
  ./whatweb -a 3 www.wired.com
* Scan the local network quickly and suppress errors.
  whatweb --no-errors 192.168.0.0/24
* Scan the local network for https websites.
  whatweb --no-errors --url-prefix https:// 192.168.0.0/24
* Scan for crossdomain policies in the Alexa Top 1000.
  ./whatweb -i plugin-development/alexa-top-100.txt \
  --url-suffix /crossdomain.xml -p crossdomain_xml
  • TARGET SELECTION: 设置目标选择,可以输入URL、主机名、IP地址、文件名或CIDR格式的IP范围。
  • TARGET MODIFICATION: 目标修改选项,可以添加URL前缀或后缀,也可以将目标插入到URL中的指定位置。
  • AGGRESSION: 设置扫描侵入性级别,控制速度、隐蔽性和可靠性之间的平衡。
  • HTTP OPTIONS: 设置HTTP选项,如自定义User-Agent、添加HTTP头、控制重定向行为等。
  • AUTHENTICATION: 设置HTTP基本身份验证和cookie。
  • PROXY: 设置代理服务器,包括主机名、端口和身份验证信息。
  • PLUGINS: 插件相关选项,如列出插件、查看插件信息、搜索插件、选择插件等。
  • OUTPUT: 设置输出选项,如详细与简要输出、是否使用颜色、日志记录等。
  • LOGGING: 设置日志记录选项,包括日志文件格式和存储位置。
  • PERFORMANCE & STABILITY: 设置性能和稳定性选项,如线程数、连接超时时间等。
  • HELP & MISCELLANEOUS: 帮助和其他杂项选项,如显示帮助信息、调试模式、显示版本号等。
  • EXAMPLE USAGE: 示例用法,演示了几个常见的命令用法和参数组合。
相关实践学习
MongoDB数据库入门
MongoDB数据库入门实验。
快速掌握 MongoDB 数据库
本课程主要讲解MongoDB数据库的基本知识,包括MongoDB数据库的安装、配置、服务的启动、数据的CRUD操作函数使用、MongoDB索引的使用(唯一索引、地理索引、过期索引、全文索引等)、MapReduce操作实现、用户管理、Java对MongoDB的操作支持(基于2.x驱动与3.x驱动的完全讲解)。 通过学习此课程,读者将具备MongoDB数据库的开发能力,并且能够使用MongoDB进行项目开发。 &nbsp; 相关的阿里云产品:云数据库 MongoDB版 云数据库MongoDB版支持ReplicaSet和Sharding两种部署架构,具备安全审计,时间点备份等多项企业能力。在互联网、物联网、游戏、金融等领域被广泛采用。 云数据库MongoDB版(ApsaraDB for MongoDB)完全兼容MongoDB协议,基于飞天分布式系统和高可靠存储引擎,提供多节点高可用架构、弹性扩容、容灾、备份回滚、性能优化等解决方案。 产品详情: https://www.aliyun.com/product/mongodb
目录
相关文章
|
5天前
|
JavaScript 前端开发 网络安全
【网络安全 | 信息收集】JS文件信息收集工具LinkFinder安装使用教程
【网络安全 | 信息收集】JS文件信息收集工具LinkFinder安装使用教程
16 4
|
5天前
|
JavaScript 前端开发 UED
在 JavaScript 中,异步编程和回调函数是处理非阻塞操作(如网络请求、文件读写等)的重要工具
【5月更文挑战第10天】JavaScript中的异步编程和回调函数用于处理非阻塞操作,提高应用响应性和吞吐量。异步编程通过回调函数、Promises和async/await等方式实现,避免程序因等待操作完成而阻塞。回调函数是异步操作完成后调用的函数,常用于处理网络请求等。然而,回调函数存在嵌套问题和错误处理困难,因此出现了Promises和async/await等更优解决方案。
13 3
|
5天前
|
弹性计算 运维 Shell
自动化网络扫描工具发现活跃主机
【4月更文挑战第30天】
10 0
|
5天前
|
负载均衡 网络协议 应用服务中间件
【亮剑】在Linux中构建高可用性和高性能网络服务的负载均衡工具HAProxy、Nginx和Keepalived。
【4月更文挑战第30天】本文介绍了在Linux中构建高可用性和高性能网络服务的负载均衡工具HAProxy、Nginx和Keepalived。HAProxy是一个高性能的开源TCP和HTTP负载均衡器,适合处理大量并发连接;Nginx是一个多功能Web服务器和反向代理,支持HTTP、HTTPS和TCP负载均衡,同时提供缓存和SSL功能;Keepalived用于监控和故障切换,通过VRRP实现IP热备份,保证服务连续性。文中详细阐述了如何配置这三个工具实现负载均衡,包括安装、配置文件修改和启动服务,为构建可靠的负载均衡系统提供了指导。
|
5天前
|
安全 Linux 网络安全
【专栏】Linux 网络扫描工具:一起开始nmap的探索之旅吧!
【4月更文挑战第28天】nmap, 开源网络扫描工具,用于探测主机、网络信息,包括开放端口、服务类型、OS等。本文分三部分介绍:1) nmap简介与基本原理;2) 使用方法和高级技巧,如脚本扩展;3) 实际应用,如网络安全评估、系统管理和渗透测试。学习nmap需注意合规性,持续探索新技巧,以提升网络管理与安全能力。一起开始nmap的探索之旅吧!
|
5天前
|
监控 安全 Linux
【专栏】在网络安全至关重要的今天,Linux系统中的SCP和SFTP成为安全文件传输的首选工具
【4月更文挑战第28天】在网络安全至关重要的今天,Linux系统中的SCP和SFTP成为安全文件传输的首选工具。SCP,一个基于SSH的轻量级工具,允许用户方便地在本地和远程主机间复制文件。要使用SCP,首先确保安装了OpenSSH,然后通过基本命令进行文件传输,如`scp source destination`。SFTP则提供了一个类似FTP的界面,通过`sftp`命令启动客户端,进行直观的文件操作。两者均基于SSH协议,保证数据加密。为确保安全,建议使用强密码、密钥对、禁用根用户直接登录,并配置防火墙及监控日志。了解和掌握这些工具能提升工作效率并保护数据安全。
|
5天前
|
安全 网络安全 网络虚拟化
《计算机网络简易速速上手小册》第3章:计算机网络设备和工具(2024 最新版)
《计算机网络简易速速上手小册》第3章:计算机网络设备和工具(2024 最新版)
40 1
|
5天前
|
JSON 网络协议 测试技术
【软件工具】网络性能测试工具 Iperf
【软件工具】网络性能测试工具 Iperf
|
5天前
|
SQL 运维 监控
什么是Web应用程序防火墙,WAF与其他网络安全工具差异在哪?
总之,WAF是一种专门用于保护Web应用程序的网络安全工具,与其他网络安全工具在焦点、层级、检测方式、部署位置和针对性等方面存在差异,以确保Web应用程序的安全运行。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
125 0