Bail early if we receive an unexpected response.
parent
4ee7bdee6c
commit
ef8601aa71
|
@ -78,7 +78,7 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
|
||||
def execute_command(cmd, opts = {})
|
||||
uri = target_uri.path
|
||||
service_name = Rex::Text.rand_text_alpha(5)
|
||||
service_name = Rex::Text.rand_text_alpha(5..10)
|
||||
print_status("Creating service '#{service_name}'")
|
||||
|
||||
# NOTE: Timeout defines how much time the check script will run until
|
||||
|
@ -102,9 +102,10 @@ class MetasploitModule < Msf::Exploit::Remote
|
|||
}
|
||||
}.to_json
|
||||
})
|
||||
if res and res.code == 200
|
||||
print_status("Service '#{service_name}' successfully created.")
|
||||
unless res && res.code == 200
|
||||
fail_with(Failure::UnexpectedReply, 'An error occured when contacting the Consul API.')
|
||||
end
|
||||
print_status("Service '#{service_name}' successfully created.")
|
||||
print_status("Waiting for service '#{service_name}' script to trigger")
|
||||
sleep(12)
|
||||
print_status("Removing service '#{service_name}'")
|
||||
|
|
Loading…
Reference in New Issue