Skip to content

Commit 5b1b7c2

Browse files
committed
Minor test/style cleanup
1 parent 51e84ce commit 5b1b7c2

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/rex/proto/steam/message.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: binary -*-
22

3-
43
module Rex
54
module Proto
65
##
@@ -9,7 +8,6 @@ module Proto
98
#
109
##
1110
module Steam
12-
1311
FRAGMENTED_HEADER = 0xFFFFFFFE
1412
UNFRAGMENTED_HEADER = 0xFFFFFFFF
1513

@@ -47,7 +45,7 @@ def a2s_info_decode(message)
4745
info = {}
4846
info[:version], info[:name], info[:map], info[:folder], info[:game_name],
4947
info[:game_id], players, players_max, info[:bots],
50-
type, env, vis, vac, info[:game_version], edf = payload.unpack("CZ*Z*Z*Z*SCCCCCCCZ*C")
48+
type, env, vis, vac, info[:game_version], _edf = payload.unpack("CZ*Z*Z*Z*SCCCCCCCZ*C")
5149

5250
# translate type
5351
case type

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@
3535

3636
describe '#a2s_info_decode' do
3737
it 'should extract a2s_info fields properly' do
38-
example_resp = "\xff\xff\xff\xff\x49\x11\x2d\x3d\x54\x48\x45\x20\x42\x41\x54\x54\x4c\x45\x47\x52\x4f\x55\x4e\x44\x53\x20\x2a\x48\x41\x52\x44\x43\x4f\x52\x45\x2a\x3d\x2d\x00\x61\x6f\x63\x5f\x62\x61\x74\x74\x6c\x65\x67\x72\x6f\x75\x6e\x64\x00\x61\x67\x65\x6f\x66\x63\x68\x69\x76\x61\x6c\x72\x79\x00\x41\x67\x65\x20\x6f\x66\x20\x43\x68\x69\x76\x61\x6c\x72\x79\x00\x66\x44\x16\x20\x00\x64\x6c\x00\x01\x31\x2e\x30\x2e\x30\x2e\x36\x00\xb1\x87\x69\x04\x04\x7c\x35\xbe\x12\x40\x01\x48\x4c\x73\x74\x61\x74\x73\x58\x3a\x43\x45\x2c\x69\x6e\x63\x72\x65\x61\x73\x65\x64\x5f\x6d\x61\x78\x70\x6c\x61\x79\x65\x72\x73\x00\x66\x44\x00\x00\x00\x00\x00\x00"
39-
expected_info = {:version=>17, :name=>"-=THE BATTLEGROUNDS *HARDCORE*=-", :map=>"aoc_battleground", :folder=>"ageofchivalry", :game_name=>"Age of Chivalry", :game_id=>17510, :players=>"22/32", :bots=>0, :game_version=>"1.0.0.6", :type=>"Dedicated", :environment=>"Linux", :visibility=>"public", :VAC=>"secured"}
40-
actual_info = subject.a2s_info_decode(example_resp)
38+
expected_info = {
39+
version: 17, name: "-=THE BATTLEGROUNDS *HARDCORE*=-", map: "aoc_battleground",
40+
folder: "ageofchivalry", game_name: "Age of Chivalry", game_id: 17510,
41+
players: "22/32", bots: 0, game_version: "1.0.0.6", type: "Dedicated",
42+
environment: "Linux", visibility: "public", VAC: "secured"
43+
}
44+
actual_info = subject.a2s_info_decode(IO.read(File.join(File.dirname(__FILE__), 'steam_info.bin')))
4145
expect(actual_info).to eq(expected_info)
4246
end
4347
end
155 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)