From ab4ae425a73fda441d84ee16e1d589d36f4d6d1b Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 3 Sep 2024 00:04:53 +0200 Subject: [PATCH] crypto/tapping --- crypto/tapping/output.txt | 1 + crypto/tapping/solve.py | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 crypto/tapping/output.txt create mode 100755 crypto/tapping/solve.py diff --git a/crypto/tapping/output.txt b/crypto/tapping/output.txt new file mode 100644 index 0000000..cfccd1a --- /dev/null +++ b/crypto/tapping/output.txt @@ -0,0 +1 @@ +.--. .. -.-. --- -.-. - ..-. { -- ----- .-. ... ...-- -.-. ----- -.. ...-- .---- ... ..-. ..- -. ...-- ----. ----- ..--- ----- .---- ----. ..... .---- ----. } diff --git a/crypto/tapping/solve.py b/crypto/tapping/solve.py new file mode 100755 index 0000000..03f50e0 --- /dev/null +++ b/crypto/tapping/solve.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +MORSE_MAP = { + '.-': 'A', + '-...': 'B', + '-.-.': 'C', + '-..': 'D', + '.': 'E', + '..-.': 'F', + '--.': 'G', + '....': 'H', + '..': 'I', + '.---': 'J', + '-.-': 'K', + '.-..': 'L', + '--': 'M', + '-.': 'N', + '---': 'O', + '.--.': 'P', + '--.-': 'Q', + '.-.': 'R', + '...': 'S', + '-': 'T', + '..-': 'U', + '...-': 'V', + '.--': 'W', + '-..-': 'X', + '-.--': 'Y', + '--..': 'Z', + '-----': '0', + '.----': '1', + '..---': '2', + '...--': '3', + '....-': '4', + '.....': '5', + '-....': '6', + '--...': '7', + '---..': '8', + '----.': '9', + '{': '{', + '}': '}', +} + +with open('output.txt', 'r') as f: + content = f.read().strip() + +result = '' +for word in content.split(' '): + result += MORSE_MAP.get(word, '?') + +# PICO -> pico +result = result[:4].lower() + result[4:] + +print(result) \ No newline at end of file