Advertisement
Falexom

Untitled

Dec 2nd, 2022 (edited)
776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import os
  2. import glob
  3. import subprocess
  4. from var import pwd, allowed
  5. import time
  6.  
  7. masks = []
  8.  
  9. table = open("template.tbl", "r")
  10. tables = []
  11.  
  12. for i in table:
  13.     j = str(i)
  14.     j = j.replace("\n", '')
  15.     tables.append(j)
  16.  
  17. for i in tables:
  18.     head, sep, tail = i.partition('.')
  19.     tail = '*'
  20.     i = head+tail
  21.     masks.append(i)
  22.  
  23. print("MASK:", masks)
  24. subprocess.run(f'sudo chmod 000 {pwd}/template.tbl', shell=True, check=True)
  25. subprocess.run(f'sudo chattr +i {pwd}/template.tbl', shell=True, check=True)
  26.  
  27. while True:
  28.     for name in masks:
  29.             for file in glob.glob(name):
  30.                 if allowed == True:
  31.                     exit(0)
  32.                 if allowed == False:
  33.                     try:
  34.                         time.sleep(5)
  35.                         os.remove(file)
  36.                         print("Removed:", file)
  37.                     except:
  38.                         PermissionError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement