Skip to content

Commit f8eea6c

Browse files
committed
Add initial aux module to fingerprint/gather from Steam servers
1 parent 96ba6da commit f8eea6c

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
include Msf::Auxiliary::Report
10+
include Msf::Auxiliary::UDPScanner
11+
12+
def initialize(info = {})
13+
super(
14+
update_info(
15+
info,
16+
# TODO: fill in all of this
17+
'Name' => 'UDP Scanner Example',
18+
'Description' => %q(
19+
This module is an example of how to send probes to UDP services
20+
en-masse, analyze any responses, and then report on any discovered
21+
hosts, services, vulnerabilities or otherwise noteworthy things.
22+
Simply address any of the TODOs.
23+
),
24+
'Author' => 'Joe Contributor <joe_contributor[at]example.com>',
25+
'References' =>
26+
[
27+
['URL', 'https://example.com/~jcontributor']
28+
],
29+
'DisclosureDate' => 'Mar 15 2014',
30+
'License' => MSF_LICENSE
31+
)
32+
)
33+
34+
register_options(
35+
[
36+
# TODO: change to the port you need to scan
37+
#Opt::RPORT(27015)
38+
Opt::RPORT(4672)
39+
], self.class)
40+
41+
# TODO: add any advanced, special options here, otherwise remove
42+
register_advanced_options(
43+
[
44+
OptBool.new('SPECIAL', [true, 'Try this special thing', false])
45+
], self.class)
46+
end
47+
48+
def setup
49+
super
50+
# TODO: do any sort of preliminary sanity checking, like perhaps validating some options
51+
# in the datastore, etc.
52+
end
53+
54+
# TODO: construct the appropriate probe here.
55+
def build_probe
56+
#@probe ||= "\xFF\xFF\xFF\xFFTSource Engine Query\x00"
57+
@probe ||= "\xe4\x01"
58+
end
59+
60+
# TODO: this is called before the scan block for each batch of hosts. Do any
61+
# per-batch setup here, otherwise remove it.
62+
def scanner_prescan(batch)
63+
super
64+
end
65+
66+
# TODO: this is called for each IP in the batch. This will send all of the
67+
# necessary probes. If something different must be done for each IP, do it
68+
# here, otherwise remove it.
69+
def scan_host(ip)
70+
super
71+
end
72+
73+
# Called for each response packet
74+
def scanner_process(response, src_host, _src_port)
75+
return unless response.size >= 19
76+
@results[src_host] ||= []
77+
puts "Got something from #{src_host}"
78+
#puts response.unpack("NCCZ*Z*Z*Z*SCCCCCCCZ*C")
79+
80+
# TODO: store something about this response, perhaps the response itself,
81+
# some metadata obtained by analyzing it, the proof that it is vulnerable
82+
# to something, etc. In this example, we simply look for any response
83+
# with a sequence of 5 useful ASCII characters and, iff found, we store
84+
# that sequence
85+
/(?<relevant>[\x20-\x7E]{5})/ =~ response && @results[src_host] << relevant
86+
end
87+
88+
# Called after the scan block
89+
def scanner_postscan(_batch)
90+
@results.each_pair do |host, relevant_responses|
91+
peer = "#{host}:#{rport}"
92+
93+
# report on the host
94+
report_host(host: host)
95+
96+
# report on the service, since it responded
97+
report_service(
98+
host: host,
99+
proto: 'udp',
100+
port: rport,
101+
name: 'example',
102+
# show at most 4 relevant responses
103+
info: relevant_responses[0, 4].join(',')
104+
)
105+
106+
if relevant_responses.empty?
107+
vprint_status("#{peer} Not vulnerable to something")
108+
else
109+
print_good("#{peer} Vulnerable to something!")
110+
report_vuln(
111+
host: host,
112+
port: rport,
113+
proto: 'udp',
114+
name: 'something!',
115+
info: "Got #{relevant_responses.size} response(s)",
116+
refs: references
117+
)
118+
end
119+
end
120+
end
121+
end

0 commit comments

Comments
 (0)