Пример #1
0
 def test_run(self):
     file_path = os.path.join(pathlib.Path(__file__).absolute().parent.as_posix(), "test_bson.bson")
     CuckooBsonCompressor().run(file_path=file_path)
     try:
         os.unlink("CAPEv2/tests/test_bson.bson.compressed")
     except Exception as e:
         print(("Exception cleaning up, should be fine:" + str(e)))
Пример #2
0
 def test_run(self):
     file_path = os.path.join(os.getcwd(), "tests/test_bson.bson")
     CuckooBsonCompressor().run(file_path=file_path)
     try:
         os.unlink("CAPEv2/tests/test_bson.bson.compressed")
     except Exception as e:
         print(("Exception cleaning up, should be fine:" + str(e)))
Пример #3
0
    def compress_log_file(self, file_path):
        if file_path.endswith(".bson") and os.stat(file_path).st_size:
            if not CuckooBsonCompressor().run(file_path):
                log.warning("Could not execute loop detection analysis.")
            else:
                log.info("BSON was compressed successfully.")
                return True
        else:
            log.warning("Nonexistent or empty BSON file \"%s\".", file_path)

        return False
Пример #4
0
    def compress_log_file(self, file_path):
        if file_path.endswith(".bson") and os.stat(file_path).st_size:
            try:
                if not CuckooBsonCompressor().run(file_path):
                    log.debug("Could not execute loop detection analysis")
                else:
                    log.debug("BSON was compressed successfully")
                    return True
            except Exception as e:
                log.error("BSON compression failed on file %s: %s", file_path, e)
        else:
            log.debug("Nonexistent or empty BSON file %s", file_path)

        return False
Пример #5
0
 def test_init(self):
     assert CuckooBsonCompressor()