We’re given a binary. Trying to open it in GDB we find that there is a lot of code in the main, so it is almost impossible to read it all by hand. Scrolling the first part we find a recurrent schema: the binary tries to verify a key character by character, and there are basically 2 types of comparisons.
The first one is a plain comparison, like the following one
So basically I used objdump -d bin > out.txt and parsed the output of the xored ones with python as follows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
lines = [line.rstrip('\n').replace('\t','') for line in open('out.txt')]
c = [] key = 0xeb
for l in range(len(lines)): if"$0xeb"in lines[l]: c.append(lines[l]) c.append(lines[l+1])
c2 = [] for l in c: if"$0xeb"notin l: c2.append(l) for l in c2: #print(l.split(",")[0][-2:]) n = int(l.split(",")[0][-2:],16) print(chr(n^key), end="")
Having this output i simply reconstructed the flag by hand using the parts in clear (in about 10 minutes). securinets{automating_everything_is_the_new_future}