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>
37 lines
954 B
Python
Executable file
37 lines
954 B
Python
Executable file
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
__package__ = __package__ or "tests.analyses" # pylint:disable=redefined-builtin
|
|
|
|
import os.path
|
|
from unittest import TestCase, main
|
|
|
|
import angr
|
|
from tests.common import bin_location
|
|
|
|
test_location = os.path.join(bin_location, "tests")
|
|
|
|
|
|
# pylint: disable=no-self-use
|
|
class CFBlanketTests(TestCase):
|
|
"""
|
|
Test CFBlanket analysis
|
|
"""
|
|
|
|
def test_on_object_added_callback(self):
|
|
my_callback_artifacts = {}
|
|
|
|
def my_callback(addr, obj):
|
|
my_callback_artifacts[addr] = obj
|
|
|
|
p = angr.Project(os.path.join(test_location, "x86_64", "fauxware"), load_options={"auto_load_libs": False})
|
|
cfb = p.analyses.CFB(on_object_added=my_callback)
|
|
|
|
addr = 0x1_00000000
|
|
obj = "my object"
|
|
cfb.add_obj(addr, obj)
|
|
assert addr in my_callback_artifacts and my_callback_artifacts[addr] == obj
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|