Advertisement
Falexom

Untitled

Dec 2nd, 2022
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. import subprocess
  2. from var import pwd
  3.  
  4.  
  5. names = []
  6. ls = subprocess.Popen(["ls", "-p", "."],  stdout=subprocess.PIPE,)
  7. grep = subprocess.Popen(["grep", "-v", "/$"],  stdin=ls.stdout, stdout=subprocess.PIPE,)
  8. files = grep.stdout
  9.  
  10. for line in files:
  11.     line = str(line, 'utf-8')
  12.     line = line.replace("\n", '')  
  13.     names.append(line)
  14.  
  15. table = open("template.tbl", "r")
  16. tables = []
  17.  
  18. for i in table:
  19.     j = str(i)
  20.     j = j.replace("\n", '')
  21.     tables.append(j)
  22.  
  23.  
  24. for line in tables:
  25.     if line in names:
  26.         subprocess.run(f'sudo chmod 000 {pwd}/{line}', shell=True, check=True)
  27.         subprocess.run(f'sudo chattr +i {pwd}/{line}', shell=True, check=True)
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement