Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to angr==9.2.77 #417

Merged
merged 29 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
29762d4
Use python3.8 in docker images
ANogin Feb 9, 2024
67ee05e
Require pytest<8.0
ANogin Feb 9, 2024
500ee9b
Update changelog
ANogin Feb 9, 2024
0fe707e
Revert "Update changelog"
ANogin Feb 9, 2024
e2a0110
Update to latest angr==9.2.89, which also necessitates Python >= 3.8 …
ANogin Feb 9, 2024
24956a3
Apply Edward's attempted fix to angr test failure
ANogin Feb 10, 2024
99f26d5
Add a note on recommending Python 3.8
ANogin Feb 11, 2024
5e47d44
Add a note on recommending Python 3.8
ANogin Feb 11, 2024
c39748e
Document the requirement of Python 3.8+
ANogin Feb 12, 2024
c8d22c0
Switch to angr 9.2.77
ANogin Feb 12, 2024
8f59c22
`ofrak_core` also needs `pytest<8.0`
ANogin Feb 12, 2024
7f4fd54
Merge branch 'feature/python3.8' into feature/latest_angr
ANogin Feb 12, 2024
23d11ef
Merge branch 'master' into feature/latest_angr
ANogin Feb 12, 2024
330e46a
ignore DataWord in test due to angr bug
Edward-Larson Feb 17, 2024
5765d8a
add another now missing block
Edward-Larson Feb 17, 2024
300e29f
black linting
Edward-Larson Feb 17, 2024
5b9ae31
Merge pull request #1 from EdwardLarson/feature/latest_angr
ANogin Feb 17, 2024
2bd7547
Attempt to fix a capstone error
ANogin Feb 17, 2024
3801736
Dropping the .altinstr_replacement section from the toolchain (#414)
rbs-alexr Feb 13, 2024
a73db96
Set the fallback font to monospace (#422)
rbs-jacob Feb 14, 2024
2a9a344
Display strings with numbers primarily as strings (#423)
rbs-jacob Feb 16, 2024
86a0445
Add typing support to ofrak_ghidra package (#421)
paulnoalhyt Feb 17, 2024
9701ba7
Increase time limit on `test_comment_content`
ANogin Feb 17, 2024
1249ed8
Fix a spurious "no current event loop" test error
ANogin Feb 17, 2024
ef67831
Merge remote-tracking branch 'origin/master' into feature/latest_angr
ANogin Feb 18, 2024
f019d48
Explain 3.7 vs 3.8 better in the docs
ANogin Feb 21, 2024
5237d9a
Cite specific versions of angr in comment
ANogin Feb 21, 2024
7634cb2
Update docs/environment-setup.md
whyitfor Feb 22, 2024
64518d5
Update docs/getting-started.md
whyitfor Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions disassemblers/ofrak_angr/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased](https://github.com/redballoonsecurity/ofrak/tree/master)

### Changed
- Update to latest angr==9.2.77, which also necessitates Python >= 3.8.

### Fixed
- Add `importlib-resources` dependency as workaround for z3-solver dependency issue. ([#401](https://github.com/redballoonsecurity/ofrak/pull/401))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _angr_get_dword_blocks(
if xref is None or not any(xref in bb_range for bb_range in valid_data_xref_ranges):
continue

LOGGER.debug(f"Creating DataWord for {cb_data_xref.content} @ {cb_data_xref_addr:#x}")
LOGGER.debug(f"Creating DataWord for {cb_data_xref.content!r} @ {cb_data_xref_addr:#x}")

format_string = endian_flag + dword_size_map[word_size]

Expand Down
18 changes: 17 additions & 1 deletion disassemblers/ofrak_angr/ofrak_angr_test/test_unpackers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,30 @@ async def expected_results(self, unpack_verify_test_case: ComplexBlockUnpackerTe
0x110,
0x110,
0x130,
keep_same_is_exit_point=True,
keep_same_is_exit_point=False,
)

return self._fixup_test_case_for_pie(
unpack_verify_test_case.expected_results,
pie_base_vaddr=0x400000,
)

elif unpack_verify_test_case.binary_md5_digest == "c79d1bea0398d7a9d0faa1ba68786f5e":
# Latest version of angr misses this DataWord now = the ref to it does not appear in the list of xrefs
ANogin marked this conversation as resolved.
Show resolved Hide resolved

missing_data_words = {0x8030, 0x8060}

fixed_up_results = {
vaddr: [
block
for block in original_expected_blocks
if block.virtual_address not in missing_data_words
]
for vaddr, original_expected_blocks in unpack_verify_test_case.expected_results.items()
}

return fixed_up_results

return unpack_verify_test_case.expected_results

def _split_bb(
Expand Down
2 changes: 1 addition & 1 deletion disassemblers/ofrak_angr/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
angr==9.2.6
angr==9.2.77
importlib-resources # A workaround for https://github.com/redballoonsecurity/ofrak/issues/398
2 changes: 1 addition & 1 deletion disassemblers/ofrak_angr/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def read_requirements(requirements_path):
"Topic :: Security",
"Typing :: Typed",
],
python_requires=">=3.7",
python_requires=">=3.8",
license="Proprietary",
license_files=["LICENSE"],
cmdclass={"egg_info": egg_info_ex},
Expand Down
3 changes: 3 additions & 0 deletions disassemblers/ofrak_capstone/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased](https://github.com/redballoonsecurity/ofrak/tree/master)

### Changed
- Update to captione==5.0.0.post1.

## 1.0.0 - 2022-01-25
### Added
Initial release. Hello world!
2 changes: 1 addition & 1 deletion disassemblers/ofrak_capstone/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
capstone==4.0.2
capstone==5.0.0.post1
2 changes: 1 addition & 1 deletion docs/environment-setup.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Environment Setup & Installing OFRAK

!!! warning
OFRAK is a Python library supporting Python3.7 and up. First and foremost, make sure your Python and pip installations are for Python3.7+! Python 3.8 is recommended, as this is the version we primarily test OFRAK with.
OFRAK is a Python library supporting Python3.8 and up. First and foremost, make sure your Python and pip installations are for Python3.8+! Python 3.8 is recommended, as this is the version we primarily test OFRAK with.

There are three main ways one can set up an environment to use OFRAK:

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Quick Start - Unpack a firmware file and display it in the GUI

!!! warning
OFRAK is a Python library supporting Python3.7 and up. First and foremost, make sure your Python and pip installations are for Python3.7+! Python 3.8 is recommended, as this is the version we primarily test OFRAK with.
OFRAK is a Python library supporting Python3.8 and up. First and foremost, make sure your Python and pip installations are for Python3.8+! Python 3.8 is recommended, as this is the version we primarily test OFRAK with.
ANogin marked this conversation as resolved.
Show resolved Hide resolved

```bash
pip install ofrak
Expand Down
8 changes: 8 additions & 0 deletions ofrak_core/pytest_ofrak/patterns/basic_block_unpacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,14 @@ class BasicBlockUnpackerTestCase(
operands="",
mode=InstructionSetMode.NONE,
),
Instruction(
virtual_address=0x4004E0,
size=2,
disassembly="repz ret ",
mnemonic="repz ret",
operands="",
mode=InstructionSetMode.NONE,
),
),
],
0x4004F0: [
Expand Down
6 changes: 3 additions & 3 deletions ofrak_core/pytest_ofrak/patterns/complex_block_unpacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class ComplexBlockUnpackerTestCase(UnpackAndVerifyTestCase[int, List[Union[Basic
is_exit_point=True,
exit_vaddr=None,
),
DataWord(virtual_address=32816, size=4, format_string="<L", xrefs_to=(32792,)),
DataWord(virtual_address=0x8030, size=4, format_string="<L", xrefs_to=(32792,)),
],
0x8034: [
BasicBlock(
Expand All @@ -255,8 +255,8 @@ class ComplexBlockUnpackerTestCase(UnpackAndVerifyTestCase[int, List[Union[Basic
is_exit_point=False,
exit_vaddr=32856,
),
DataWord(virtual_address=32864, size=4, format_string="<L", xrefs_to=(32820,)),
DataWord(virtual_address=32868, size=4, format_string="<L", xrefs_to=(32840,)),
DataWord(virtual_address=0x8060, size=4, format_string="<L", xrefs_to=(32820,)),
DataWord(virtual_address=0x8064, size=4, format_string="<L", xrefs_to=(32840,)),
],
0x8068: [
BasicBlock(
Expand Down
6 changes: 5 additions & 1 deletion ofrak_core/test_ofrak/components/test_comments.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import timedelta
import pytest
from hypothesis import given, HealthCheck, settings
from hypothesis.strategies import text
Expand Down Expand Up @@ -38,7 +39,10 @@ async def test_adding_comments(executable_resource: Resource):
# We suppress the function_scoped_fixture health check because the executable_resource fixture
# doesn't need to be reset between individual runs of hypothesis (since the comment overrides
# the previous one every time).
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
@settings(
suppress_health_check=[HealthCheck.function_scoped_fixture],
deadline=timedelta(seconds=5),
)
@given(comment_str=text())
async def test_comment_content(executable_resource: Resource, comment_str: str):
"""Test comments with all kinds of string contents."""
Expand Down
3 changes: 3 additions & 0 deletions ofrak_core/test_ofrak/unit/test_ofrak_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ async def run_component_with_installed_dependency(ofrak_context: OFRAKContext):


def test_get_ofrak_context_over_time():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

# No active context before running OFRAK
with pytest.raises(InvalidStateError):
get_current_ofrak_context()
Expand Down
Loading