mirror of
https://github.com/angr/angr
synced 2026-08-17 12:23:11 -04:00
* Enable ruff isort rule * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
34 lines
1,011 B
Python
Executable file
34 lines
1,011 B
Python
Executable file
#!/usr/bin/env python3
|
|
# pylint: disable=missing-class-docstring,disable=no-self-use
|
|
from __future__ import annotations
|
|
|
|
__package__ = __package__ or "tests.analyses" # pylint:disable=redefined-builtin
|
|
|
|
import logging
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
import angr
|
|
from tests.common import bin_location
|
|
|
|
|
|
@unittest.skipIf(sys.platform == "win32", "broken on windows")
|
|
class TestIdentifier(unittest.TestCase):
|
|
def test_comparison_identification(self):
|
|
true_symbols = {0x804A3D0: "strncmp", 0x804A0F0: "strcmp", 0x8048E60: "memcmp", 0x8049F40: "strcasecmp"}
|
|
|
|
p = angr.Project(os.path.join(bin_location, "tests", "i386", "identifiable"))
|
|
idfer = p.analyses.Identifier(require_predecessors=False)
|
|
|
|
seen = {}
|
|
for addr, symbol in idfer.run():
|
|
seen[addr] = symbol
|
|
|
|
for addr, symbol in true_symbols.items():
|
|
assert symbol == seen[addr]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.getLogger("identifier").setLevel("DEBUG")
|
|
unittest.main()
|