2014-11-12 21:32:56 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex/proto/quake'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
|
|
|
include Rex::Proto::Quake
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(
|
|
|
|
update_info(
|
|
|
|
info,
|
2014-11-13 00:44:43 +00:00
|
|
|
'Name' => 'Gather Quake Server Information',
|
|
|
|
'Description' => %q(
|
|
|
|
This module uses the getstatus or getinfo request to obtain
|
|
|
|
information from a Quakeserver.
|
2014-11-12 21:32:56 +00:00
|
|
|
),
|
2014-11-13 00:44:43 +00:00
|
|
|
'Author' => 'Jon Hart <jon_hart[at]rapid7.com',
|
|
|
|
'References' =>
|
2014-11-12 21:32:56 +00:00
|
|
|
[
|
|
|
|
['URL', 'ftp://ftp.idsoftware.com/idstuff/quake3/docs/server.txt']
|
|
|
|
],
|
2014-11-13 00:44:43 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' => [
|
2014-11-12 21:32:56 +00:00
|
|
|
['status', 'Description' => 'Use the getstatus command'],
|
2014-11-13 00:44:43 +00:00
|
|
|
['info', 'Description' => 'Use the getinfo command']
|
2014-11-12 21:32:56 +00:00
|
|
|
],
|
2014-11-13 00:44:43 +00:00
|
|
|
'DefaultAction' => 'status'
|
2014-11-12 21:32:56 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(27960)
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def build_probe
|
|
|
|
@probe ||= case action.name
|
|
|
|
when 'status'
|
|
|
|
getstatus
|
|
|
|
when 'info'
|
|
|
|
getinfo
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def decode_stuff(response)
|
|
|
|
case action.name
|
|
|
|
when 'info'
|
|
|
|
stuff = decode_info(response)
|
|
|
|
when 'status'
|
|
|
|
stuff = decode_status(response)
|
|
|
|
end
|
|
|
|
|
|
|
|
if datastore['VERBOSE']
|
|
|
|
stuff.inspect
|
|
|
|
else
|
|
|
|
# try to get the host name, game name and version
|
2014-11-13 00:44:43 +00:00
|
|
|
stuff.select { |k, _| %w(hostname sv_hostname gamename com_gamename version).include?(k) }
|
2014-11-12 21:32:56 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_process(response, src_host, src_port)
|
|
|
|
stuff = decode_stuff(response)
|
|
|
|
return unless stuff
|
|
|
|
@results[src_host] ||= []
|
|
|
|
print_good("#{src_host}:#{src_port} found '#{stuff}'")
|
|
|
|
@results[src_host] << stuff
|
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_postscan(_batch)
|
|
|
|
@results.each_pair do |host, stuff|
|
|
|
|
report_host(host: host)
|
|
|
|
report_service(
|
|
|
|
host: host,
|
|
|
|
proto: 'udp',
|
|
|
|
port: rport,
|
|
|
|
name: 'Quake',
|
|
|
|
info: stuff
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|