Recette
In this challenge, we are given the hex string:
1
32 69 31 73 34 69 31 73 31 35 64 31 6f 34 39 69 31 6f 34 64 31 6f 33 69 31 6f 31 35 64 31 6f 32 32 64 31 6f 32 30 64 31 6f 31 39 69 31 6f 37 64 31 6f 35 64 31 6f 32 69 31 6f 35 35 69 31 6f 31 64 31 6f 31 39 64 31 6f 31 37 64 31 6f 31 38 64 31 6f 32 39 69 31 6f 31 32 69 31 6f 32 36 69 31 6f 38 64 31 6f 35 39 64 31 6f 32 37 69 31 6f 36 64 31 6f 31 37 69 31 6f 31 32 64 31 6f 37 64 31 6f 35 69 31 6f 31 64 31 6f 32 64 31 6f 31 32 69 31 6f 39 64 31 6f 32 36 64 31 6f
We need to convert from hexadecimal, expand so that no digits are visible, decode DeadFish and convert from Base 85.
I used the following code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import base64
# Hexadecimal string to decode
hex_str = "3269317334693173313564316f343969316f3464316f3369316f313564316f323264316f323064316f313969316f3764316f3564316f3269316f353569316f3164316f313964316f313764316f313864316f323969316f313269316f323669316f3864316f353964316f323769316f3664316f313769316f313264316f3764316f3569316f3164316f3264316f313269316f3964316f323664316f"
# Decode hexadecimal string to bytes
bytes_str = bytes.fromhex(hex_str).decode()
# set the letters by group of n where n is the digit preceding the letter
numerical_str = ""
i = 0
while i < len(bytes_str):
if bytes_str[i].isdigit():
if bytes_str[i+1].isdigit():
num = int(bytes_str[i]+bytes_str[i+1])
numerical_str += bytes_str[i+2]*num
i+= 2
else:
num = int(bytes_str[i])
numerical_str += bytes_str[i+1]*num
i+= 1
else:
numerical_str += bytes_str[i]
i+=1
print(numerical_str)
This code basically just decodes the hexadecimal string at first. Then it will do like in a recipe. If we have 3 eggs we will use the notation 3 Eggs
, here it’s the same. If we have a string 3e2i
then we will get eeeii
.
This code will output:
1
iisiiiisdddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioddddoiiiodddddddddddddddoddddddddddddddddddddddoddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiodddddddodddddoiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiododddddddddddddddddddodddddddddddddddddoddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiiioddddddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoiiiiiiiiiiiiiiiiiiiiiiiiiiioddddddoiiiiiiiiiiiiiiiiioddddddddddddodddddddoiiiiiododdoiiiiiiiiiiiiodddddddddoddddddddddddddddddddddddddo
And after that we can use the online tool dcode to decode this DeadFish. When we decode this string as ASCII characters, we get 1b^aR<(;4/1hgTC1NZtl1LFWKDIHFRI/
. And finally, we can use again dcode for the base85 decoding and we get the flag 404CTF{M4igr3t_D3_c4naRd}