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
super(
'Name' => 'BusyBox Set Dmz',
'Description' => 'This module will be applied on a session connected
to a BusyBox sh shell. The script will enable or disable dmz
to a network host in the router or device executing BusyBox.',
'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,
'References' =>
[
[ 'URL', 'http://vallejo.cc']
],
'Platform' => ['linux'],
'SessionTypes' => ['shell']
'SessionTypes' => ['shell']
)
register_options([
OptAddress.new('TARGETHOST', [ true, "The address of the host to be target for the dmz", nil ]),
OptBool.new('DELETE', [false, "If this option is set to true, the DMZ is removed. Else it is added.", false])
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'] == true
vprint_status("Executing iptables to delete dmz.")
vprint_status(cmd_exec("iptables -D FORWARD -d #{datastore['TARGETHOST']} -j ACCEPT"))
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
vprint_status("Executing iptables to add dmz.")
vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGETHOST']} -j ACCEPT"))
print_status("Adding #{datastore['TARGET_HOST']} to DMZ")
vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))
end
if datastore['VERBOSE']
vprint_status(cmd_exec("iptables --list"))
end
print_good("Dmz modified. Enable verbose for additional information.")
vprint_status(cmd_exec('iptables --list'))
end
end