add a flush option to portfwd. thanks ipax for the patch!

git-svn-id: file:///home/svn/framework3/trunk@13359 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2011-07-27 04:59:06 +00:00
parent 41f72deee2
commit aa2c025ce1
1 changed files with 18 additions and 1 deletions

View File

@ -263,13 +263,30 @@ class Console::CommandDispatcher::Stdapi::Net
print_error("Failed to stop TCP relay on #{lhost || '0.0.0.0'}:#{lport}") print_error("Failed to stop TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
end end
when "flush"
counter = 0
service.each_tcp_relay do |lhost, lport, rhost, rport, opts|
next if (opts['MeterpreterRelay'] == nil)
if (service.stop_tcp_relay(lport, lhost))
print_status("Successfully stopped TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
else
print_error("Failed to stop TCP relay on #{lhost || '0.0.0.0'}:#{lport}")
next
end
counter += 1
end
print_status("Successfully flushed #{counter} rules")
else else
cmd_portfwd_help cmd_portfwd_help
end end
end end
def cmd_portfwd_help def cmd_portfwd_help
print_line "Usage: portfwd [-h] [add / delete / list] [args]" print_line "Usage: portfwd [-h] [add | delete | list | flush] [args]"
print_line print_line
print @@portfwd_opts.usage print @@portfwd_opts.usage
end end