Review set_dmz

bug/bundler_fix
jvazquez-r7 2015-08-28 10:43:09 -05:00
parent 0e810aa8bc
commit 4523608bf7
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
1 changed files with 15 additions and 20 deletions

View File

@ -9,38 +9,33 @@ class Metasploit3 < Msf::Post
def initialize def initialize
super( super(
'Name' => 'BusyBox Set Dmz', 'Name' => 'BusyBox DMZ Configuration',
'Description' => 'This module will be applied on a session connected 'Description' => %q{
to a BusyBox sh shell. The script will enable or disable dmz This module will be applied on a session connected to a BusyBox shell. It allows to manage
to a network host in the router or device executing BusyBox.', traffic forwarding to a target host through the BusyBox device.
},
'Author' => 'Javier Vicente Vallejo', 'Author' => 'Javier Vicente Vallejo',
'License' => MSF_LICENSE, 'License' => MSF_LICENSE,
'References' =>
[
[ 'URL', 'http://vallejo.cc']
],
'Platform' => ['linux'], 'Platform' => ['linux'],
'SessionTypes' => ['shell'] 'SessionTypes' => ['shell']
) )
register_options([ register_options([
OptAddress.new('TARGETHOST', [ true, "The address of the host to be target for the dmz", nil ]), OptAddress.new('TARGET_HOST', [ true, 'The address of the target host']),
OptBool.new('DELETE', [false, "If this option is set to true, the DMZ is removed. Else it is added.", false]) OptBool.new('DELETE', [true, 'Remove host from the DMZ, otherwise will add it', false])
], self.class) ], self.class)
end end
def run def run
if datastore['DELETE'] == true if datastore['DELETE']
vprint_status("Executing iptables to delete dmz.") print_status("Deleting #{datastore['TARGET_HOST']} from DMZ")
vprint_status(cmd_exec("iptables -D FORWARD -d #{datastore['TARGETHOST']} -j ACCEPT")) vprint_status(cmd_exec("iptables -D FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))
else else
vprint_status("Executing iptables to add dmz.") print_status("Adding #{datastore['TARGET_HOST']} to DMZ")
vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGETHOST']} -j ACCEPT")) vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))
end end
if datastore['VERBOSE']
vprint_status(cmd_exec("iptables --list")) vprint_status(cmd_exec('iptables --list'))
end
print_good("Dmz modified. Enable verbose for additional information.")
end end
end end