-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bse64.py
76 lines (61 loc) · 1.95 KB
/
bse64.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
import sys
import base64
import argparse
parser = argparse.ArgumentParser(description="A simple tool to encode base64 and base32",
usage="%(prog)s --b64/--b32 cipher",
epilog="Example %(prog)s --b64 QWRhcnNoIEFkZGVl")
parser.add_argument("-b64", "--base64",
help="decode base64 encoding",
metavar="base64",
dest="b64",
nargs="+")
parser.add_argument("-b32", "--base32",
help="decode base32 encoding",
metavar="base32",
dest="b32",
nargs="+")
parser.add_argument("-o", "--output",
help="saves output in file",
dest="out",
metavar="output")
parser.add_argument("-v",
help="version",
version="%(prog)s 1.0",
action="version")
args = parser.parse_args()
b64 = args.b64
b32 = args.b32
out = args.out
def banner():
bann = """
___. ________ _____
\_ |__ _____ ______ ____ / _____/ / | |
| __ \\__ \ / ___// __ \/ __ \ / | |_
| \_\ \/ __ \_\___ \\ ___/\ |__\ \/ ^ /
|___ (____ /____ >\___ >\_____ /\____ |
\/ \/ \/ \/ \/ |__|
"""
print(bann)
print("[*] Made By Adarsh Addee!")
def decode():
if b64:
for i in b64:
res = (base64.b64decode(i)).decode()
print(res)
output(res)
if b32:
for i in b32:
res = (base64.b32decode(i)).decode()
print(res)
output(res)
def output(code):
if out:
with open(f"{out}", "a") as f:
f.write(code)
f.write("\n")
if len(sys.argv) == 1:
banner()
parser.print_help(sys.stderr)
sys.exit(1)
if __name__ == "__main__":
decode()