Lengthy Lingo (35 pts)

Solved by: zookham

Problem:

Can you crack the code? We intercepted this flag but can't seem to figure out how it was encrypted.

Files:

encrypted.dat

Hint:

The numbers don't seem to follow a specific pattern...

Solution:

The first step to solving this problem was figuring out how the encryption worked. The file contained many large numbers, comma-separated. One suspicious part was that all of the numbers seemed to have a relatively similar number of digits. Upon closer inspection, the first number, when converted into a string, had a length of 115, which is the ASCII value of the character 's'. Since all flags start with 'sctf', I tried converting all of the lengths of the numbers to ASCII, which gave me the flag.

Code:

#read data to string
with open('encrypted.dat') as f:
  s = f.read()

#remove last character of string (newline)
s = s[:-1]

#split by comma-space
l = s.split(", ")

out = ''

#add characters to string
for val in l:
  out += chr(len(val))

print(out)
#output: sctf{101_th3_numb3r5_d1dn'7_3v3n_m4tt3r}

FLAG: sctf{101_th3_numb3r5_d1dn'7_3v3n_m4tt3r}