Last active
September 15, 2021 06:10
-
-
Save itsecurityco/0d97f139643c173a531031f001333219 to your computer and use it in GitHub Desktop.
Metasploit remote HTTP client template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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