Use fail_with rather than fail

bug/bundler_fix
Jon Hart 2014-12-23 08:20:03 -08:00
parent 015b96a24a
commit bd3dc8a5e7
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
1 changed files with 15 additions and 7 deletions

View File

@ -67,7 +67,7 @@ class Metasploit4 < Msf::Exploit::Remote
{
'PayloadType' => 'cmd cmd_bash',
'RequiredCmd' => 'generic bash-tcp perl bash'
},
}
}
}
],
@ -103,7 +103,7 @@ class Metasploit4 < Msf::Exploit::Remote
mercurial: { files: {}, trigger: nil }
}
if git_uri.blank? && mercurial_uri.blank?
fail ArgumentError, 'Must specify at least one non-blank GIT_URI or MERCURIAL_URI'
fail_with(Exploit::Failure::BadConfig, 'Must specify at least one non-blank GIT_URI or MERCURIAL_URI')
end
setup_git unless git_uri.blank?
setup_mercurial unless mercurial_uri.blank?
@ -113,9 +113,13 @@ class Metasploit4 < Msf::Exploit::Remote
def setup_git
# URI must start with a /
fail ArgumentError, 'GIT_URI must start with a /' unless git_uri =~ /^\//
unless git_uri =~ /^\//
fail_with(Exploit::Failure::BadConfig, 'GIT_URI must start with a /')
end
# sanity check the malicious hook:
fail ArgumentError, 'GIT_HOOK must not be blank' if datastore['GIT_HOOK'].blank?
if datastore['GIT_HOOK'].blank?
fail_with(Exploit::Failure::BadConfig, 'GIT_HOOK must not be blank')
end
# This builds a fake git repository using the knowledge from:
# http://schacon.github.io/gitbook/7_how_git_stores_objects.html
@ -191,9 +195,13 @@ class Metasploit4 < Msf::Exploit::Remote
def setup_mercurial
# URI must start with a /
fail ArgumentError, 'MERCURIAL_URI must start with a /' unless mercurial_uri =~ /^\//
# sanity check the malicious hook:
fail ArgumentError, 'MERCURIAL_HOOK must not be blank' if datastore['MERCURIAL_HOOK'].blank?
unless mercurial_uri =~ /^\//
fail_with(Exploit::Failure::BadConfig, 'MERCURIAL_URI must start with a /')
end
# sanity check the malicious hook
if datastore['MERCURIAL_HOOK'].blank?
fail_with(Exploit::Failure::BadConfig, 'MERCURIAL_HOOK must not be blank')
end
# we fake the Mercurial HTTP protocol such that we are compliant as possible but
# also as simple as possible so that we don't have to support all of the protocol
# complexities. Taken from: