@@ -13,61 +13,31 @@ def initialize(info = {})
13
13
super (
14
14
update_info (
15
15
info ,
16
- # TODO: fill in all of this
17
- 'Name' => 'UDP Scanner Example' ,
16
+ 'Name' => 'Gather Steam Server Information' ,
18
17
'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.
18
+ This module uses the A2S_INFO request to obtain information from a Steam server.
23
19
) ,
24
- 'Author' => 'Joe Contributor <joe_contributor [at]example .com> ' ,
20
+ 'Author' => 'Jon Hart <jon_hart [at]rapid7 .com' ,
25
21
'References' =>
26
22
[
27
- [ 'URL' , 'https://example.com/~jcontributor' ]
23
+ # TODO: add more from https://developer.valvesoftware.com/wiki/Server_queries,
24
+ # perhaps in different modules
25
+ [ 'URL' , 'https://developer.valvesoftware.com/wiki/Server_queries#A2S_INFO' ]
28
26
] ,
29
- 'DisclosureDate' => 'Mar 15 2014' ,
30
27
'License' => MSF_LICENSE
31
28
)
32
29
)
33
30
34
31
register_options (
35
32
[
36
- # TODO: change to the port you need to scan
37
- #Opt::RPORT(27015)
38
- Opt ::RPORT ( 4672 )
33
+ Opt ::RPORT ( 27015 )
39
34
] , self . class )
40
35
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
36
end
53
37
54
38
# TODO: construct the appropriate probe here.
55
39
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
40
+ @probe ||= "\xFF \xFF \xFF \xFF TSource Engine Query\x00 "
71
41
end
72
42
73
43
# Called for each response packet
@@ -77,45 +47,19 @@ def scanner_process(response, src_host, _src_port)
77
47
puts "Got something from #{ src_host } "
78
48
#puts response.unpack("NCCZ*Z*Z*Z*SCCCCCCCZ*C")
79
49
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
50
end
87
51
88
52
# Called after the scan block
89
53
def scanner_postscan ( _batch )
90
- @results . each_pair do |host , relevant_responses |
91
- peer = "#{ host } :#{ rport } "
92
-
93
- # report on the host
54
+ @results . each_pair do |host , info |
94
55
report_host ( host : host )
95
-
96
- # report on the service, since it responded
97
56
report_service (
98
57
host : host ,
99
58
proto : 'udp' ,
100
59
port : rport ,
101
- name : 'example' ,
102
- # show at most 4 relevant responses
103
- info : relevant_responses [ 0 , 4 ] . join ( ',' )
60
+ name : 'Steam' ,
61
+ info : info
104
62
)
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
63
end
120
64
end
121
65
end
0 commit comments