Guest User

Untitled

a guest
May 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import os
  2.  
  3. badscripts = []
  4. scriptdir = "/var/log/scripts"
  5.  
  6. def unique(seq, keepstr=True):
  7.     t = type(seq)
  8.     if t in (str, unicode):
  9.         t = (list, ''.join)[bool(keepstr)]
  10.     seen = []
  11.     return t(c for c in seq if not (c in seen or seen.append(c)))
  12.  
  13. for file in os.listdir(scriptdir):
  14.     for line in open(os.path.join(scriptdir,file)):
  15.             if "cd /" in line:
  16.                 #print "file is " + file + "\n"
  17.                 #print line
  18.                 #if not file in badscripts:
  19.                 #    badscripts.append(file)
  20.                 badscripts.append(file)
  21.  
  22. #print badscripts
  23. print unique(badscripts)
Add Comment
Please, Sign In to add comment