def test_smda_features(sample, scope, feature, expected):
    if scope.__name__ == "file" and isinstance(
            feature, capa.features.file.FunctionName) and expected is True:
        pytest.xfail("SMDA has no function ID")

    fixtures.do_test_feature_presence(fixtures.get_smda_extractor, sample,
                                      scope, feature, expected)
Пример #2
0
def test_dotnetfile_features(sample, scope, feature, expected):
    if scope.__name__ != "file":
        pytest.xfail("dotnetfile only extracts file scope features")

    if isinstance(feature, capa.features.file.FunctionName):
        pytest.xfail("dotnetfile doesn't extract function names")

    fixtures.do_test_feature_presence(fixtures.get_dotnetfile_extractor,
                                      sample, scope, feature, expected)
def test_ida_features():
    for (
            sample, scope, feature, expected
    ) in fixtures.FEATURE_PRESENCE_TESTS + fixtures.FEATURE_PRESENCE_TESTS_IDA:
        id = fixtures.make_test_id((sample, scope, feature, expected))

        try:
            check_input_file(fixtures.get_sample_md5_by_name(sample))
        except RuntimeError:
            print("SKIP %s" % (id))
            continue

        scope = fixtures.resolve_scope(scope)
        sample = fixtures.resolve_sample(sample)

        try:
            fixtures.do_test_feature_presence(get_ida_extractor, sample, scope,
                                              feature, expected)
        except Exception as e:
            print("FAIL %s" % (id))
            traceback.print_exc()
        else:
            print("OK   %s" % (id))
def test_viv_features(sample, scope, feature, expected):
    fixtures.do_test_feature_presence(fixtures.get_viv_extractor, sample, scope, feature, expected)