Yepoleb / dayzquery

Small Python module to decode the DayZ rules binary response.
MIT License
2 stars 1 forks source link

BufferExhaustedError when querying servers running Sakhal map #2

Closed aclist closed 2 days ago

aclist commented 2 weeks ago

DayZ introduced a new map with the Frostline DLC called Sakhal (island:sakhal). Querying servers running this map with dayzquery.dayz_rules fails due to a length mismatch:

#server running sakhal 
print(dayzquery.dayz_rules(("212.22.93.134", 27018)))

  File "/home/me/python-a2s/a2s/dayzquery.py", line 67, in dayz_rules
    return dayz_rules_decode(rules_resp, encoding)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/python-a2s/a2s/dayzquery.py", line 108, in dayz_rules_decode
    mod.name = reader.read(string_length).decode(encoding, errors="replace")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/me/python-a2s/a2s/byteio.py", line 17, in read
    raise BufferExhaustedError()
a2s.exceptions.BufferExhaustedError
#server running any other map, e.g., chernarus
print(dayzquery.dayz_rules(("168.100.162.38", 27016)))

-- works as intended, snipped for brevity

Notably, servers running Sakhal still respond correctly to a2s.info queries. Presumably, the A2S_RULES portion of Sakhal servers is being packed differently. A snapshot from the live servers above (wrapped on comma delimiter for readability):

#212.22.93.134:27018

{b'\x01\x03': b'\x02\x01\x02\x02\x01\x02\x8d\x90rr\t_\x16K\x17\x04\x15&.\x98\x08100X-RAY\xb2\xd80\xdb\x044\xca\x8f\x92\nTraderPlus45\x8f\x81\x04p\xd8\xd8\x8f\x14100X-RAY_BuilderMaps`\xdc\x04\xf6\x04S\xa9\xe9\x8c\x10 Mod 100_rentgen\xd1\xf8\xef\xd8\x04
,\x80\xd7}\x0eBed-Respawni'
, b'\x02\x03': b'ng\xbdDK\xd8\x04\x81Z\xb5\xb4\x10InediaInfectedAI\x9a\xd1\x16G\x04\xea\xd4\x1eb\x08CodeLock\xb9_\x9a(\x04T\xc4\xfbl\rVPPAdminTools\xcf\xb9\x7f\x96\x04\x04\xb0\xef\\\x13Community Framework\r\x12C4BaseRaidbyDmitri\x0bcftoolsR'
, b'\x03\x03': b'oot\nCodeLockv3\x0bcybermonkey\x04dayz\x06disk0t\x07Hunterz\x06Inedia\x0eJacob_Mango_V3\x04L4DS\rMADGIC100xray\x05PINKs\x03VPP\x01\x02'
, b'allowedBuild': b'0'
, b'clientPort': b'0'
, b'dedicated': b'1'
, b'island': b'sakhal'
, b'language': b'65561'
, b'platform': b'win'
, b'requiredBuild': b'0'
, b'requiredVersion': b'126'
, b'timeLeft': b'15'}

#168.100.162.38:27016

{b'\x01\n': b'\x02\x04\x01\x02\x01\x02\x1e\x08\xf4a\xcb\x04gdD\xb1\x07The Labqd\xbb:\x04\x87\x92\n\xb7\x10The Lab Vehicles/\xb0x\xb5\x04\xd4\x9b\x83\xa0\x1dRedFalcon Flight System HelizJc\tZ\x04\xe0\x10\xbc\xae\x15Forward Operator Gearp\x97\xc1\x04\x04\xe2p'
, b'\x02\n': b"\xfbe\x10BaseBuildingPlus\x9aZFu\x04\x05~\xe9l\x0fBreachingcharge\x0fH\xaf\xa2\x04\x0fb\xc1\xa5\x16Blackout's EDO Weapons\x88\xb0\xb9\xf5\x04\x92\xc1\x99\xab\rRaG_BaseItems\xab\xfc\xa8\xb2\x04(\xf6\xb4v\rMuchStuffPackf\xed\x93\xf2\x04"
, b'\x03\n': b'RO1s\x0cCannabisPlus93S\x01\x03\x04\x96<\xc3\x9d\x0eTactical Flava\xcf\xb9\x7f\x96\x04\x04\xb0\xef\\\x13Community FrameworkV\xb1jc\x04\xa1H\x97\xa8\x15DayZ-Expansion-Quests\xc9\x96\xdc\x01\x01\x04.\x8f\x86\x89\x14BuildingsMegaM'
, b'\x04\n': b'odPackY\xcc\x81\x04\x04\x16\x9eR\x99\x15DayZ-Expansion-Marketk\x10\xf1]\x04_A\xb0\x91\x13InventoryMoveSounds\x1e{*)\x04\xe3\x98\xf3\xaa\x14GSC Gameworld Assets\xec\x97\xc5\x11\x04\\\xde\x99\x88\x13DayZ-Expansion-Core\xe3\x91'
, b'\x05\n': b'\x07\xd2\x04q\xba\xa8\xa4\x11BuildingsModPack7w\xee\xd9\xcc\x04\x97(\xa9\x87\x12DayZ Editor Loaderq\x94\xa8\xd9\x04\xaa\x12\xf1\xac\x13Yuretskiy Creatures\xa2p)Z\x04 \x9e\xb6\x97\x0eDabs Framework\x92\x17v\x82\x04Ql\n\xbd\rMuchFramewo'
, b'\x06\n': b'rk\xb9_\x9a(\x04T\xc4\xfbl\rVPPAdminTools\xb0\xe0\xaf\x16\x04\xb7\xf08m\rFlipTransportwI\x16\xb6\x04hM!z\nMuchCarKey\x14\x85\xbd\xf5\x04\xb39\x80~\nVehicle3PP\x9a\xd1\x16G\x04\xea\xd4\x1eb\x08CodeLock\x05\xdb\xc1\x06\x04\x8c^L\x89\x08CarCoverA\x04\\'
, b'\x07\n': b'\x8d\x04ztM\x89\x07Dogtags&\x04AJ45\x13AmmunitionExpansion\x03BBP\nBLACKOUTV3\x18cbd_portalteleportsystem\x0bcftoolsRoot\nCodeLockv3\x03dab\tDannyDoom\x04dayz\ndayz'
, b'\x08\n': b'thelab\tdesignful\tExpansion\x11FrostbiteOfficial\x03Geb\x04HDSN\tHelkhiana\x07Hunterz\x08IceBlade\x0cInclementDab\x06Inkota\nItemRarity\x0eJacob_Mango_V3\x06'
, b'\t\n': b'JayDee\x04L4DS\x03MDC\x03MFP\nNikapolset\x15O12_Mega_Collectables\trag_tyson\tRFFSHeliz\tSfmplayer\x06Starlv\x0cSyndicate_v2\x03VPP\tWardog.v3\x07Wayward\tYu'
, b'\n\n': b'retskiy\x01\x02'
, b'allowedBuild': b'0'
, b'clientPort': b'0'
, b'dedicated': b'1'
, b'island': b'chernarusplus'
, b'language': b'65545'
, b'platform': b'win'
, b'requiredBuild': b'0'
, b'requiredVersion': b'126'
, b'timeLeft': b'15'}

Both servers list a required version of 1.26, so the update itself has not introduced a change to the protocol for all servers.

Yepoleb commented 2 days ago

Hey, it took me a while to take a look at this, has the issue disappeared?

aclist commented 1 day ago

Thanks for your response. I made a PR about it in https://github.com/Yepoleb/dayzquery/pull/3. To clarify the commit log, in that fork, I had previously reverted bdab767 since the implications of the bug in that commit were not clear and it was working with the old logic. I've since merged the changes you made yesterday to the rules_resp parameters, so this patch only affects how the result.dlcs is packed.