Kail Linux渗透测试教程之Recon-NG框架

本文章介绍了KailLinux环境下利用Recon-NG框架进行网络信息收集的过程,包括框架的基本信息、使用方法、模块功能及实际应用案例。详细阐述了如何通过Recon-NG框架的侦查模块进行子域枚举、配置选项参数、启动信息收集,并最终生成报告。同时,文章还介绍了Dmitry命令用于查询网站信息的方法。

Kail Linux渗透测试教程之Recon-NG框架

信息收集

信息收集是网络攻击最重要的阶段之一。要想进行渗透攻击,就需要收集目标的各类信息。收集到的信息越多,攻击成功的概率也就越大。本章将介绍信息收集的相关工具。

Recon-NG框架

Recon-NG是由python编写的一个开源的Web侦查(信息收集)框架。Recon-ng框架是一个强大的工具,使用它可以自动的收集信息和网络侦查。下面将介绍使用Recon-NG侦查工具。

启动Recon-NG框架,执行命令如下所示:

 

  • root@kali:~# recon-ng
  •                                                                                         
  •     _/_/_/    _/_/_/_/    _/_/_/    _/_/_/    _/      _/            _/      _/    _/_/_/
  •    _/    _/  _/        _/        _/      _/  _/_/    _/            _/_/    _/  _/      
  •   _/_/_/    _/_/_/    _/        _/      _/  _/  _/  _/  _/_/_/_/  _/  _/  _/  _/  _/_/_/
  •  _/    _/  _/        _/        _/      _/  _/    _/_/            _/    _/_/  _/      _/
  • _/    _/  _/_/_/_/    _/_/_/    _/_/_/    _/      _/            _/      _/    _/_/_/   
  •                                                                                        
  •      +---------------------------------------------------------------------------+     
  •      |  _                     ___    _                        __                 |     
  •      | |_)| _  _|_  |_|.|| _   |  _ |_ _  _ _  _ _|_o _  _   (_  _  _    _o_|_   |     
  •      | |_)|(_|(_|\  | ||||_\  _|_| || (_)| |||(_| | |(_)| |  __)(/_(_|_|| | | \/ |     
  •      |                                                                        /  |     
  •      |              Consulting | Research | Development | Training               |     
  •      |                     http://www.blackhillsinfosec.com                      |     
  •      +---------------------------------------------------------------------------+     
  •                       [recon-ng v4.1.4, Tim Tomes (@LaNMaSteR53)]                      
  • [56] Recon modules
  • [5]  Reporting modules
  • [2]  Exploitation modules
  • [2]  Discovery modules
  • [1]  Import modules
  • [recon-ng][default] >

 

以上输出信息显示了Recon-NG框架的基本信息。例如在Recon-NG框架下,包括56个侦查模块、5个报告模块、2个渗透攻击模块、2个发现模块和1个导入模块。看到[recon-ng][default] >提示符,表示成功登录Recon-NG框架。现在,就可以在[recon-ng][default] >提示符后面执行各种操作命令了。

首次使用Recon-NG框架之前,可以使用help命令查看所有可执行的命令。如下所示:

 

  • [recon-ng][default] > help
  • Commands (type [help|?] <topic>):
  • ---------------------------------
  • add             Adds records to the database
  • back            Exits current prompt level
  • del             Deletes records from the database
  • exit            Exits current prompt level
  • help            Displays this menu
  • keys            Manages framework API keys
  • load            Loads specified module
  • pdb             Starts a Python Debugger session
  • query           Queries the database
  • record          Records commands to a resource file
  • reload          Reloads all modules
  • resource        Executes commands from a resource file
  • search          Searches available modules
  • set             Sets module options
  • shell           Executes shell commands
  • show            Shows various framework items
  • spool           Spools output to a file
  • unset           Unsets module options
  • use             Loads specified module
  • workspaces      Manages workspaces

 

以上输出信息显示了在Recon-NG框架中可运行的命令。该框架和Metasploit框架类似,同样也支持很多模块。此时,可以使用show modules命令查看所有有效的模块列表。执行命令如下所示:

 

  • [recon-ng][default] > show modules
  •   Discovery
  •   ---------
  •     discovery/info_disclosure/cache_snoop
  •     discovery/info_disclosure/interesting_files
  •   Exploitation
  •   ------------
  •     exploitation/injection/command_injector
  •     exploitation/injection/xpath_bruter
  •   Import
  •   ------
  •     import/csv_file
  •   Recon
  •   -----
  •     recon/companies-contacts/facebook
  •     recon/companies-contacts/jigsaw
  •     recon/companies-contacts/jigsaw/point_usage
  •     recon/companies-contacts/jigsaw/purchase_contact
  •     recon/companies-contacts/jigsaw/search_contacts
  •     recon/companies-contacts/linkedin_auth
  •     recon/contacts-contacts/mangle
  •     recon/contacts-contacts/namechk
  •     recon/contacts-contacts/rapportive
  •     recon/contacts-creds/haveibeenpwned
  • ……
  •     recon/hosts-hosts/bing_ip
  •     recon/hosts-hosts/ip_neighbor
  •     recon/hosts-hosts/ipinfodb
  •     recon/hosts-hosts/resolve
  •     recon/hosts-hosts/reverse_resolve
  •     recon/locations-locations/geocode
  •     recon/locations-locations/reverse_geocode
  •     recon/locations-pushpins/flickr
  •     recon/locations-pushpins/picasa
  •     recon/locations-pushpins/shodan
  •     recon/locations-pushpins/twitter
  •     recon/locations-pushpins/youtube
  •     recon/netblocks-hosts/reverse_resolve
  •     recon/netblocks-hosts/shodan_net
  •     recon/netblocks-ports/census_2012
  •   Reporting
  •   ---------
  •     reporting/csv
  •     reporting/html
  •     reporting/list
  •     reporting/pushpin
  •     reporting/xml
  •  [recon-ng][default] >

 

从输出的信息中,可以看到显示了五部分。每部分包括的模块数,在启动Recon-NG框架后可以看到。用户可以使用不同的模块,进行各种的信息收集。

【实例3-1】使用recon/domains-hosts/baidu_site模块,枚举baidu网站的子域。具体操作步骤如下所示:

(1)使用recon/domains-hosts/baidu_site模块。执行命令如下所示:

 

  • [recon-ng][default] > use recon/domains-hosts/baidu_site

 

(2)查看该模块下可配置选项参数。执行命令如下所示:

 

  • [recon-ng][default][baidu_site] > show options
  •   Name      Current Value       Req     Description
  •   --------------  ----------------------    ---------  --------------------------------------------------------
  •   SOURCE     default            yes      source of input (see 'show info' for details)
  • [recon-ng][default][baidu_site] >

 

从输出的信息中,可以看到有一个选项需要配置。

(3)配置SOURCE选项参数。执行命令如下所示:

 

  • [recon-ng][default][baidu_site] > set SOURCE baidu.com
  • SOURCE => baidu.com

 

从输出的信息中,可以看到SOURCE选项参数已经设置为baidu.com。

(4)启动信息收集。执行命令如下所示:

 

  • [recon-ng][default][baidu_site] > run
  • ---------
  • BAIDU.COM
  • ---------
  • [*] URL: http://www.baidu.com/s?pn=0&wd=site%3Abaidu.com
  • [*] map.baidu.com
  • [*] 123.baidu.com
  • [*] jingyan.baidu.com
  • [*] top.baidu.com
  • [*] www.baidu.com
  • [*] hi.baidu.com
  • [*] video.baidu.com
  • [*] pan.baidu.com
  • [*] zhidao.baidu.com
  • [*] Sleeping to avoid lockout...
  • -------
  • SUMMARY
  • -------
  • [*] 9 total (2 new) items found.

 

从输出的信息中,可以看到找到9个子域。枚举到的所有数据将被连接到Recon-NG放置的数据库中。这时候,用户可以创建一个报告查看被连接的数据。

【实例3-2】查看获取的数据。具体操作步骤如下所示:

(1)选择reporting/csv模块,执行命令如下所示:

 

  • [recon-ng][default] > use reporting/csv

 

(2)创建报告。执行命令如下所示:

 

  • [recon-ng][default][csv] > run
  • [*] 9 records added to '/root/.recon-ng/workspaces/default/results.csv'.

 

从输出的信息可以看到,枚举到的9个记录已被添加到/root/.recon-ng/workspaces/default/results.csv文件中。打开该文件,如图3.1所示。

 

 

图3.1  results.csv文件

(3)从该界面可以看到,枚举到的所有子域。

用户也可以使用Dmitry命令,查询关于网站的信息。下面将介绍Dmitry命令的使用。

查看Dmitry命令的帮助信息。执行命令如下所示:

 

  • root@kali:~# dmitry -h
  • Deepmagic Information Gathering Tool
  • "There be some deep magic going on"
  • dmitry: invalid option -- 'h'
  • Usage: dmitry [-winsepfb] [-t 0-9] [-o %host.txt] host
  •   -o  Save output to %host.txt or to file specified by -o file
  •   -i   Perform a whois lookup on the IP address of a host
  •   -w Perform a whois lookup on the domain name of a host
  •   -n  Retrieve Netcraft.com information on a host
  •   -s  Perform a search for possible subdomains
  •   -e  Perform a search for possible email addresses
  •   -p  Perform a TCP port scan on a host
  • * -f    Perform a TCP port scan on a host showing output reporting filtered ports
  • * -b   Read in the banner received from the scanned port
  • * -t 0-9 Set the TTL in seconds when scanning a TCP port ( Default 2 )
  • *Requires the -p flagged to be passed

 

以上信息显示了dmitry命令的语法格式和所有可用参数。下面使用dmitry命令的-s选项,查询合理的子域。执行命令如下所示:

 

  • root@kali:~# dmitry -s google.com
  • Deepmagic Information Gathering Tool
  • "There be some deep magic going on"
  • HostIP:173.194.127.71
  • HostName:google.com
  • Gathered Subdomain information for google.com
  • ---------------------------------
  • Searching Google.com:80...
  • HostName:www.google.com
  • HostIP:173.194.127.51
  • Searching Altavista.com:80...
  • Found 1 possible subdomain(s) for host google.com, Searched 0 pages containing 0 results
  • All scans completed, exiting

 

从输出的信息中,可以看到搜索到一个子域。该子域名为www.google.com,IP地址为173.194.127.51。该命令默认是从google.com网站搜索,如果不能连接google.com网站的话,执行以上命令将会出现Unable to connect: Socket Connect Error错误信息。

本文选自:Kail Linux渗透测试实训手册大学霸内部资料,转载请注明出处,尊重技术尊重IT人!

转载于:https://www.cnblogs.com/daxueba-ITdaren/p/4766446.html

第 1 章 Lin u x 安 全 渗 透 简 介 1.1 什 么 是 安 全 渗 透 1.2 安 全 渗 透 所 需 的 工 具 1.3 K ali Lin u x 简 介 1.4 安 装 K ali Lin u x 1.5 K ali更 新 与 升 级 1.6 基 本 设 置 第 2 章 配 置 K ali Lin u x 2.1 准 备 内 核 头 文 件 2.2 安 装 并 配 置 N VIDIA 显 卡 驱 动 2.3 应 用 更 新 和 配 置 额 外 安 全 工 具 2.4 设 置 P r o x y C h ain s 2.5 目 录 加 密 第 3 章 高 级 测 试 实 验 室 3.1 使 用 V M w a r e W o r k s t a tio n 3.2 攻 击 W o r d P r e s s 和 其 他 应 用 程 序 第 4 章 信 息 收 集 4.1 枚 举 服 务 4.2 测 试 网 络 范 围 4.3 识 别 活 跃 的 主 机 4.4 查 看 打 开 的 端 口 4.5 系 统 指 纹 识 别 4.6 服 务 的 指 纹 识 别 4.7 其 他 信 息 收 集 手 段 4.8 使 用 M alt e g o 收 集 信 息 4.9 绘 制 网 络 结 构 图 第 5 章 漏 洞 扫 描 5.1 使 用 N e s s u s 5.2 使 用 O p e n VA S 第 6 章 漏 洞 利 用 6.1 M e t a s ploit a ble 操 作 系 统 6.2 M e t a s ploit 基 础 6.3 控 制 M e t e r p r e t e r 6.4 渗 透 攻 击 应 用 大 学 霸 K ali Lin u x 安 全 渗 透 教 程 2 6.5 7 7.1 7.2 7.3 7.4 8 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 6.5 免杀Payload生成工具Veil 第7章 权限提升 7.1 使用假冒令牌 7.2 本地权限提升 7.3 使用社会工程学工具包(SET) 7.4 使用SET实施攻击 第8章 密码攻击 8.1 密码在线破解 8.2 分析密码 8.3 破解LM Hashes密码 8.4 绕过Utilman登录 8.5 破解纯文本密码工具mimikatz 8.6 破解操作系统用户密码 8.7 创建密码字典 8.8 使用NVIDIA计算机统一设备架构(CUDA) 8.9 物理访问攻击 第9章 无线网络渗透测试 9.1 无线网络嗅探工具Kismet 9.2 使用Aircrack-ng工具破解无线网络 9.3 Gerix Wifi Cracker破解无线网络 9.4 使用Wifite破解无线网络 9.5 使用Easy-Creds工具攻击无线网络 9.6 在树莓派上破解无线网络 9.7 攻击路由器 9.8 Arpspoof工具
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值