Skip to content

Commit ebf6fe4

Browse files
committed
Minor style cleanup
1 parent 07a1653 commit ebf6fe4

File tree

3 files changed

+40
-37
lines changed

3 files changed

+40
-37
lines changed

lib/rex/proto/quake/message.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def decode_response(message, type)
5353
# XXX: is there a better exception to throw here?
5454
fail ::ArgumentError, "#{type} error: #{error}"
5555
# why doesn't this work?
56-
#elsif /^#{type}Response\n(?<infostring>.*)/m =~ resp
56+
# elsif /^#{type}Response\n(?<infostring>.*)/m =~ resp
5757
elsif resp =~ /^#{type}Response\n(.*)/m
5858
decode_infostring(Regexp.last_match(1))
5959
else

modules/auxiliary/scanner/quake/server_info.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ def initialize(info = {})
1515
super(
1616
update_info(
1717
info,
18-
'Name' => 'Gather Quake Server Information',
19-
'Description' => %q(
20-
This module uses the getstatus or getinfo request to obtain information from a Quakeserver.
18+
'Name' => 'Gather Quake Server Information',
19+
'Description' => %q(
20+
This module uses the getstatus or getinfo request to obtain
21+
information from a Quakeserver.
2122
),
22-
'Author' => 'Jon Hart <jon_hart[at]rapid7.com',
23-
'References' =>
23+
'Author' => 'Jon Hart <jon_hart[at]rapid7.com',
24+
'References' =>
2425
[
2526
['URL', 'ftp://ftp.idsoftware.com/idstuff/quake3/docs/server.txt']
2627
],
27-
'License' => MSF_LICENSE,
28-
'Actions' => [
28+
'License' => MSF_LICENSE,
29+
'Actions' => [
2930
['status', 'Description' => 'Use the getstatus command'],
30-
['info', 'Description' => 'Use the getinfo command'],
31+
['info', 'Description' => 'Use the getinfo command']
3132
],
32-
'DefaultAction' => 'status'
33+
'DefaultAction' => 'status'
3334
)
3435
)
3536

@@ -60,7 +61,7 @@ def decode_stuff(response)
6061
stuff.inspect
6162
else
6263
# try to get the host name, game name and version
63-
stuff.select { |k,v| %w(hostname sv_hostname gamename com_gamename version).include?(k) }
64+
stuff.select { |k, _| %w(hostname sv_hostname gamename com_gamename version).include?(k) }
6465
end
6566
end
6667

spec/lib/rex/proto/quake/message_spec.rb

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@
3636
end
3737

3838
it 'should properly decode infostrings' do
39-
expect(subject.decode_infostring('a\1\b\2\c\blah')).to eq({'a' => '1', 'b' => '2', 'c' => 'blah'})
39+
expect(subject.decode_infostring('a\1\b\2\c\blah')).to eq(
40+
'a' => '1', 'b' => '2', 'c' => 'blah'
41+
)
4042
end
4143
end
4244

4345
describe '#decode_response' do
4446
it 'should raise when server-side errors are encountered' do
45-
expect {
47+
expect do
4648
subject.decode_response(subject.encode_message("print\nsomeerror\n"))
47-
}.to raise_error(::ArgumentError)
49+
end.to raise_error(::ArgumentError)
4850
end
4951
end
5052

@@ -71,29 +73,29 @@
7173
describe '#decode_status' do
7274
it 'should decode status responses properly' do
7375
expected_status = {
74-
"bot_minplayers" => "0",
75-
"capturelimit" => "8",
76-
"com_gamename" => "Quake3Arena",
77-
"com_protocol" => "71",
78-
"dmflags" => "0",
79-
"fraglimit" => "30",
80-
"g_gametype" => "0",
81-
"g_maxGameClients" => "0",
82-
"g_needpass" => "0",
83-
"gamename" => "baseq3",
84-
"mapname" => "q3dm2",
85-
"sv_allowDownload" => "0",
86-
"sv_dlRate" => "100",
87-
"sv_floodProtect" => "1",
88-
"sv_hostname" => "noname",
89-
"sv_maxPing" => "0",
90-
"sv_maxRate" => "10000",
91-
"sv_maxclients" => "8",
92-
"sv_minPing" => "0",
93-
"sv_minRate" => "0",
94-
"sv_privateClients" => "0",
95-
"timelimit" => "25",
96-
"version" => "ioq3 1.36+svn2202-1/Ubuntu linux-x86_64 Dec 12 2011"
76+
"bot_minplayers" => "0",
77+
"capturelimit" => "8",
78+
"com_gamename" => "Quake3Arena",
79+
"com_protocol" => "71",
80+
"dmflags" => "0",
81+
"fraglimit" => "30",
82+
"g_gametype" => "0",
83+
"g_maxGameClients" => "0",
84+
"g_needpass" => "0",
85+
"gamename" => "baseq3",
86+
"mapname" => "q3dm2",
87+
"sv_allowDownload" => "0",
88+
"sv_dlRate" => "100",
89+
"sv_floodProtect" => "1",
90+
"sv_hostname" => "noname",
91+
"sv_maxPing" => "0",
92+
"sv_maxRate" => "10000",
93+
"sv_maxclients" => "8",
94+
"sv_minPing" => "0",
95+
"sv_minRate" => "0",
96+
"sv_privateClients" => "0",
97+
"timelimit" => "25",
98+
"version" => "ioq3 1.36+svn2202-1/Ubuntu linux-x86_64 Dec 12 2011"
9799
}
98100
actual_status = subject.decode_status(IO.read(File.join(File.dirname(__FILE__), 'status_response.bin')))
99101
expect(actual_status).to eq(expected_status)

0 commit comments

Comments
 (0)