一、msf简单使用命令
二、msf架构图
三、tomcat_mgr_login.rb模块注释
一、msf简单使用命令
# 在下载metasploit工具后,就可以在终端输入以下命令行打开msf
# 连接并且初始化postgresql,可以使用工作区保存扫描到的数据并且输出为指定格式
root@kali:~# service postgresql start
root@kali:~# postgresql enable
root@kali:~# msfconsole
# 搜索指定的漏洞模块,例如tomcat服务器的登录模块,
# 会显示匹配的结果位于扫描器(scanner)目录下的http子目录下
msf6> search login tomcat
# 显示需要补充的靶机或者攻击机信息
msf6> show options
# 设置靶机信息并且运行,之后会显示爆破结果
msf6> auxiliary(scanner/http/tomcat_mgr_login.rb) >set RHOSTS IP
msf6> auxiliary(scanner/http/tomcat_mgr_login.rb) >run
二、msf架构图
官网的架构图如下所示
Metasploit内包含了六大模块,分别是:Auxiliary、exploits、payload、Post、encoders、nops,可以通过命令行查看
root@kali:~# ls /usr/share/metasploit-framework/modules/
auxiliary encoders exploits nops payloads post
# tomcat_mgr_login.rb位置为/modules/auxiliary/scanner/http/
根据官网的定义,模块定义如下
Auxiliary:辅助模块,利用发现的安全漏洞或配置到的弱点对远程目标系统进行攻击,从而获得远程目标系统的访问权限的代码组件。
payload:攻击载荷模块,攻击成功后促使靶机运行的一段植入代码。
Post:后渗透攻击模块,收集更多信息或进一步访问被利用的目标系统。
encoders:编码模块,将攻击载荷进行编码,绕过防护软件拦截。
三、tomcat_mgr_login.rb模块注释
# 使用前提:下载metasploit工具
# This module requires Metasploit: https://metasploit.com/download
# 国内源代码地址:https://gitee.com/geek-educator/metasploit-framework
# 导入已定义模块:登录认证消息合集和tomcat登录扫描模块
# require类似于python的import和C++的include
require 'metasploit/framework/credential_collection'
require 'metasploit/framework/login_scanner/tomcat'
# ruby是面向对象编程的语言
# 关键字class定义类,函数被称为方法,
# 类的每个方法以关键字def开始,后跟方法名
# include将会把模块里的方法包含进被执行的类的实例方法中。
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::AuthBrute
include Msf::Auxiliary::Scanner
def initialize
super(