metasploit-framework/modules/auxiliary/scanner/quake/server_info.rb

91 lines
2.2 KiB
Ruby
Raw Normal View History

2014-11-12 21:32:56 +00:00
##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
2014-11-12 21:32:56 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'rex/proto/quake'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
2014-11-12 21:32:56 +00:00
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
),
'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',
2014-11-13 00:44:43 +00:00
'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)
])
2014-11-12 21:32:56 +00:00
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)
2015-06-15 19:45:14 +00:00
else
stuff = {}
2014-11-12 21:32:56 +00:00
end
if datastore['VERBOSE']
2015-06-15 19:45:14 +00:00
# get everything
stuff
2014-11-12 21:32:56 +00:00
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
2015-06-15 19:45:14 +00:00
@results[src_host] ||= {}
2014-11-12 21:32:56 +00:00
print_good("#{src_host}:#{src_port} found '#{stuff}'")
2015-06-15 19:45:14 +00:00
@results[src_host].merge!(stuff)
2014-11-12 21:32:56 +00:00
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',
2015-06-15 19:45:14 +00:00
info: stuff.inspect
2014-11-12 21:32:56 +00:00
)
end
end
end