diff --git a/mcrit/config/StorageConfig.py b/mcrit/config/StorageConfig.py index 5239b69..2356754 100644 --- a/mcrit/config/StorageConfig.py +++ b/mcrit/config/StorageConfig.py @@ -7,7 +7,7 @@ @dataclass class StorageConfig(ConfigInterface): - # storage configuration, use "memory" for local testing or "alchemy" when working with larger data + # storage configuration, use "memory" for local testing or "mongodb" when working with larger data # STORAGE_METHOD = StorageFactory.STORAGE_METHOD_MEMORY STORAGE_METHOD: ... = StorageFactory.STORAGE_METHOD_MONGODB # Use this as endpoint for our server diff --git a/mcrit/storage/FunctionEntry.py b/mcrit/storage/FunctionEntry.py index 11371bc..895f079 100644 --- a/mcrit/storage/FunctionEntry.py +++ b/mcrit/storage/FunctionEntry.py @@ -15,9 +15,6 @@ # constructor -> .fromSmdaFunction # assume sample_entry, smda_function always available -# TODO remove (everywhere) from alchemy function - - class FunctionEntry(object): # MCRIT specific function_id: int @@ -123,25 +120,6 @@ def fromDict(cls, entry_dict): function_entry.xcfg = entry_dict["xcfg"] if "xcfg" in entry_dict else None return function_entry - @classmethod - def fromAlchemyFunction(cls, function): - function_entry = cls(None, None) # type:ignore - function_entry.binweight = function.binweight - function_entry.function_id = function.id - function_entry.family_id = function.family.id - function_entry.sample_id = function.sample.id - function_entry.architecture = function.architecture.name - function_entry.function_name = function.function_name - if function.pichash: - function_entry.pichash = function.pichash.pichash - if function.minhash: - function_entry.minhash = function.minhash.minhash - function_entry.num_blocks = function.num_blocks - function_entry.num_instructions = function.num_instructions - function_entry.offset = function.offset - function_entry.xcfg = function.xcfg - return function_entry - def __str__(self): return "Family: {} Sample: {} Function: {} @ 0x{:08x} - {} blocks ({} hashes), {} instructions - pichash: {}".format( self.family_id, diff --git a/mcrit/storage/SampleEntry.py b/mcrit/storage/SampleEntry.py index 89a40d5..719d7d5 100644 --- a/mcrit/storage/SampleEntry.py +++ b/mcrit/storage/SampleEntry.py @@ -102,27 +102,6 @@ def fromDict(cls, entry_dict): sample_entry.timestamp = datetime.datetime.strptime(entry_dict["timestamp"], "%Y-%m-%dT%H-%M-%S") return sample_entry - @classmethod - def fromAlchemySample(cls, sample): - sample_entry = cls(None) #type:ignore - sample_entry.sample_id = sample.id - sample_entry.family_id = sample.family.id - sample_entry.family = sample.family.name - sample_entry.architecture = sample.architecture.name - sample_entry.base_addr = sample.base_addr - sample_entry.binary_size = sample.binary_size - sample_entry.component = sample.component - sample_entry.binweight = sample.binweight - sample_entry.bitness = sample.bitness.name - sample_entry.version = sample.version - sample_entry.is_library = sample.is_library - sample_entry.filename = sample.filename - sample_entry.sha256 = sample.sha256 - sample_entry.smda_version = sample.smda_version - sample_entry.statistics = sample.statistics - sample_entry.timestamp = sample.timestamp - return sample_entry - def __str__(self): return "Sample {} ({}, {} bit) - {} ({}): ".format( self.sample_id, self.architecture, self.bitness, self.filename, self.family diff --git a/mcrit/storage/StorageFactory.py b/mcrit/storage/StorageFactory.py index d14971d..cb02dcc 100644 --- a/mcrit/storage/StorageFactory.py +++ b/mcrit/storage/StorageFactory.py @@ -1,4 +1,3 @@ -# from mcrit.storage.alchemy.AlchemyStorage import AlchemyStorage from mcrit.storage.MemoryStorage import MemoryStorage from mcrit.storage.MongoDbStorage import MongoDbStorage @@ -6,14 +5,10 @@ class StorageFactory: STORAGE_METHOD_MEMORY = "memory" - STORAGE_METHOD_ALCHEMY = "alchemy" STORAGE_METHOD_MONGODB = "mongodb" @staticmethod def getStorage(mcrit_config): if mcrit_config.STORAGE_CONFIG.STORAGE_METHOD == StorageFactory.STORAGE_METHOD_MONGODB: return MongoDbStorage(mcrit_config) - # Alchemy not supported right now - # if storage_config.STORAGE_METHOD == StorageFactory.STORAGE_METHOD_ALCHEMY: - # return AlchemyStorage(storage_config) return MemoryStorage(mcrit_config)