-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecryption.py
More file actions
35 lines (26 loc) · 797 Bytes
/
decryption.py
File metadata and controls
35 lines (26 loc) · 797 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
29
30
31
32
33
34
35
import pyAesCrypt
import os
# import sys
def decryption(file, password):
buffer_size = 512 * 1024
pyAesCrypt.decryptFile(
str(file),
str(os.path.splitext(file)[0]),
password,
buffer_size
)
print("[File: '" + str(os.path.splitext(file)[0]) + " decrypted]")
os.remove(file)
def walking_by_dirs(dir, password):
for name in os.listdir(dir):
path = os.path.join(dir, name)
if os.path.isfile(path):
try:
decryption(path, password)
except Exception as ex:
print(ex)
else:
walking_by_dirs(path, password)
password = input("Write a password for decryption: ")
walking_by_dirs("/pathtofoldertodecrypt", password)
# os.remove(str(sys.argv[0]))