-
-
Save st98/453cfbaec05cc0df6b471ad2b7837eb8 to your computer and use it in GitHub Desktop.
SHA2017 CTF Teaser round - [Crypto 200] Crypto Engine
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 io | |
import requests | |
from PIL import Image | |
def get_image(s): | |
r = requests.get('https://cryptoengine.stillhackinganyway.nl/encrypt?text=' + s) | |
return Image.open(io.BytesIO(r.content)) | |
def get_color(im, i): | |
return im.getpixel((1 + 40 * i, 1)) | |
flag = Image.open('flag') | |
res = '' | |
for i in range(12): | |
im = get_image(res + 'aaa') | |
c1 = [x ^ ord('a') for x in get_color(im, i)] | |
c2 = get_color(flag, i) | |
res += ''.join(chr(x ^ y) for x, y in zip(c1, c2)) | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment