Lemme In

Category

Rev

Description

I want to join this secret club, but they have the weirdest passwords! I’ve managed to intercept the program they use to authenticate the passwords, but I don’t know how to figure it out. Can you figure out the password for me?

Solution

Here we get a Python script.

def roll(text):
	return text[::-1]

def swoop(text):
	text = list(text)
	for i in range(len(text)):
		text[i] = chr(ord(text[i]) + (i % 5))
	return ''.join(text)

password = input("Enter the password: ")
if swoop(roll(password)) == "}12u7#dvl{$`fos_4jwchb}jelg":
	print("Welcome in!")
else:
	print("Sorry, wrong password.")

Using the same functions but subtracting instead of adding to the text in the swoop function we can get the original password.

def roll(text):
	return text[::-1]

def swoop(text):
	text = list(text)
	for i in range(len(text)):
		text[i] = chr(ord(text[i]) - (i % 5))
	return ''.join(text)

print(roll(swoop("}12u7#dvl{$`fos_4jwchb}jelg")))

When we run this we get the flag.

flag{ah_th3_old_$witc#3r00}

n00bz

Home of the n00bz CTF team.


By n00bz, 2022-02-20