Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Keygen for Jemd Ransomware
import os, sys, argparse
# Charset used by Jemd ransomware
charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
def lcg(modulus, a, c, seed):
while True:
seed = (a * seed + c) % modulus
yield seed
# LCG using Delphi constants
def rand(s):
return lcg(2**32, 0x8088405, 1, s)
# Jemd keygen
def keygen(seed=0, length = 0xF):
key = ''
i = 0
cl = len(charset)
# Iterate generator
for c in rand(seed):
# Break at requested length
if i >= length:
# See Delphi LCGRandom(range)
key += charset[c * cl >> 32]
i += 1
return key
# Setup argument parts
parser = argparse.ArgumentParser(description='Keygen for Jemd ransomware.')
parser.add_argument('seed', help='seed', type=int)
# Parse arguments
args = parser.parse_args()
print keygen(args.seed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.