Austinb / GameQ

A PHP Gameserver Status Query Library
https://austinb.github.io/GameQ/
GNU Lesser General Public License v3.0
403 stars 136 forks source link

DayZ rules returns malformed modlist #664

Closed aclist closed 1 year ago

aclist commented 2 years ago

This appears to relate to #299, with the names of mods and IDs being encoded in chunks. This gets parsed as generic UTF-8 strings and becomes malformed.

E.g., using the source server type against 205.178.177.113:2303 returns the following mod list at the top of the rules response.

I could not find any information about a discrete DayZ server protocol like the Arma 3 protocol v2, but presumably it exists.

The expected result is an array of human-readable mod names and workshop IDs.

Array
(
    [205.178.177.113:2303] => Array
        (
            [  ] =>  ʚÎA]êk”Rearmed Server PackÞíl‹ ž¶—Dabs Framework69?¶m™MagicBox½tq–<ÝTactical FlavaQ·2"[µU¤Croco´s Quad
            [  ] => bikeNcÍO’+ŽZStuff"˜¢g橎Terrain IslandsõE—ïŁ
SPBuilding§ãëö锌IndustrialModPackɖÜ.†‰BuildingsMegaModPackã‘Ò
            [  ] => qº¨¤BuildingsModPack7p—ÁâpûeBaseBuildingPlus¶Ò¯”·ð8m
FlipTransportÅÜ-T¥žArma 2 Helicopters Remastered|£ºÝޙˆDayZ-
            [  ] => Expansion-Vehiclesau¡çŠ!~DayZ-Expansion-Licensed"hUÞl‡¦DayZ-Expansion-Animations‚§žR™DayZ-Expansion-Market”:È©‘™
            [  ] => DayZ-Expansion-Name-Tagsz“|\ޙˆDayZ-Expansion-CoreàˆÛåTÄûl
VPPAdminTools?,£Zü‘MagObfuscationPS”idS¦Survivalists_Fa
            [  ] => cePaintskñ]_A°‘InventoryMoveSounds$ê—(©‡DayZ Editor Loaderá*OztM‰Dogtags¼*÷Œ^L‰CarCoverQžêÔbCodeLock¡7¢~é
            [  ] => lBreachingchargeæÍ'kWindstrideClothing'ñ÷“(ö´v
MuchStuffPack
t°ï\Community FrameworkBBPcftoolsRootCl0udV3
Co
            [  ] => deLockv3CrocoDocPublicdayz   designful   Expansion   GormirnTIHDSN  HelkhianaHunterzInclementDabItsATreeev1Jacob_Mango_V3   Josec
            [       ] => itox
liquidrock  SPModdingStarlvVPP    Wardog.v3Wayward
Windstride
dlartigu commented 2 years ago

Hey! Have you managed to fix that ? I'm getting same (even worse) with a2s_rules.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Krymonota commented 1 year ago

Not stale

Austinb commented 1 year ago

It appears something has changed with DayZ and the query ports as well as the response for a2s_rules.

Changing the port is not an issue if they are not doing odd client port/server port configurations that used to exist when this first came out.

The a2s_rules response will require custom processing to handle the "extra" information within the rules response. I am not sure if this is some kind of pascal style response or what. Please provide more information or another library that handles the rules correctly. As of right now the expected response format is incorrect with string = key and then string = value and so on. If you find more information on how to process this response from DayZ please reopen.

"<FF><FF><FF><FF>E^P\000^A^H\000^A^A^A^B^A^B^A^B^Z<8F><EE>[ ^D]<EA>k<94>^SRearmed Server Pack^_<8C><B8><82>^D <9E><B6><97>^NDabs Framework6^T<81>9^D?<B6>m<99>^HMagicBox<84>-Ӷ ^D<96><Ý^NTactical FlavaNc<CD>O^D<92>+^_<8E>^FZStuff<A7><E3><EB>^W^D<F6><E9>\000^B^H\000<94><8C>^QIndustrialModPackɖ<DC>^A^A^D.<8F><86><89>^TBuildingsMegaModPack<E3><91>^G<D2>^Dq<BA><A8><A4>^QBuildingsModPack7p<97><C1>^D^D<E2>p<FB>e^PBaseBuildingPlus:<F7>G<A4>^D<B7><F0>8m^MFlipTransport\000^C^H\000<BF><BD>^_<A9>^D<A5>^G^F<9E>^]Arma 2 Helicopters Remastered<FB>۔^D^V<9E>R<99>^UDayZ-Expansion-Market<91>^A^An^D<8A>^A^C!~^WDayZ-Expansion-LicensedϬ<81>>^D

ޙ<88>^WDayZ-Expansi\000^D^H\000on-VehiclesG^?^Dl<87>^YDayZ-Expansion-Animations<9F>M^Dȩ<91><99>^XDayZ-Expansion-Name-Tags<95>^D"...`

In the 5th spot E after that should be a signed 16 bit int with the number of rules. Every entry after that is supposed to be "key\x00" = "value\x00".

Decicus commented 1 year ago

Please provide more information or another library that handles the rules correctly.

node-gamedig seems to have an implementation that works: https://github.com/gamedig/node-gamedig/blob/b85c784d954e1931e9d56e74b4acf794ffbc0dd4/protocols/valve.js#L328-L414

Output of dayzMods can be found below. Some mods don't seem to have a workshopId and only a title - though I'm not sure if that's because they're simply not on the Steam Workshop

{
    "dayzMods":
    [
        {
            "unknown": 2348654204,
            "workshopId": 2464526692,
            "title": "GameLabs"
        },
        {
            "unknown": 3698355200,
            "workshopId": 2537007783,
            "title": "PARADISE"
        },
        {
            "unknown": 639553306,
            "workshopId": 2350401726,
            "title": "King of the Hill"
        },
        {
            "unknown": 2358398075,
            "workshopId": 2800461252,
            "title": "Vending Machine"
        },
        {
            "unknown": 2769546314,
            "workshopId": 2662827589,
            "title": "Garage System V2"
        },
        {
            "unknown": 2752359402,
            "workshopId": 1828439124,
            "title": "VPPAdminTools"
        },
        {
            "unknown": 1802613499,
            "workshopId": 2407047547,
            "title": "AdvancedBanking"
        },
        {
            "unknown": 1380989580,
            "workshopId": 2143128974,
            "title": "Advanced Weapon Scopes"
        },
        {
            "unknown": 3020916640,
            "workshopId": 1932611410,
            "title": "CannabisPlus"
        },
        {
            "unknown": 1139469477,
            "workshopId": 1590841260,
            "title": "Trader Mod"
        },
        {
            "unknown": 3161391718,
            "workshopId": 1623711988,
            "title": "VanillaPlusPlusMap"
        },
        {
            "unknown": 1192677786,
            "workshopId": 1646187754,
            "title": "CodeLock"
        },
        {
            "unknown": 1926020464,
            "workshopId": 1559212036,
            "title": "Community Framework"
        },
        {
            "title": "AdvancedBanking"
        },
        {
            "title": "cftoolsRoot"
        },
        {
            "title": "CodeLockv3"
        },
        {
            "title": "dayz"
        },
        {
            "title": "dayzGarage"
        },
        {
            "title": "dayztrader"
        },
        {
            "title": "IceBlade"
        },
        {
            "title": "IMPERIVM"
        },
        {
            "title": "Inkota"
        },
        {
            "title": "Jacob_Mango_V3"
        },
        {
            "title": "Munghard"
        },
        {
            "title": "paradise"
        },
        {
            "title": "resurrection"
        },
        {
            "title": "TheHideout_KOTH"
        },
        {
            "title": "THO_KOTH"
        },
        {
            "title": "VPP"
        }
    ]
}
aclist commented 1 year ago

@Decicus

This implementation seems correct insofar as the IDs are concerned. The dangling titles correspond, for the most part, to mod author names (e.g. Iceblade, Inkota, Munghard). The non-author names in turn correspond (seemingly) to incremental versions or dependencies (?) for the mod itself. I performed a naive search of the Steam Workshop using the mod names/IDs and was unable to align all of the dangling "titles" with the mods, however. Can you provide the server IP used so that we can cross-reference this output with a published manifest for that server? If the modlist is here in its entirety, the other metadata is for the most part incidental.

Source: my own observations plus the discussion at https://github.com/gamedig/node-gamedig/issues/234

Decicus commented 1 year ago

@aclist Ah yes, sorry. Server IP I used was: 185.207.214.32:2302 (query port: 2307).

aclist commented 1 year ago

I couldn't find a public manifest for that server since the mods haven't been indexed on a public tracker and the server hasn't been claimed by the server operator. I used a more common server below and queried it with gamedig:

193.25.252.35:2303

The sorted modlist:

Arma 2 Helicopters Remastered
BuildingsMegaModPack
BuildingsModPack7
CodeLock
Community Framework
Dabs Framework
DayZ Editor Loader
DayZ-Expansion-Core
DayZ-Expansion-Licensed
DayZ-Expansion-Market
DayZ-Expansion-Name-Tags
DayZ-Expansion-Vehicles
Dogtags
FlipTransport
IndustrialModPack
InventoryMoveSounds
MagObfuscation
MagicBox
Rearmed Server Pack
Survivalists_FacePaints
Tactical Flava
VPPAdminTools
ZStuff

Corroborating the results:

  1. https://www.battlemetrics.com/servers/dayz/13864540
  2. https://dayzsalauncher.com/api/v1/query/193.25.252.35/2303

A diff of this with the above came up clean, 1:1 mod match.

Obviously these sources and gamedig are just pulling from the same rules response, but unless they are all using the wrong logic (more on that later), it seems like a reasonable amount of triangulation to conclude that the list is correct, and the fact that no other mod titles or IDs are leaking through the response supports this.

Still, feeling that another source of truth should be used here, I went further and looked for servers where the admins had actively published the mod list in human readable form. This led me to https://tsbdayz.com/info, advertising:

Server 3 (Namalsk)
Name: The Struggle Bus Namalsk - Vanilla|Hardcore|ActiveAdmins
IP: 147.135.31.186:2502
Client side mods to install for Namalsk:
Namalsk Island, Namalsk Survival

And gamedig returns:

"dayzMods": [
      {
        "unknown": 2063552372,
        "workshopId": 2289461232,
        "title": "Namalsk Survival"
      },
      {
        "unknown": 2184792298,
        "workshopId": 2289456201,
        "title": "Namalsk Island"
      },
      {
        "title": "cftoolsRoot"
      },
      {
        "title": "dayz"
      },
      {
        "title": "sumrak"
      }
    ]
  },

Two mods expected, two mods found.

Then I tried this one, since it had a more comprehensive list: https://old.reddit.com/r/DayZServers/comments/13gac6f/us_chernarus_pc_dayz_insanity_pvepvp/ https://www.battlemetrics.com/servers/dayz/18754691

This looks correct as well, although the author of the server advertising post forgot to include the mod DayZ-Rat in their handwritten list.

Moreover, the list at https://www.battlemetrics.com/servers/dayz/18754691 actually includes CJ187_Public, the last item in the mod list, as an erroneous mod title, with the wrong ID, and links it to a UGC (user generated content) item on Steam Workshop): https://steamcommunity.com/sharedfiles/filedetails/?id=1916023139. In the (presumed correct) gamedig response, CJ187_Public is part of the dangling strings at the end, not a mod itself.

This looks like a parsing error on the Battlemetrics site at the boundary of the real modlist and the other strings. I have seen this bug on the site before. Screenshots and mods on Steam Workshop occupy the same URL prefix, so it's possible to construct a seemingly "valid" link to a mod using an arbitrary number, such as one originating from a parsing error.

In any event, I think this is reasonable evidence to indicate that the modlist is coming back in its entirety with the aligned IDs. Ideally the test surface could be increased to validate a few more servers, but it seems accurate, save for the mangled author names and mod dependency names at the bottom.

aclist commented 1 year ago

Additional data point:

The above logic will support mainline DayZ servers (official/community/etc.), not DayZ Experimental servers.

"Experimental" servers are a separate testing branch that is available to server operators. These load Steam Workshop mods in the typical fashion, but the A2S response is encoded differently as far as the rules key is concerned and is getting interpreted as UTF-8:

"name": "DayZ US - LA 3599 (Experimental/Unstable)",
  "map": "chernarusplus",
  "password": false,
  "raw": {
    "protocol": 17,
    "folder": "dayz",
    "game": "DayZ Exp",
    "appId": 1024020,
    "numplayers": 16,
    "numbots": 0,
    "listentype": "d",
    "environment": "w",
    "secure": 1,
    "version": "1.21.156165",
    "steamid": "90172469402110980",
    "tags": [
      "battleye",
      "shard000",
      "lqs0",
      "etm6.200000",
      "entm1.700000",
      "07:18"
    ],
    "rules": {
      "\u0001\u0001": "\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0001\u0004dayz",
      "allowedBuild": "0",
      "dedicated": "1",
      "island": "chernarusplus",
      "language": "65545",
      "platform": "win",
      "requiredBuild": "0",
      "requiredVersion": "121" "timeLeft": "15"
    }