metasploit-framework/modules/auxiliary/scanner/http/joomla_version.rb

73 lines
1.8 KiB
Ruby
Raw Normal View History

2013-01-25 19:44:49 +00:00
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
2013-01-25 19:44:49 +00:00
##
2015-12-19 03:14:04 +00:00
2013-01-25 19:44:49 +00:00
require 'msf/core'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
2013-01-25 19:44:49 +00:00
2015-12-19 03:14:04 +00:00
include Msf::Exploit::Remote::HTTP::Joomla
2013-08-30 21:28:54 +00:00
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
# Huge thanks to @zeroSteiner for helping me. Also thanks to @kaospunk. Finally thanks to
# Joomscan and various MSF modules for code examples.
def initialize
super(
'Name' => 'Joomla Version Scanner',
'Description' => %q{
This module scans a Joomla install for information about the underlying
operating system and Joomla version.
},
'Author' => [ 'newpid0' ],
'License' => MSF_LICENSE
)
end
2015-12-19 03:14:04 +00:00
def get_server_header
# This module used to determine the operating system by the server header. But this is
# not an accurate way to do OS detection, so we have toned it down to just returning the
# header, and let the user decide.
2013-08-30 21:28:54 +00:00
res = send_request_cgi({
2015-12-19 03:14:04 +00:00
'uri' => normalize_uri(target_uri.path)
2013-08-30 21:28:54 +00:00
})
2015-12-19 03:14:04 +00:00
if res && res.headers['Server']
return res.headers['Server']
2013-08-30 21:28:54 +00:00
end
2015-12-19 03:14:04 +00:00
nil
2013-08-30 21:28:54 +00:00
end
def run_host(ip)
2015-12-19 03:14:04 +00:00
unless joomla_and_online?
print_error("It doesn't look like Joomla is up and running at #{target_uri.to_s}")
return
2013-08-30 21:28:54 +00:00
end
2015-12-19 03:14:04 +00:00
server = get_server_header
version = joomla_version
2013-08-30 21:28:54 +00:00
2015-12-19 03:14:04 +00:00
if server
print_status("Server: #{server}")
else
print_error("Unable to determine server.")
end
if version
print_status("Joomla version: #{version}")
report_note(
host: ip,
port: datastore['RPORT'],
proto: ssl ? 'https' : 'http',
ntype: 'joomla.version',
data: version
)
else
print_error("Unable to find Joomla version.")
2013-08-30 21:28:54 +00:00
end
end
2013-01-25 19:44:49 +00:00
end