2014-11-06 21:52:17 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2014-11-06 21:52:17 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
2014-11-11 00:45:28 +00:00
|
|
|
require 'rex/proto/steam'
|
2014-11-06 21:52:17 +00:00
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2014-11-06 21:52:17 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::UDPScanner
|
2014-11-11 00:45:28 +00:00
|
|
|
include Rex::Proto::Steam
|
2014-11-06 21:52:17 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(
|
|
|
|
update_info(
|
|
|
|
info,
|
2014-11-10 21:27:12 +00:00
|
|
|
'Name' => 'Gather Steam Server Information',
|
2014-11-06 21:52:17 +00:00
|
|
|
'Description' => %q(
|
2014-11-10 21:27:12 +00:00
|
|
|
This module uses the A2S_INFO request to obtain information from a Steam server.
|
2014-11-06 21:52:17 +00:00
|
|
|
),
|
2014-11-18 19:50:01 +00:00
|
|
|
'Author' => 'Jon Hart <jon_hart[at]rapid7.com>',
|
2014-11-06 21:52:17 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
2014-11-10 21:27:12 +00:00
|
|
|
# TODO: add more from https://developer.valvesoftware.com/wiki/Server_queries,
|
|
|
|
# perhaps in different modules
|
|
|
|
['URL', 'https://developer.valvesoftware.com/wiki/Server_queries#A2S_INFO']
|
2014-11-06 21:52:17 +00:00
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2014-11-10 21:27:12 +00:00
|
|
|
Opt::RPORT(27015)
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2014-11-06 21:52:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def build_probe
|
2014-11-11 00:45:28 +00:00
|
|
|
@probe ||= a2s_info
|
2014-11-06 21:52:17 +00:00
|
|
|
end
|
|
|
|
|
2014-11-11 00:45:28 +00:00
|
|
|
def scanner_process(response, src_host, src_port)
|
|
|
|
info = a2s_info_decode(response)
|
|
|
|
return unless info
|
2014-11-06 21:52:17 +00:00
|
|
|
@results[src_host] ||= []
|
2014-11-11 00:45:28 +00:00
|
|
|
if datastore['VERBOSE']
|
|
|
|
print_good("#{src_host}:#{src_port} found '#{info.inspect}'")
|
|
|
|
else
|
|
|
|
print_good("#{src_host}:#{src_port} found '#{info[:name]}'")
|
|
|
|
end
|
|
|
|
@results[src_host] << info
|
2014-11-06 21:52:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def scanner_postscan(_batch)
|
2014-11-10 21:27:12 +00:00
|
|
|
@results.each_pair do |host, info|
|
2014-11-06 21:52:17 +00:00
|
|
|
report_host(host: host)
|
|
|
|
report_service(
|
|
|
|
host: host,
|
|
|
|
proto: 'udp',
|
|
|
|
port: rport,
|
2014-11-10 21:27:12 +00:00
|
|
|
name: 'Steam',
|
|
|
|
info: info
|
2014-11-06 21:52:17 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|