Skip to content

Commit

Permalink
Update to angr==9.2.77 (#417)
Browse files Browse the repository at this point in the history
* Use python3.8 in docker images

* Require pytest<8.0

This is needed becase of pytest-dev/pytest#11890
TvoroG/pytest-lazy-fixture#65

* Update changelog

* Revert "Update changelog"

This reverts commit 500ee9b.

Making changes before having coffee :(

* Update to latest angr==9.2.89, which also necessitates Python >= 3.8 and capstone==5.0.0.post1

* Apply Edward's attempted fix to angr test failure

* Add a note on recommending Python 3.8

* Add a note on recommending Python 3.8

* Document the requirement of Python 3.8+

* Switch to angr 9.2.77

* `ofrak_core` also needs `pytest<8.0`

* ignore DataWord in test due to angr bug

* add another now missing block

* black linting

* Attempt to fix a capstone error

* Dropping the .altinstr_replacement section from the toolchain (#414)

* Dropping the .altinstr_replacement section from the toolchain

* Updated CHANGELOG

* Set the fallback font to monospace (#422)

* Set the fallback font to monospace

* Update CHANGELOG

* Display strings with numbers primarily as strings (#423)

* Display strings with numbers primarily as strings

* Update CHANGELOG

* Add typing support to ofrak_ghidra package (#421)

* Add typing to ofrak_ghidra package

* Add changelog

---------

Co-authored-by: Paul Noalhyt <paul@redballoonsecurity.com>

* Increase time limit on `test_comment_content`

* Fix a spurious "no current event loop" test error

* Explain 3.7 vs 3.8 better in the docs

* Cite specific versions of angr in comment

* Update docs/environment-setup.md

* Update docs/getting-started.md

---------

Co-authored-by: Edward Larson <edward@redballoonsecurity.com>
Co-authored-by: rbs-alexr <122491504+rbs-alexr@users.noreply.github.com>
Co-authored-by: Jacob Strieb <99368685+rbs-jacob@users.noreply.github.com>
Co-authored-by: Paul Noalhyt <paul.noalhyt@gmail.com>
Co-authored-by: Paul Noalhyt <paul@redballoonsecurity.com>
Co-authored-by: Wyatt <53830972+whyitfor@users.noreply.github.com>
  • Loading branch information
7 people authored Feb 22, 2024
1 parent f05d3ca commit 8fe5083
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 10 deletions.
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
19 changes: 18 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,31 @@ 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":
# Unlike angr 9.2.6, angr 9.2.77 and 9.2.91 miss this DataWord now
# = the ref to it does not appear in the list of xrefs

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.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, and some packages (for example, ofrak-angr) require Python >=3.8.

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.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, and some packages (for example, ofrak-angr) require Python >=3.8.

```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

0 comments on commit 8fe5083

Please sign in to comment.