From d64ab41dfd3c892a24282b9e1e77122bc2fb173d Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Tue, 5 Sep 2023 10:23:55 +0000 Subject: [PATCH] tests: proto: add more dynamic proto tests --- tests/fixtures.py | 13 +++++++++++++ tests/test_proto.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/fixtures.py b/tests/fixtures.py index a236252d..5c25a2b2 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -1413,29 +1413,42 @@ def get_result_doc(path: Path): @pytest.fixture def pma0101_rd(): + # python -m capa.main tests/data/Practical\ Malware\ Analysis\ Lab\ 01-01.dll_ --json > tests/data/rd/Practical\ Malware\ Analysis\ Lab\ 01-01.dll_.json return get_result_doc(CD / "data" / "rd" / "Practical Malware Analysis Lab 01-01.dll_.json") @pytest.fixture def dotnet_1c444e_rd(): + # .NET sample + # python -m capa.main tests/data/dotnet/1c444ebeba24dcba8628b7dfe5fec7c6.exe_ --json > tests/data/rd/1c444ebeba24dcba8628b7dfe5fec7c6.exe_.json return get_result_doc(CD / "data" / "rd" / "1c444ebeba24dcba8628b7dfe5fec7c6.exe_.json") @pytest.fixture def a3f3bbc_rd(): + # python -m capa.main tests/data/3f3bbcf8fd90bdcdcdc5494314ed4225.exe_ --json > tests/data/rd/3f3bbcf8fd90bdcdcdc5494314ed4225.exe_.json return get_result_doc(CD / "data" / "rd" / "3f3bbcf8fd90bdcdcdc5494314ed4225.exe_.json") @pytest.fixture def al_khaserx86_rd(): + # python -m capa.main tests/data/al-khaser_x86.exe_ --json > tests/data/rd/al-khaser_x86.exe_.json return get_result_doc(CD / "data" / "rd" / "al-khaser_x86.exe_.json") @pytest.fixture def al_khaserx64_rd(): + # python -m capa.main tests/data/al-khaser_x64.exe_ --json > tests/data/rd/al-khaser_x64.exe_.json return get_result_doc(CD / "data" / "rd" / "al-khaser_x64.exe_.json") @pytest.fixture def a076114_rd(): + # python -m capa.main tests/data/0761142efbda6c4b1e801223de723578.dll_ --json > tests/data/rd/0761142efbda6c4b1e801223de723578.dll_.json return get_result_doc(CD / "data" / "rd" / "0761142efbda6c4b1e801223de723578.dll_.json") + + +@pytest.fixture +def dynamic_a0000a6_rd(): + # python -m capa.main tests/data/dynamic/cape/v2.2/0000a65749f5902c4d82ffa701198038f0b4870b00a27cfca109f8f933476d82.json --json > tests/data/rd/0000a65749f5902c4d82ffa701198038f0b4870b00a27cfca109f8f933476d82.json + return get_result_doc(CD / "data" / "rd" / "0000a65749f5902c4d82ffa701198038f0b4870b00a27cfca109f8f933476d82.json") diff --git a/tests/test_proto.py b/tests/test_proto.py index 5afa405b..e292f2e6 100644 --- a/tests/test_proto.py +++ b/tests/test_proto.py @@ -399,7 +399,7 @@ def assert_round_trip(doc: rd.ResultDocument): pytest.param("a076114_rd"), pytest.param("pma0101_rd"), pytest.param("dotnet_1c444e_rd"), - pytest.param("dynamic_a0000a6_rd") + pytest.param("dynamic_a0000a6_rd"), ], ) def test_round_trip(request, rd_file):