Skip to content

Instantly share code, notes, and snippets.

@itsecurityco
Last active September 15, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsecurityco/0d97f139643c173a531031f001333219 to your computer and use it in GitHub Desktop.
Save itsecurityco/0d97f139643c173a531031f001333219 to your computer and use it in GitHub Desktop.
Metasploit remote HTTP client template
# https://github.com/rapid7/metasploit-framework/wiki/How-to-Send-an-HTTP-Request-Using-HTTPClient
require 'msf/core'
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(
update_info(
info,
'Name' => 'HttpClient Example',
'Description' => %q{
Do a send_request_cgi()
},
'Author' => [ 'sinn3r' ],
'License' => MSF_LICENSE
)
)
register_options(
[
OptString.new('TARGETURI', [true, 'The base path', '/'])
]
)
end
def run
uri = target_uri.path
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri, 'admin', 'index.php'),
'vars_get' => {
'p1' => 'This is param 1',
'p2' => 'This is param 2'
}
})
if res && res.code == 200
print_good('I got a 200, awesome')
else
print_error('No 200, feeling blue')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment