forked from Tejas1510/Hacking-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencrypt.py
More file actions
89 lines (82 loc) · 2.19 KB
/
encrypt.py
File metadata and controls
89 lines (82 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import winsound
import time
# here i have used the standard moorse code chart provided by wikipedia and other website
# you can change if you wish to do so
def encrypt(msg, MORSE_CODE_DICTIONARY):
li1 = list(MORSE_CODE_DICTIONARY.keys())
wordlist = msg.split(" ")
EncryptedMessage = list()
MorseWord = ""
for i in wordlist:
for j in i:
if j.upper() not in li1:
EncryptedMessage.clear()
EncryptedMessage.append(
'CAN NOT BE TRANSLATED TO MORSE CODE!!')
return EncryptedMessage
MorseWord = MorseWord + MORSE_CODE_DICTIONARY[j.upper()]
MorseWord = MorseWord + " "
EncryptedMessage.append(MorseWord)
MorseWord = ""
return EncryptedMessage
def MakeSound(EncryptedMessage):
for i in EncryptedMessage:
for j in i:
LetterList = j.split(" ")
for k in LetterList:
if k == '.':
winsound.Beep(2500, 400)
# time.sleep(0.001)
elif k == '-':
winsound.Beep(2500, 800)
# time.sleep(0.001)
time.sleep(1.5)
time.sleep(3)
if __name__ == "__main__":
MORSE_CODE_DICT = {
'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': '--..',
'1': '.----',
'2': '..---',
'3': '...--',
'4': '....-',
'5': '.....',
'6': '-....',
'7': '--...',
'8': '---..',
'9': '----.',
'0': '-----',
', ': '--..--',
'.': '.-.-.-',
'?': '..--..',
'/': '-..-.',
'-': '-....-',
'(': '-.--.',
')': '-.--.-'
}
e = encrypt('', MORSE_CODE_DICT)
MakeSound(e)