-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For compatibility with security patches to future game servers versions this adds a 1200 byte padding to all requests packets as defined in the following HLDS mailing list post: https://www.mail-archive.com/[email protected]/msg01194.html See koraktor/steam-condenser#331
- Loading branch information
Showing
6 changed files
with
66 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This code is free software; you can redistribute it and/or modify it under | ||
# the terms of the new BSD License. | ||
# | ||
# Copyright (c) 2020, Sebastian Staudt | ||
|
||
require 'steam-condenser/servers/packets/base_packet' | ||
|
||
module SteamCondenser::Servers::Packets | ||
|
||
# This is used as a wrapper to create padding of request packets to a minimum | ||
# size of 1200 bytes. This was introduced in November 2020 as a counter-measure | ||
# to DoS attacks on game servers. | ||
# | ||
# @author Sebastian Staudt | ||
module QueryPacket | ||
|
||
include BasePacket | ||
|
||
# The minimum package size as defined by Valve | ||
STEAM_GAMESERVER_MIN_CONNECTIONLESS_PACKET_SIZE = 1200 | ||
|
||
# Creates a new query packet including data padding | ||
# | ||
# @param [Fixnum] header The packet header | ||
# @param [String] content The raw data of the packet | ||
def initialize(header, content) | ||
super header, content.to_s.ljust(STEAM_GAMESERVER_MIN_CONNECTIONLESS_PACKET_SIZE - 5, "\0") | ||
end | ||
|
||
end | ||
end |
22 changes: 0 additions & 22 deletions
22
lib/steam-condenser/servers/packets/request_with_challenge.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This code is free software; you can redistribute it and/or modify it under | ||
# the terms of the new BSD License. | ||
# | ||
# Copyright (c) 2020, Sebastian Staudt | ||
|
||
require 'helper' | ||
|
||
class TestQueryPacket < Test::Unit::TestCase | ||
|
||
class GenericQueryPacket | ||
include Servers::Packets::QueryPacket | ||
end | ||
|
||
context 'A query packet' do | ||
|
||
setup do | ||
@packet = GenericQueryPacket.new 0x61, 'test' | ||
end | ||
|
||
should 'pad its content to at least 1200 bytes' do | ||
assert_equal [255, 255, 255, 255, 'atest' + "\0" * 1191].pack('c4a*'), @packet.to_s | ||
end | ||
|
||
end | ||
|
||
end |