Skip to content

Commit f1c3c09

Browse files
authored
uploaded baseCoderDecoder.py
1 parent 4c69afa commit f1c3c09

1 file changed

Lines changed: 191 additions & 0 deletions

File tree

baseCoderDecoder.py

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
import os
2+
import base64
3+
4+
5+
class bColors:
6+
GREEN = '\033[92m'
7+
YELLOW = '\033[93m'
8+
RED = '\033[91m'
9+
BLUE = '\033[94m'
10+
11+
12+
def banner():
13+
print(bColors.GREEN + '<<< IP-TRACKER v1.0>>>')
14+
print(bColors.RED + r'''
15+
_
16+
| |
17+
| |___
18+
| _ \ _ _
19+
| |_) | | (_) |
20+
\____/ \__, |
21+
__/ |
22+
|___/
23+
_ _
24+
| | (_)
25+
____ ____ ___| | ___ _ ______ ______ ___ _ ______ ______ _ _ ____
26+
/ ___\ / \ / _ | / _ | | / _____| / _____| / _ | | / _____| / _____| | | | | | \
27+
| |____ | () | | (_| | | (_|| | \______\ \______\ | (_|| | \______\ \______\ | | | | | |
28+
\____/ \____/ \____/ \___|_| |______/ |______/ \___|_| |______/ |______/ |_| |_| |_|
29+
''')
30+
31+
32+
default = True
33+
depth = 30
34+
level_of_encryption = 11
35+
36+
37+
def clear():
38+
os.system("cls" if os.name == "nt" else "clear")
39+
40+
41+
def base85decode(n):
42+
level = 1
43+
user_decoded = n
44+
for i in range(0, depth):
45+
user_decoded = base64.b85decode(user_decoded)
46+
print(f"Decoded {level} times: '{user_decoded.decode()}' ")
47+
level += 1
48+
49+
50+
def base16decode(n):
51+
level = 1
52+
user_decoded = n
53+
for i in range(0, depth):
54+
user_decoded = base64.b16decode(user_decoded)
55+
print(f"Decoded {level} times: '{user_decoded.decode()}' ")
56+
level += 1
57+
58+
59+
def base32decode(n):
60+
level = 1
61+
user_decoded = n
62+
for i in range(0, depth):
63+
user_decoded = base64.b32decode(user_decoded)
64+
print(f"Decoded {level} times: '{user_decoded.decode()}' ")
65+
level += 1
66+
67+
68+
def base64encode(n):
69+
level = 1
70+
user_encoded = n
71+
for i in range(0, level_of_encryption):
72+
user_encoded = base64.b64encode(user_encoded)
73+
print(f"Encoded {level} times: '{user_encoded.decode()}'")
74+
level += 1
75+
76+
77+
def base64decode(n):
78+
level = 1
79+
user_decoded = n
80+
for i in range(0, depth):
81+
user_decoded = base64.b64decode(user_decoded)
82+
print(f"Decoded {level} times: '{user_decoded.decode()}' ")
83+
level += 1
84+
85+
86+
def b85(user):
87+
try:
88+
base85decode(user)
89+
except Exception as e:
90+
print("Gone through b85")
91+
92+
input("\npress enter to continue ")
93+
clear()
94+
main()
95+
96+
97+
def b16(user):
98+
try:
99+
base16decode(user)
100+
except Exception as e:
101+
print("Gone through b16")
102+
103+
input("\npress enter to continue")
104+
clear()
105+
main()
106+
107+
108+
def b32(user):
109+
try:
110+
base32decode(user)
111+
except Exception as e:
112+
print("Gone through b32")
113+
114+
input("\npress enter to continue")
115+
clear()
116+
main()
117+
118+
119+
def b64(user):
120+
action = input("Choose [e]ncode or [d]ecode: ")
121+
if action == "e":
122+
try:
123+
base64encode(bytes(user, 'utf-8'))
124+
except Exception as e:
125+
pass
126+
try:
127+
base64decode(user)
128+
except Exception as e:
129+
print("Gone through b64")
130+
131+
input("\npress enter to continue ")
132+
clear()
133+
main()
134+
135+
136+
def tryall(user):
137+
try:
138+
print("\nb64 decoded:")
139+
base64decode(user)
140+
except Exception as e:
141+
pass
142+
try:
143+
print("\nb32 decoded:")
144+
base32decode(user)
145+
except Exception as e:
146+
pass
147+
try:
148+
print("\nb16 decoded:")
149+
base16decode(user)
150+
except Exception as e:
151+
pass
152+
try:
153+
print("\nb85 decoded:")
154+
base85decode(user)
155+
except Exception as e:
156+
pass
157+
158+
input("\npress enter to continue: ")
159+
clear()
160+
main()
161+
162+
163+
def main():
164+
print(bColors.GREEN + "ENCODING ONLY ON B64")
165+
formats = ["b64", "b32", "b16", "b85", "all", ]
166+
user = input(bColors.BLUE + "Choose base 'b64', 'b32', 'b16', 'b85' or 'all': ")
167+
if user not in formats:
168+
print(bColors.RED + "invalid input!")
169+
main()
170+
171+
string = input("Paste your string: ")
172+
if user == "b64":
173+
b64(string)
174+
if user == "b32":
175+
b32(string)
176+
if user == "b16":
177+
b16(string)
178+
if user == "b85":
179+
b85(string)
180+
if user == "all":
181+
tryall(string)
182+
183+
184+
if default:
185+
banner()
186+
try:
187+
clear()
188+
main()
189+
except KeyboardInterrupt:
190+
clear()
191+
print("KEYBOARD INTERRUPT")

0 commit comments

Comments
 (0)