Keep B2 client fixes and move VPS implementation to its standalone repository

This commit is contained in:
DCCONSTRUCTIONS
2026-09-29 12:41:21 +03:00
parent 03d44d0fb1
commit 6dd652f71e
85 changed files with 2201 additions and 9299 deletions
@@ -1,4 +1,4 @@
"""B2 231/0.01 configuration HTTP payloads, observed 2026-09-26.
"""B2 231/0.01 and 0.06 configuration HTTP payloads, observed 2026-09-26/28.
The HTTP transport is separate from INTERNAL. Unknown commands and firmware
fail closed. Parsing upload evidence is not proof that a write was applied.
@@ -7,7 +7,9 @@ fail closed. Parsing upload evidence is not proof that a write was applied.
from .usb_protocol import Configuration, ProtocolError, decode_configuration
MAX_BODY = 16384
QUALIFIED_METADATA = bytes.fromhex("0001e7020000")
QUALIFIED_METADATA = frozenset(
bytes.fromhex(value) for value in ("0001e7020000", "0006e7020000")
)
def decode_request(raw: bytes, *, observe_empty_check: bool = False) -> tuple[str, int, bytes]:
@@ -16,7 +18,7 @@ def decode_request(raw: bytes, *, observe_empty_check: bool = False) -> tuple[st
or raw[:2] != b"[\x01"
or raw[-1:] != b"]"
or int.from_bytes(raw[2:4], "big") != len(raw) - 5
or raw[12:18] != QUALIFIED_METADATA
or raw[12:18] not in QUALIFIED_METADATA
):
raise ProtocolError("unsupported_web_request")
imei = str(int.from_bytes(raw[4:12], "little"))