Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- badscripts = []
- scriptdir = "/var/log/scripts"
- def unique(seq, keepstr=True):
- t = type(seq)
- if t in (str, unicode):
- t = (list, ''.join)[bool(keepstr)]
- seen = []
- return t(c for c in seq if not (c in seen or seen.append(c)))
- for file in os.listdir(scriptdir):
- for line in open(os.path.join(scriptdir,file)):
- if "cd /" in line:
- #print "file is " + file + "\n"
- #print line
- #if not file in badscripts:
- # badscripts.append(file)
- badscripts.append(file)
- #print badscripts
- print unique(badscripts)
Add Comment
Please, Sign In to add comment