Skip to content

Instantly share code, notes, and snippets.

@lttn1204
Created April 9, 2021 06:50
Show Gist options
  • Save lttn1204/c02599852a41520168e52626979337f5 to your computer and use it in GitHub Desktop.
Save lttn1204/c02599852a41520168e52626979337f5 to your computer and use it in GitHub Desktop.
import os
import zlib
def keystream(key):
index = 0
while 1:
index+=1
if index >= len(key):
key += zlib.crc32(key).to_bytes(4,'big')
yield key[index]
def decrypt(enc,k):
arr=[]
for i in enc:
arr.append(i ^ next(k))
return bytes(arr)
with open('enc','rb') as enc:
enc=enc.read()
while True:
key=os.urandom(2)
key=keystream(key)
flag=decrypt(enc,key)
if b'actf' in flag:
print(flag)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment