Core libraries for ZIRC project (GFL Protocol)
Project description
GFLZIRC
Fundamentally, gflzirc reverse-engineers the AC.AuthCode$$Authcode methodology. This emancipation allows us to directly forge data packets and communicate with the game servers, seamlessly circumventing the native client.
1. Architecture
The repository is structured to encapsulate diverse functionalities—ranging from low-level cryptographic operations to high-level HTTP client abstractions.
.
├── gflzirc # Core Package: gflzirc
│ ├── __init__.py # Public API exports
│ ├── client.py # High-level HTTP client mimicking Unity requests
│ ├── constants.py # System constants, endpoints, and static keys
│ ├── crypto.py # Bespoke encryption/decryption algorithms
│ └── proxy.py # MITM proxy with robust HTTP stream parsing
├── pyproject.toml # PyPI configuration
└── README.md # Package documentation
2. Crypto
The cryptographic mechanism bifurcates into "Encode" and "Decode," though our primary focus remains on the former for payload forgery. The algorithm is a highly idiosyncratic variant of Discuz! AuthCode.
Below is the conceptual breakdown reverse-engineered via IDA Free.
2.1 External
This module serves as the interface between the game's Il2Cpp environment and the core cryptographic functions.
Signature:
System_String_o* AC_AuthCode__Encode (System_String_o* source, System_String_o* key, const MethodInfo* method);
It conducts class initialization and type-checking within Il2Cpp before invoking the underlying AuthCode implementation, defaulting to an expiry time of 3600 seconds (1 hour).
/**
* @brief "Signature": "System_String_o* AC_AuthCode__Encode (System_String_o* source, System_String_o* key, const MethodInfo* method);",
*
* @note An external call of encode or decode.
*/
__int64 __fastcall sub_181B07AE0(__int64 a1, __int64 a2)
{
/**
* @brief Class initialization and type checking in Il2Cpp
*
* @note It's doesn't matter.
*/
if ( !byte_184BF59BC )
{
sub_18018E100(8668);
byte_184BF59BC = 1;
}
if ( (*(_BYTE *)(qword_184C71FB8 + 295) & 2) != 0 && !*(_DWORD *)(qword_184C71FB8 + 216) )
i981y4i12xrscakfbuqluj0dl_0();
/**
* @brief Call AC.AuthCode$$Authcode (source, key, operation=0, expiry=3600)
*
* @param operation, 0 encode, 1 decode.
* @param expiry, 1 hour i.e. 3600 seconds.
*/
return sub_181B06A50(a1, a2, 0, 3600, 0);
}
2.2 Encode
Sunborn implements a proprietary modification of the standard Discuz! AuthCode. The salient deviations are as follows:
- Eradication of
keyc(Random Prefix): Standard algorithms append a 4-bit random character to the ciphertext header to guarantee uniqueness. Sunborn deliberately omits this. The resulting Base64 string is pure RC4 ciphertext devoid of any random prefix. - Cryptkey Derivation:
- Standard:
cryptkey = keya + MD5(keya + keyc) - Sunborn:
cryptkey = keyb + MD5(keyb)
- Standard:
- Checksum Shift:
- Standard:
checksum = MD5(plaintext + keyb)[0:16] - Sunborn:
checksum = MD5(plaintext + keya)[0:16]
- Standard:
2.3 Decode
The decoding sequence accurately reverses the aforementioned operations, explicitly managing the idiosyncratic 26-byte payload alignment and verifying the modified checksum. Additionally, the Python implementation accommodates GZIP decompression, as the server frequently compresses the underlying JSON payload before RC4 encryption.
3. Constants
The constants.py module acts as the central taxonomy for the game's static data, dictating routing, authentication bootstraps, and API endpoints.
- Server Routing (
SERVERS): Maps server codenames (e.g.,M4A1,EN,M16) to their respective base URLs, facilitating cross-region compatibility. - Cryptographic Keys:
STATIC_KEY("yundoudou"): The pivotal bootstrap key. The server enforces this static key to decrypt the initial handshake.DEFAULT_SIGN: An initial pseudo-random sequence utilized prior to the acquisition of a dynamic session key.
- API Endpoints: Categorizes over a dozen server endpoints into logical domains such as Mission operations (
API_MISSION_START,API_MISSION_TEAM_MOVE), Index queries, Gun management, and Daily resets. - Macro Configurations: Embeds hardcoded sequences (e.g.,
GUIDE_COURSE_11880) imperative for automated tactical maneuvering.
4. Proxy
To facilitate debugging and real-time telemetry analysis—especially for Windows users—the proxy.py module deploys a robust Man-in-the-Middle (MITM) architecture.
- Robust Stream Parsing: The bespoke
HttpStreamDecoderhandles raw socket traffic. It flawlessly mitigates TCP fragmentation by resolvingContent-Lengthconstraints and decodingChunked Transfer-Encodingon the fly. - Traffic Interception & Analysis: It filters outbound requests to the
index.phpAPI, decrypts theoutdatacodepayload in real-time, and triggers user-defined callbacks (C2SandS2Cevents). - Dynamic Key Upgrade Mechanism: Crucially, the proxy scrutinizes incoming server responses. When the server provisions a new dynamic
signkey, the proxy autonomously captures it (SYS_KEY_UPGRADEevent) and overwrites the active cryptographic key to ensure uninterrupted decryption of subsequent packets. - System Integration: Exposes
set_windows_proxywhich directly manipulates the Windows Registry (winreg) and leveragesctypesto flushwininetoptions, seamlessly routing OS-level traffic into our python-based interceptor.
5. Client
The GFLClient (client.py) is an autonomous, high-level abstraction built atop the requests library, designed to orchestrate direct server communications without proxy dependencies.
- Header Spoofing: Automatically injects
User-AgentandX-Unity-Versionheaders to mimic the intrinsic Unity engine behavior meticulously. - State Management: Maintains an active HTTP session, deliberately bypassing global proxy variables to prevent loopback errors.
- Transparent Cryptography: Completely abstracts the AuthCode complexity. It inherently serializes Python dictionaries into JSON, executes the RC4 variant encryption using the current
sign_key, and structures the HTTP POSToutdatacodeparameters. - Resilience & Decryption: It parses the idiosyncratic server responses (often prefixed with
#), decrypts the payload, and provides built-in retry mechanisms with configurable timeouts to mitigate transient network failures.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gflzirc-0.4.1.tar.gz.
File metadata
- Download URL: gflzirc-0.4.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bff696bba1a05881cb77d159a504c2f9e1d3a9b609e652349f9d3aaa3a92f0fa
|
|
| MD5 |
e41a3a7f18ce5ce7b376aa13f38d7ab2
|
|
| BLAKE2b-256 |
5b8518a908f8173357027a4efe451ea6060cc9d74e9de1304843abba9f65742d
|
File details
Details for the file gflzirc-0.4.1-py3-none-any.whl.
File metadata
- Download URL: gflzirc-0.4.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
423d131c082e0d9ea9bf5e2f36c5d1f13a0bf5e6a3d38565258d5fbca79dc39d
|
|
| MD5 |
f0636cbde7184ce5e99aff61831cb0d1
|
|
| BLAKE2b-256 |
bc179f169101c2a12cd0c7e6e163d0e3a66adc16451bf41bacf21448dc525aa3
|