Points: 388

Tags: padding xor 

Poll rating:

"You need to accept the fact that you’re not the best and have all the will to strive to be better than anyone you face." – Roronoa Zoro

Connection : nc 104.199.9.13 1338

Attachments

chall link

Given Code

#!/usr/bin/env python3
import os

FLAG = open('flag.txt','rb').read()

def xor(a, b):
    return bytes([i^j for i,j in zip(a,b)])

def pad(text, size):
    return text*(size//len(text)) + text[:size%len(text)]

def encrypt(data, key):
    keystream = pad(key, len(data))
    encrypted = xor(keystream, data)
    return encrypted.hex()


if __name__ == "__main__":
    print("\n===== WELCOME TO OUR ENCRYPTION SERVICE =====\n")
    try:
        key = os.urandom(32)
        pt = input('[plaintext (hex)]>  ').strip()
        ct = encrypt(bytes.fromhex(pt) + FLAG, key)
        print("[ciphertext (hex)]>", ct)
        print("See ya ;)")
    except Exception as e:
        print(":( Oops!", e)
        print("Terminating Session!")

Writeups

ActionRatingAuthor team
Read writeup
not rated
Byt3Scr4pp3rs
Read writeup
not rated
MHax3ers
You need to authenticate and join a team to post writeups