Skip to content

Instantly share code, notes, and snippets.

@wbowling
Created July 21, 2017 05:30
Show Gist options
  • Save wbowling/fcdda37703334768d9ab052ce8213f6f to your computer and use it in GitHub Desktop.
Save wbowling/fcdda37703334768d9ab052ce8213f6f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import string
def srand(s):
global seed
seed = s
# microsoft c runtime implementation
def rand():
global seed
seed = (seed * 214013 + 2531011) % 2**64
return (seed >> 16)&0x7fff
def xor(key, val):
return ''.join(chr(ord(a) ^ ord(b)) for a,b in zip(key,val))
enc = "\x9a\x60\x76\x14\x8b\x36\x5a\x10\x2b\x91\xc4\x6c\xab\x27\x92\x99\xf8\x6a\xec\x5d\x32\x20\x3d\x61\x8f\xc7\xfb\xdd\x02\x72\xbf";
# epoch for 2017-07-18 to 2017-07-20
for k in xrange(1500336000, 1500508800):
key = ""
srand(k)
for i in range(len(enc)):
r = rand()
key += chr((r - (0x7F807F81 * r >> 39) - (r >> 31))&0xff)
plain = xor(key, enc)
if all(c in string.printable for c in plain):
print "Message: %s"%plain
print "Seed time: %d"%k
print "Key: %s"%key.encode("hex")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment