interencdec

This commit is contained in:
Maxime Vorwerk
2024-06-14 17:02:34 +02:00
parent b8e7b57fc1
commit ad25d019c6
2 changed files with 24 additions and 0 deletions

1
interencdec/enc_flag Executable file
View File

@@ -0,0 +1 @@
YidkM0JxZGtwQlRYdHFhR3g2YUhsZmF6TnFlVGwzWVROclgyeG9OakJzTURCcGZRPT0nCg==

23
interencdec/sol.py Executable file
View File

@@ -0,0 +1,23 @@
#!/home/maxime/.pyvenv/bin/python3
from base64 import b64decode
def rot(n, s):
a = ord('a')
A = ord('A')
z = ord('z')
Z = ord('Z')
S = ''
for char in s:
ochar = ord(char)
if a <= ochar and ochar <= z:
char = chr(((ochar - a + n) % 26) + a)
elif A <= ochar and ochar <= Z:
char = chr(((ochar - A + n) % 26) + A)
S += char
return S
with open("enc_flag", 'r') as f:
enc_flag = f.read()
dec1 = rot(19, b64decode(b64decode(enc_flag).strip().decode().replace('\'', '')[1:]).decode())
print(dec1)