前言
metasploit架构
Metasploit Mixins and 插件Plugins
快速转向ruby
·每个类只有唯一父类
·一个类可能包括一些模块
·模块可以添加新方法method
·模块可以重载旧方法
·metasploit模块继承自Msf::Module,包括了mixins来添加新功能
metasploit mixins
Mixins 很简单,这就是为什么ruby流行的原因
·mixins包括一个类到另一个类
·这与继承不同,但是又与继承相似
·Mixins可以覆盖类的方法
Mixins可以添加新功能,并允许模块具有不同的“flavor”。
·特定的协议(http,smb)
·特定的行为(暴力)
·connect()由TCP minin实行
·connect()之后可以被ftp、smb及其他服务重载
mixins可以改变behavior
·扫描器scanner mixin重载了run()
·扫描器修改了run_hosts()和run_range()中的run()
·它根据threads设置,并行调用他们
·与暴力BruteForce类似
Metasploit 插件
插件直接与API一起使用
·将框架作为一个整体使用
·插件能hook到事件子系统中去
·它们可以自动执行手动执行繁琐的特定任务
插件仅适用于msfconsole
·插件可以添加新的控制台命令
·它们扩展了整个Framework功能
class MyParent
def woof
puts “woof!”
end
end
class MyClass > MyParent
end
object = MyClass.new
object.woof() => “woof!”
================================================================
module MyMixin
def woof
puts “hijacked the woof method!”
end
end
class MyBetterClass > MyClass
include MyMixin
end