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>
40 lines
1.1 KiB
Python
Executable file
40 lines
1.1 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
__package__ = __package__ or "tests.exploration_techniques" # pylint:disable=redefined-builtin
|
|
|
|
import os
|
|
import unittest
|
|
|
|
import angr
|
|
from tests.common import bin_location
|
|
|
|
test_location = os.path.join(bin_location, "tests")
|
|
|
|
find = {"veritesting_a": {"x86_64": 0x40066A}}
|
|
|
|
criteria = {"veritesting_a": lambda input_found: input_found.count(b"B") == 10}
|
|
|
|
|
|
class TestRunUnique(unittest.TestCase):
|
|
def _run_unique(self, binary, arch):
|
|
proj = angr.Project(os.path.join(test_location, arch, binary), auto_load_libs=False)
|
|
simgr = proj.factory.simulation_manager()
|
|
technique = angr.exploration_techniques.UniqueSearch()
|
|
simgr.use_technique(technique)
|
|
|
|
def found(simgr):
|
|
return simgr.active[0].addr == find[binary][arch]
|
|
|
|
simgr.run(until=found)
|
|
assert simgr.active[0].addr == find[binary][arch]
|
|
|
|
input_found = simgr.active[0].posix.dumps(0)
|
|
assert criteria[binary](input_found)
|
|
|
|
def test_unique(self):
|
|
self._run_unique("veritesting_a", "x86_64")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|