-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathencrypto.py
96 lines (74 loc) · 4.33 KB
/
encrypto.py
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
90
91
92
93
94
95
96
import os
import json , random
from colorama import Style , Fore
data = json.load(open("data.json"))
ban = """
██████╗ ██╗ █████╗ ██████╗██╗ ██╗
██╔══██╗██║ ██╔══██╗██╔════╝██║ ██╔╝
██████╔╝██║ ███████║██║ █████╔╝
██╔══██╗██║ ██╔══██║██║ ██╔═██╗
██████╔╝███████╗██║ ██║╚██████╗██║ ██╗
╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
███████╗███╗ ██╗ ██████╗██████╗ ██╗ ██╗██████╗ ████████╗
██╔════╝████╗ ██║██╔════╝██╔══██╗╚██╗ ██╔╝██╔══██╗╚══██╔══╝
█████╗ ██╔██╗ ██║██║ ██████╔╝ ╚████╔╝ ██████╔╝ ██║
██╔══╝ ██║╚██╗██║██║ ██╔══██╗ ╚██╔╝ ██╔═══╝ ██║
███████╗██║ ╚████║╚██████╗██║ ██║ ██║ ██║ ██║
╚══════╝╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
"""
all_col= [Style.BRIGHT+Fore.RED,Style.BRIGHT+Fore.CYAN,Style.BRIGHT+Fore.LIGHTCYAN_EX, Style.BRIGHT+Fore.LIGHTBLUE_EX, Style.BRIGHT+Fore.LIGHTCYAN_EX,Style.BRIGHT+Fore.LIGHTMAGENTA_EX,Style.BRIGHT+Fore.LIGHTYELLOW_EX]
ran = random.choice(all_col)
def banner():
os.system("clear")
print(ran,ban)
print(ran + "\n\t\tV: 2.0.0 'New Release'\t\n")
print("*" * 63)
print(Style.BRIGHT+Fore.LIGHTCYAN_EX, "\n" ,"- " * 4, " [+] Follow me on Instagram @saadkhan041 ", "- " * 4)
print(Style.BRIGHT+Fore.LIGHTYELLOW_EX, "\n", "- " * 4, " [+] Follow me on Instagram @coding_memz ", "- " * 4)
print(Style.BRIGHT+Fore.LIGHTRED_EX, "\n", "- " * 4, "[+] Github: https://github.com/Saadkhan041/ ", "- " * 3)
print("\n" , "*" * 63)
banner()
def encrypt():
text = input(ran + "\nEnter text to encrypt: " + Style.BRIGHT+Fore.LIGHTGREEN_EX)
enc = ""
for i in text:
for j in data.keys():
if i == j:
enc = enc + data.get(i)
if i not in data.keys():
enc = enc +i
print(Style.BRIGHT+Fore.LIGHTGREEN_EX + "\n\t\tCopy and send the text: \n\n" + enc)
def decrypt():
text = input(ran + "\nEnter text to decrypt: " + Style.BRIGHT + Fore.LIGHTGREEN_EX)
dec = ""
for i in text:
for key , value in data.items():
if i == value:
dec = dec + key
if i not in data.values():
dec = dec +i
print(Style.BRIGHT + Fore.LIGHTGREEN_EX + "\n\t\tCopy and send the text: \n\n" + dec)
no = ["no" , "n"]
cont =""
while cont not in no:
print(ran + "\n\t[1] Encrypt Text\n\t[2] Decrypt Text\n\t[3] Exit\n ")
choice = input(ran + "Enter your choice: ")
if choice == "1":
encrypt()
elif choice == "2":
decrypt()
elif choice == "3":
print(ran + "\n\tDont Forget to do following tasks :-)\t\n")
print(Fore.CYAN, "- " * 4, " [+] Follow me on Instagram @saadkhan041 ", "- " * 4)
print(Fore.LIGHTYELLOW_EX, "\n", "- " * 4, " [+] Follow me on Instagram @coding_memz ", "- " * 4)
print(Fore.LIGHTRED_EX, "\n", "- " * 4, "[+] Github: https://github.com/Saadkhan041/ ", "- " * 3)
exit()
else:
print(ran + "\nInvalid option")
exit()
cont = input(ran + "\nDo you want to continue? [y/n]:")
if cont == "y":
os.system("clear")
banner()
else:
pass