Category: Crypto
Points: 20
Description: Every CTF starts off with a Caesar cipher, but we’re more classy.

So this challenges presents us with a python script with essentially a caeser cipher but a bit better

from secret import flag, shift

def encrypt(d, s):
	e = ''
	for c in d:
		e += chr((ord(c)+s) % 0xff)
	return e

assert encrypt(flag, shift) == ':<M?TLH8<A:KFBG@V'

So essentially it is reading the flag and shift amount from a file and shifts each characters hex value by that shift. So brute forcing and checking if the resulting strings contains “actf” gives the flag:


# from secret import flag, shift

def encrypt(d, s):
	e = ''
	for c in d:
		e += chr((ord(c)+s) % 0xff)
	return e

for i in range(0xff):
    flag =encrypt(':<M?TLH8<A:KFBG@V', i)
    if "actf" in flag:
        print(flag)
        print(i)

FLAG

actf{so_charming}

Leave a Reply

Your email address will not be published. Required fields are marked *