Created
April 9, 2021 06:50
-
-
Save lttn1204/c02599852a41520168e52626979337f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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