本节书摘来自异步社区《Nmap渗透测试指南》一书中的第7章7.13节HTTP信息搜集,作者 商广明,更多章节内容可以访问云栖社区“异步社区”公众号查看。
7.13 HTTP信息搜集表7.13所示为本章节所需Nmap命令表,表中加粗命令为本小节所需命令——HTTP信息搜集。
HTTP版本探测使用Nmap可以扫描HTTP的版本,从而得知当前版本的漏洞,例如,Apache、IIS7、Nginx的畸形漏洞在相应的低版本中都会存在,使用Nmap可以非常简单地发现这些漏洞。
操作步骤使用-sV选项即可对HTTP版本进行探测。
root@Wing:~# nmap -sV -p 80 www.0day.com Starting Nmap 6.47 ( http://nmap.org ) at 2015-06-28 16:18 CST Nmap scan report for www.0day.co (210.209.122.120) Host is up (0.0065s latency). PORT STATE SERVICE VERSION 80/tcp open http ASERVER/1.2.9-3 Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 13.62 seconds root@Wing:~#分析从输出的信息得知HTTP版本为ASERVER/1.2.9-3。
HTTP头信息探测HTTP头是HTTP通信协议规定的请求和响应消息都支持的头域内容。
操作步骤使用命令“nmap -p 80 --script=http-headers 目标地址”即可对目标地址进行HTTP头信息探测。
root@Wing:~# nmap -p 80 --script=http-headers baidu.com Starting Nmap 6.47 ( http://nmap.org ) at 2015-06-28 16:23 CST Nmap scan report for baidu.com (180.149.132.47) Host is up (0.031s latency). Other addresses for baidu.com (not scanned): 220.181.57.217 123.125.114.144 PORT STATE SERVICE 80/tcp open http | http-headers: | Date: Sun, 28 Jun 2015 08:23:50 GMT | Server: Apache | Cache-Control: max-age=86400 | Expires: Mon, 29 Jun 2015 08:23:50 GMT | Last-Modified: Tue, 12 Jan 2010 13:48:00 GMT | ETag: "51-4b4c7d90" | Accept-Ranges: bytes | Content-Length: 81 | Connection: Close | Content-Type: text/html | |_ (Request type: HEAD) Nmap done: 1 IP address (1 host up) scanned in 0.59 seconds root@Wing:~# 分析 从以上输出的结果可以得知服务器时间为Sun, 28 Jun 2015 08:23:50 GMT,服务器HTTP程序为Apache、接受范围、内容长度、连接状态,内容类型为text/html。 HTTP目录结构探测 掌握目标网站的目录结构是信息搜集中尤为重要的一步,通过Nmap的http-sitemap- generator脚本可以快速获取到信息。 操作步骤 使用命令“nmap -p 80 --script=http-sitemap-generator 目标地址”即可爬行Web目录结构。 root@Wing:~# nmap -p 80 --script=http-sitemap-generator www.baidu.com Starting Nmap 6.47 ( http://nmap.org ) at 2015-06-28 16:28 CST Nmap scan report for www.baidu.com (61.135.169.125) Host is up (0.0031s latency). Other addresses for www.baidu.com (not scanned): 61.135.169.121 PORT STATE SERVICE 80/tcp open http | http-sitemap-generator: | Directory structure: | / | Other: 3; ico: 1 | /cache/sethelp/ | Other: 1; html: 1 | /cache/sethelp/img/ | png: 3 | /duty/ | Other: 1 | /gaoji/ | html: 1 | /img/ | gif: 1; png: 1; svg: 1 | /js/ | js: 1 | /more/ | Other: 1 | /search/ | html: 1 | Longest directory structure: | Depth: 3 | Dir: /cache/sethelp/img/ | Total files found (by extension): |_ Other: 6; gif: 1; html: 3; ico: 1; js: 1; png: 4; svg: 1 Nmap done: 1 IP address (1 host up) scanned in 1.89 seconds root@Wing:~#分析从以上输出的结果可以得知网站的目录结构,可以看到目录下包含的文件有多,Nmap对其都有很详细的统计。
相关资源:Nmap渗透测试指南.pdf