fiverdbull
Master Üye
- Katılım
- 30 Eki 2025
- Mesajlar
- 1,289
- Beğeniler
- 319
C++:
{
"authentication_request": {
"machine_id": "qrvM3aq7zN2qu8zdqrvM3Q==", // DONT CHANGE
"os_info": { "platform": 3, "architecture": 2, "os_version": "10.0.19045" },
"game_token": "<JWT>",
"client_rsa_public_key": "<nova por sessão>", // just gen a pair
"dev_sub": "1.18.4.36",
"game_id": "com.riotgames.valorant",
"boot_state": 3,
"external_sid": "<SID>",
"security_features_f14": ["HVCI", "IOMMU", "SB", "VBS", "TPM2"],
"metadata_f15": [
{ "key": "ht", "value": "qrvM3aq7zN2qu8zdqrvM3aq7zN0=" }
]
},
"rg_encrypt_rsa_spki_der_base64": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxABI8XC5dAnqbJX6ZLWjwiAPl18Pj/5q1E8I8raxRRJb7i7wmCuUEExKfwOBjbF4y4Wiugt8cloQniGqTzL7JfvjpaZWYuM7OTd9YjACJRmm6CDjNsAxAA6PzH7B9LJd49Cp4ViHME65uUorsnQ6riq0wbZSwNLaKWi9yoLlEX8Ru2CRgHJte35Fo1BcbB2S36SfwBu9tKMUbn1sAqjGMnzu8Slm9smtIoeugfvBEz4rpPpBH8n4/Nv89pZPf12O/64bHBfuK4v/g6Ig3T4MT73MmXfxP4Hv3pI9+9ydnkzc3uZ+4LZbONVCyjJHcndeOcTzw2VIcJP5gVAxgaW6WQIDAQAB"
}
C++:
import base64[/COLOR]
import os
from typing import Any[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]RG_MAGIC = b"\x52\x47\x01\x00"
SERVER_RSA_PUBKEY_B64 = (
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxABI8XC5dAnqbJX6ZLWjwiAPl18Pj/5q1E8I8raxRRJb7i7wmCuUEExKfwOBjbF4y4Wiugt8cloQniGqTzL7JfvjpaZWYuM7OTd9YjACJRmm6CDjNsAxAA6PzH7B9LJd49Cp4ViHME65uUorsnQ6riq0wbZSwNLaKWi9yoLlEX8Ru2CRgHJte35Fo1BcbB2S36SfwBu9tKMUbn1sAqjGMnzu8Slm9smtIoeugfvBEz4rpPpBH8n4/Nv89pZPf12O/64bHBfuK4v/g6Ig3T4MT73MmXfxP4Hv3pI9+9ydnkzc3uZ+4LZbONVCyjJHcndeOcTzw2VIcJP5gVAxgaW6WQIDAQAB"
)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]VG_AUTH_REQUEST = 3[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _varint(n: int) -> bytes:
out = bytearray()
while True:
b = n & 0x7F
n >>= 7
if n:
b |= 0x80
out.append(b)
if not n:
break
return bytes(out)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _field_bytes(field: int, data: bytes) -> bytes:
return _varint((field << 3) | 2) + _varint(len(data)) + data[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _field_str(field: int, s: str) -> bytes:
return _field_bytes(field, s.encode("utf-8"))[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _field_varint(field: int, v: int) -> bytes:
return _varint((field << 3) | 0) + _varint(v)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _map_entry(key: str, val: str) -> bytes:
e = bytearray()
e += _field_str(1, key)
e += _field_str(2, val)
return bytes(e)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _dev_sub(build: int = 36) -> bytes:
b = bytearray()
b += _field_varint(1, 1)
b += _field_varint(2, 18)
b += _field_varint(3, 4)
b += _field_varint(4, build)
return bytes(b)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _os_info(platform: int, arch: int, version: str) -> bytes:
b = bytearray()
b += _field_varint(1, platform)
b += _field_varint(2, arch)
b += _field_str(4, version)
return bytes(b)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def _security_feature(name: str, state: int = 1) -> bytes:
b = bytearray()
b += _field_str(1, name)
b += _field_varint(2, state)
return bytes(b)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def normalize_client_rsa(spki_b64_or_der: bytes) -> bytes:
raw = (spki_b64_or_der or b"").strip()
if raw.startswith(b"-----BEGIN"):
pub = serialization.load_pem_public_key(raw)
der = pub.public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)
return base64.b64encode(der)
if raw.startswith(b"MIIB") or raw.startswith(b"MIG"):
return raw
return base64.b64encode(raw)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def build_auth_plain(profile: dict[str, Any]) -> bytes:
jwt = str(profile["jwt"])
external_sid = str(profile["external_sid"])
machine_id = str(profile["machine_id"])
client_rsa = normalize_client_rsa(profile["client_rsa"])
os_ver = str(profile.get("os_version", "10.0.19045"))
dev_build = int(profile.get("dev_build", 36))
boot_state = int(profile.get("boot_state", 3))
game_id = str(profile.get("game_id", "com.riotgames.valorant"))
sec = list(profile.get("security_features") or ["HVCI", "IOMMU", "SB", "VBS", "TPM2"])
kvcr_ht = profile.get("kvcr_ht")[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)] buf = bytearray()
buf += _field_str(1, machine_id)
buf += _field_bytes(2, _os_info(3, 2, os_ver))
buf += _field_str(4, jwt)
buf += _field_bytes(5, client_rsa)
buf += _field_bytes(6, _dev_sub(dev_build))
buf += _field_bytes(7, _dev_sub(dev_build))
buf += _field_str(8, game_id)
buf += _field_varint(9, boot_state)
buf += _field_str(13, external_sid)
for feat in sec:
buf += _field_bytes(14, _security_feature(feat))
if kvcr_ht:
buf += _field_bytes(15, _map_entry("ht", str(kvcr_ht)))[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)] return bytes(buf)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def rg_encrypt(plaintext: bytes) -> bytes:
"""
RG blob:
magic 4B 52 47 01 00
rsa 256B OAEP-SHA512(session_aes_key)
nonce 12B
ct+tag AES-256-GCM(plaintext)
"""
pub = serialization.load_der_public_key(base64.b64decode(SERVER_RSA_PUBKEY_B64))
aes_key = os.urandom(32)
oaep = padding.OAEP(
mgf=padding.MGF1(algorithm=hashes.SHA512()),
algorithm=hashes.SHA512(),
label=None,
)
enc_key = pub.encrypt(aes_key, oaep)
if len(enc_key) != 256:
raise ValueError(f"RSA block {len(enc_key)} != 256")
nonce = os.urandom(12)
ct = AESGCM(aes_key).encrypt(nonce, plaintext, None)
return RG_MAGIC + enc_key + nonce + ct[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def build_envelope(rg_blob: bytes, msg_type: int = VG_AUTH_REQUEST) -> bytes:
"""VgEnvelope { field1=type, field2=payload }"""
buf = bytearray()
buf += _field_varint(1, msg_type)
buf += _field_bytes(2, rg_blob)
return bytes(buf)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]def build_auth_http_body(profile: dict[str, Any]) -> tuple[bytes, bytes]:
"""Retorna (plain, http_body_envelope)."""
plain = build_auth_plain(profile)
rg = rg_encrypt(plain)
envelope = build_envelope(rg)
return plain, envelope[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)]if __name__ == "__main__":
import hashlib[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)] hwid = bytes.fromhex("aabbccdd" * 4)
rsa_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
spki_b64 = base64.b64encode(
rsa_key.public_key().public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)
)[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)] profile = {
"jwt": "eyJ.test." + ("x" * 200),
"external_sid": "9c3def89-b07d-4fed-a871-e3013509e32a",
"machine_id": base64.b64encode(hwid).decode("ascii"),
"client_rsa": spki_b64,
"os_version": "10.0.19045",
"dev_build": 36,
"boot_state": 3,
"kvcr_ht": base64.b64encode(hashlib.sha256(hwid).digest()[:20]).decode("ascii"),
}[/COLOR][/COLOR][/COLOR]
[COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)][COLOR=rgb(216, 224, 243)] plain, body = build_auth_http_body(profile)
print(f"plain={len(plain)}B envelope={len(body)}B")
print(f"f13 external_sid={profile['external_sid']}")
print(f"plain_hex_prefix={plain[:64].hex()}...")
malum forumda paylaşılmış burda paylaşmamak olmaz
paylasan kisi / cr: @arturleda
Son düzenleme: