|
|
@ -268,7 +268,7 @@ def contentfilter(fsname, pattern):
|
|
|
|
if prog.match(line):
|
|
|
|
if prog.match(line):
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
return False
|
|
|
|
return False
|
|
|
@ -280,12 +280,12 @@ def statinfo(st):
|
|
|
|
|
|
|
|
|
|
|
|
try: # user data
|
|
|
|
try: # user data
|
|
|
|
pw_name = pwd.getpwuid(st.st_uid).pw_name
|
|
|
|
pw_name = pwd.getpwuid(st.st_uid).pw_name
|
|
|
|
except:
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
try: # group data
|
|
|
|
try: # group data
|
|
|
|
gr_name = grp.getgrgid(st.st_gid).gr_name
|
|
|
|
gr_name = grp.getgrgid(st.st_gid).gr_name
|
|
|
|
except:
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -393,7 +393,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
st = os.lstat(fsname)
|
|
|
|
st = os.lstat(fsname)
|
|
|
|
except:
|
|
|
|
except Exception:
|
|
|
|
msg += "%s was skipped as it does not seem to be a valid file or it cannot be accessed\n" % fsname
|
|
|
|
msg += "%s was skipped as it does not seem to be a valid file or it cannot be accessed\n" % fsname
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
@ -402,6 +402,8 @@ def main():
|
|
|
|
if pfilter(fsobj, params['patterns'], params['excludes'], params['use_regex']) and agefilter(st, now, age, params['age_stamp']):
|
|
|
|
if pfilter(fsobj, params['patterns'], params['excludes'], params['use_regex']) and agefilter(st, now, age, params['age_stamp']):
|
|
|
|
|
|
|
|
|
|
|
|
r.update(statinfo(st))
|
|
|
|
r.update(statinfo(st))
|
|
|
|
|
|
|
|
if stat.S_ISREG(st.st_mode) and params['get_checksum']:
|
|
|
|
|
|
|
|
r['checksum'] = module.sha1(fsname)
|
|
|
|
filelist.append(r)
|
|
|
|
filelist.append(r)
|
|
|
|
|
|
|
|
|
|
|
|
elif stat.S_ISDIR(st.st_mode) and params['file_type'] == 'directory':
|
|
|
|
elif stat.S_ISDIR(st.st_mode) and params['file_type'] == 'directory':
|
|
|
|