mirror of
https://github.com/mandiant/capa.git
synced 2025-12-23 07:28:34 -08:00
add helper function
This commit is contained in:
@@ -1103,61 +1103,39 @@ def _039a6_dotnetfile_extractor():
|
|||||||
return get_dnfile_extractor(get_data_path_by_name("_039a6"))
|
return get_dnfile_extractor(get_data_path_by_name("_039a6"))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
def get_result_doc(path):
|
||||||
def pma0101_rd():
|
|
||||||
path = os.path.join(CD, "data", "Practical Malware Analysis Lab 01-01.dll_.json")
|
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
buf = f.read()
|
buf = f.read()
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
src = buf.decode("utf-8")
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
return capa.render.result_document.ResultDocument.parse_raw(src)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def pma0101_rd():
|
||||||
|
# TODO move to rd subdir
|
||||||
|
return get_result_doc(os.path.join(CD, "data", "Practical Malware Analysis Lab 01-01.dll_.json"))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def dotnet_1c444e_rd():
|
def dotnet_1c444e_rd():
|
||||||
path = os.path.join(CD, "data", "dotnet", "1c444ebeba24dcba8628b7dfe5fec7c6.exe_.json")
|
return get_result_doc(os.path.join(CD, "data", "dotnet", "1c444ebeba24dcba8628b7dfe5fec7c6.exe_.json"))
|
||||||
with open(path, "rb") as f:
|
|
||||||
buf = f.read()
|
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def a3f3bbc_rd():
|
def a3f3bbc_rd():
|
||||||
path = os.path.join(CD, "data", "3f3bbcf8fd90bdcdcdc5494314ed4225.exe_.json")
|
return get_result_doc(os.path.join(CD, "data", "3f3bbcf8fd90bdcdcdc5494314ed4225.exe_.json"))
|
||||||
with open(path, "rb") as f:
|
|
||||||
buf = f.read()
|
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def al_khaserx86_rd():
|
def al_khaserx86_rd():
|
||||||
path = os.path.join(CD, "data", "al-khaser_x86.exe_.json")
|
return get_result_doc(os.path.join(CD, "data", "al-khaser_x86.exe_.json"))
|
||||||
with open(path, "rb") as f:
|
|
||||||
buf = f.read()
|
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def al_khaserx64_rd():
|
def al_khaserx64_rd():
|
||||||
path = os.path.join(CD, "data", "al-khaser_x64.exe_.json")
|
return get_result_doc(os.path.join(CD, "data", "al-khaser_x64.exe_.json"))
|
||||||
with open(path, "rb") as f:
|
|
||||||
buf = f.read()
|
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def a076114_rd():
|
def a076114_rd():
|
||||||
path = os.path.join(CD, "data", "0761142efbda6c4b1e801223de723578.dll_.json")
|
return get_result_doc(os.path.join(CD, "data", "0761142efbda6c4b1e801223de723578.dll_.json"))
|
||||||
with open(path, "rb") as f:
|
|
||||||
buf = f.read()
|
|
||||||
|
|
||||||
src = buf.decode("utf-8")
|
|
||||||
return capa.render.result_document.ResultDocument.parse_raw(src)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user