Created
April 20, 2021 19:42
-
-
Save kopiro/fb17e54bdccf6761a41027b20b3e7175 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 json | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(("socket.cryptohack.org", 13372)) | |
s.recv(64) | |
s.sendall(b'{"option": "encrypt_data", "input_data": "0000000000000000000000000000000000000000000000000000000000000000"}') | |
data = json.loads(s.recv(64)) | |
key = bytes.fromhex(data['encrypted_data']) | |
s.sendall(b'{"option": "get_flag"}') | |
data = json.loads(s.recv(64)) | |
flag = bytes.fromhex(data['encrypted_flag']) | |
msg = '' | |
for i in range(len(flag)): | |
msg += chr(key[i] ^ flag[i]) | |
print(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment