Query Documentation

Foxhole servers can be queried by using Standard Steam Server Query protocol documented by Valve

Known working open source libraries that will do this for you:
 * GameDig (NodeJS) - Will also output information into JSON

Rules Query Returns
When you query the rules, you will get following values returned: "GameplayFlags_i" "MATCHTIMEOUT_f" "NUMOPENPUBCONN" "OWNINGID": "OWNINGNAME" "P2PADDR" "P2PPORT" "ServerState_u" "SESSIONFLAGS" "WarStatus_u"

Most of the fields are of little concern to most people, the two major fields that hold data are ServerState_U and WarStatus_U

WarStatus_U
WarStatus field is 64 bit unsigned integer. While you can break it down to binary and work with it that way, the easiest way is to break it down into Decimal Byte representation which 8 integer fields between 0-255. Collectively these fields represent the following information: Total Enlistments, Warden Player Enlistments, Colonial Player Enlistments, Warden Town Ownership #, Colonial Town Ownership # (Not in that order)

Here is how you understand what those values mean. All math is assumed integer (meaning whole numbers only)

Using example from Barracks server at 1957UTC on 18-12-2017, the WarStatus_U was 220848044638479, breaking that down with Wolfram Alpha you get following 8 values:

Value 1: 15

Value 2: 1

Value 3: 64

Value 4: 49

Value 5: 220

Value 6: 200

Value 7: 0

Value 8: 0

Value 1 and 2 are total enlistments. The math to calculate it is (255*Value 2)+Value 1 so total enlistments at this time is 270.

Town Information is controlled by values 3 and 4 but math isn't known at this time.

Value 5,6,7 is player count for Warden/Colonial. Buck up for this math:

First thing you need to figure out is player multiplier which is: 255*Value7 / 4 = 0 Player Multiplier

Then you discover Colonial players which is: Value6 / 4 + player multiplier = 50 Colonial Players

Warden is based of Colonial player count:

If Colonial Player Count is even: Value 5 / 4 (which is true in this case) = 55 Warden Players

If Colonial Player Count is odd: Value 5 / 4 + (255/4)