PicoCTF Writeup – Tapping

Information: 

 

CTF Name: PicoCTF

CTF Challenge: Tapping

Challenge Category: Cryptography

Challenge Points: 200

PicoCTF 2019.

 

# Challenge Description: 

Theres tapping coming in from the wires. What’s it saying nc jupiter.challenges.picoctf.org 48247.

Relevant hints: What kind of encoding uses dashes and dots? The flag is in the format PICOCTF{}

 

Writeup 

And here we are for another CTF writeup! Well in this one we are presented with a netcat connection. We are given the full command, nc jupiter.challenges.picoctf.org 48247. To be able to run the command I opened my Linux terminal and typed it like this:
mregra on Cyber ~$ nc jupiter.challenges.picoctf.org 48247 
.--. .. -.-. --- -.-. - ..-. { -- ----- .-. ... ...-- -.-. ----- -.. ...-- .---- ... ..-. ..- -. .---- ..--- -.... .---- ....- ...-- ---.. .---- ---.. .---- }  

When I saw this, I was like… what kind of message system do I know that uses dots and dashes?? Morse code!!! By knowing this I went online and found an image that had the conversion between Morse code and the alphabet. I tested to verify my idea and I was able to see that the first 3 characters corresponded topic, which is usually the beginning of the flag. Knowing this I decided to create a python script that converted from alphanumeric to Morse code and vice versa.

Below is the code snippet that decodes from Morse code to letters and numbers:  

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def decode():      
    morse_code_message = input("Message to decode: ")                                     
    message_chars_list = morse_code_message.split( )     
    for i in message_chars_list: 
        if(i == "{" or i == "}"):  
            print(i, end='') 
            else:                   
            for key in morse_code_alphabet:   
                if(i == key):     
                 print(morse_code_alphabet[key], end='')  
    print()

1. What this code does is that it simply requests to the user the message in Morse code to convert to alphanumeric (line 2).     

2. Upon receiving the input we split the string by spaces creating this way a list with Morse code characters (line 3).     

3. Afterward, we have a for loop that iterates over the previously created list (line 4).     

4. If any of the characters corresponds to a bracket we just print it because as you can see in the Morse code given in the challenge they appear as brackets (lines 5 and 6).     

5. If the characters do not correspond to brackets I considered them to be Morse code, so, what I do is I iterate over a dictionary that I created with the = , and I verify if the i (which is the current value of the challenge message) is the same as some of the keys in the dictionary if so we print the corresponding alphanumeric value (line 10).  

It might be a little confusing and I could explain myself better but the idea is that I created a tool that converts from alphanumeric to Morse code and vise versa, as I said.  

After finishing this script I run it on my Linux terminal, as such:

And the flag is:  

Show flag
PICOCTF{M0RS3C0D31SFUN1261438181}

The original code can be found here.

Thank you very much for reading!

Cheers,

MRegra


Share this post:

Popular posts

3 Replies to “PicoCTF Writeup – Tapping”

  1. Hello! I simply want to offer you a huge thumbs up for your excellent info you have right here on this post.

    I’ll be coming back to your blog for more soon.

    1. Thanks!! I am glad you enjoyed the post.
      Please feel free to see my other posts I post weekly around 2-3 posts.
      Have a nice day 🙂

Leave a Reply

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