A quick diversion into Ruby.
- Every Class only has one parent
- A class may include many Modules
- Modules can add new methods
- Modules can overload old methods
- Metasploit modules inherit Msf::Module and include mixins to add features.
Mixins are quite simply, the reason why Ruby rocks.
Mixins can add new features and allows modules to have different ‘flavors’.
Mixins can change behavior.
Plugins work directly with the API.
Plugins only work in the msfconsole.
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