Skip to content

Instantly share code, notes, and snippets.

@Demonslay335
Last active August 12, 2020 00:07
Show Gist options
  • Save Demonslay335/f82b8d9f94040b875ceb2386f9533362 to your computer and use it in GitHub Desktop.
Save Demonslay335/f82b8d9f94040b875ceb2386f9533362 to your computer and use it in GitHub Desktop.
DarkSide Ransomware ID Generation
import zlib, sys
def get_id(mac):
mac = int(mac, 16).to_bytes(6, 'big')
return checksum(mac, True)
def checksum(input, compression=False):
v3 = zlib.crc32(input, 0xDEADBEEF)
v4 = zlib.crc32(input, v3)
v5 = zlib.crc32(input, v4)
v6 = zlib.crc32(input, v5)
v7 = zlib.crc32(input, v6)
v8 = v4.to_bytes(4, 'little') + v5.to_bytes(4, 'little') + v6.to_bytes(4, 'little') + v7.to_bytes(4, 'little')
if not compression:
return v8.hex()
v9 = bytearray(8)
for i in range(8):
v9[i] = v8[i] ^ v8[i + 8]
ret = bytearray(4)
for i in range(4):
ret[i] = v9[i] ^ v9[i + 4]
return ret.hex()
print(gen_id(sys.argv[1]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment