add suricata to socore group

This commit is contained in:
Jason Ertel
2022-12-05 10:27:42 -05:00
parent 483a9d477f
commit 86c31c129a

View File

@@ -36,19 +36,20 @@ recycle_secs = cfg["filecheck"].get("recycle_secs", 300)
logging.basicConfig(filename=logfile, filemode='w', format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S', level=logging.INFO) logging.basicConfig(filename=logfile, filemode='w', format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S', level=logging.INFO)
def checkexisting(): def checkexisting():
logging.info("Checking for existing files");
for root, dirs, files in os.walk(extract_path): for root, dirs, files in os.walk(extract_path):
for file in files: for file in files:
try: try:
path = os.path.join(root, file) path = os.path.join(root, file)
filename = os.path.join(extract_path, path) filename = os.path.join(extract_path, path)
if os.path.isfile(filename):
logging.info("Processing existing file: " + filename)
checksum(filename) checksum(filename)
except Exception as err: except Exception as err:
logging.error("Failed to process file: " + file) logging.error("Failed to process file: " + file)
def checksum(filename): def checksum(filename):
if os.path.isfile(filename) && "/tmp/" not in filename:
with open(filename, 'rb') as afile: with open(filename, 'rb') as afile:
logging.info("Processing file: " + filename)
shawnuff = hashlib.sha1() shawnuff = hashlib.sha1()
buf = afile.read(8192) buf = afile.read(8192)
while len(buf) > 0: while len(buf) > 0:
@@ -73,10 +74,7 @@ def process(filename, hizash):
class CreatedEventHandler(FileSystemEventHandler): class CreatedEventHandler(FileSystemEventHandler):
def on_created(self, event): def on_created(self, event):
filename = event.src_path checksum(event.src_path)
if os.path.isfile(filename):
logging.info("Found new file: " + filename)
checksum(filename)
if __name__ == "__main__": if __name__ == "__main__":
logging.info("Starting filecheck") logging.info("Starting filecheck")