Challenge info: (link to challenge)

Challenge description

.

We’re given a list/array of strings. Each one of those is a binary number (denoted by the 0b prefix).

The author also provided the source code he used. This is what he did in short..

explanation

He put the flag as a string into a variable called “x” then did both steps in the picture above.

(Step 1)==> Then he used “x” as an argument to function “bytearray” which takes each character from “x” and converts it into a decimal number representing the unicode value of that character.

(Step 2)==> He used the function “bin” which converts a decimal to its binary equivalent. But how to use that function on each element in the list created from step1? You have 2 options; either use a For-loop, or use the “map” function. The author used the latter.

So the end result is that we have a list containing binary numbers.

To get the flag, we have to reverse what the author did. Here is our plan:

  1. Convert each binary number to decimal (using int( ) function)
  2. Grab the character whose unicode value is equal to that decimal (using chr( ) function)
  3. Join all the characters in the list to form a string (the flag)

Here is my script to do it: Github link. Run it in python 3, and you get the flag:

The flag is ====> Saluslab{G0_3aSy_0n_m3}

.

Bonus step:

Since the author created the challenge using a one-liner, lets solve it with a one-liner.

Link to my one-line solution on Github

Leave a Reply

Your email address will not be published. Required fields are marked *