-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathBase64_encode.py
More file actions
28 lines (20 loc) · 855 Bytes
/
Base64_encode.py
File metadata and controls
28 lines (20 loc) · 855 Bytes
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
import base64
class Encode:
def __init__(self):
self.text = ""
self.enc_txt = ""
def encode(self, filename):
with open(filename, "r", encoding="utf8", errors="ignore") as f:
lines_list = f.readlines()
for lines in lines_list:
self.text += lines
self.text = self.text.encode()
self.enc_txt = base64.b64encode(self.text)
with open(filename, "w") as f:
f.write(f"import base64; exec(base64.b64decode({self.enc_txt}))")
if __name__ == '__main__':
filename = input("[?] Enter Filename : ")
print(f"\n[*] Initaiting Base64 Encryption Process ...")
test = Encode()
test.encode(filename)
print(f"[+] Operation Completed Successfully!\n")