Skip to content

Commit

Permalink
skip test for now due to issue in dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DennyDai committed Jan 8, 2024
1 parent 84e581f commit 2dc9cf0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/patcherex2/components/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def insert_trampoline_code(self, addr, instrs, force_insert=False, detour_pos=-1
self.p.assembler.assemble(
moved_instrs,
addr, # TODO: we don't really need this addr, but better than 0x0 because 0x0 is too far away from the code
is_thumb=self.p.binary_analyzer.is_thumb(addr)
is_thumb=self.p.binary_analyzer.is_thumb(addr),
)
)
trempoline_instrs_with_jump_back = (
Expand Down
20 changes: 11 additions & 9 deletions tests/test_i386.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess
import tempfile
import unittest
import pytest

from patcherex2 import *

Expand Down Expand Up @@ -34,7 +35,7 @@ def test_raw_file_patch(self):
def test_raw_mem_patch(self):
self.run_one(
"printf_nopie",
[ModifyRawBytesPatch(0x804a008, b"No")],
[ModifyRawBytesPatch(0x804A008, b"No")],
expected_output=b"No",
expected_returnCode=0,
)
Expand All @@ -60,7 +61,7 @@ def test_insert_instruction_patch(self):
"""
self.run_one(
"printf_nopie",
[InsertInstructionPatch(0x80491a7, instrs)],
[InsertInstructionPatch(0x80491A7, instrs)],
expected_output=b"Hi\x00Hi",
expected_returnCode=0,
)
Expand All @@ -75,7 +76,7 @@ def test_insert_instruction_patch_2(self):
"printf_nopie",
[
InsertInstructionPatch("return_0x32", instrs),
ModifyInstructionPatch(0x80491a7, "jmp {return_0x32}"),
ModifyInstructionPatch(0x80491A7, "jmp {return_0x32}"),
],
expected_returnCode=0x32,
)
Expand All @@ -84,7 +85,7 @@ def test_remove_instruction_patch(self):
self.run_one(
"printf_nopie",
[
RemoveInstructionPatch(0x804a009, num_bytes=1),
RemoveInstructionPatch(0x804A009, num_bytes=1),
],
expected_output=b"H\x90",
expected_returnCode=0,
Expand All @@ -93,7 +94,7 @@ def test_remove_instruction_patch(self):
def test_modify_data_patch(self):
self.run_one(
"printf_nopie",
[ModifyDataPatch(0x804a008, b"No")],
[ModifyDataPatch(0x804A008, b"No")],
expected_output=b"No",
expected_returnCode=0,
)
Expand All @@ -107,7 +108,7 @@ def test_insert_data_patch(self, tlen=5):
mov edx, %s
int 0x80
""" % hex(tlen)
p2 = InsertInstructionPatch(0x80491a7, instrs)
p2 = InsertInstructionPatch(0x80491A7, instrs)
self.run_one(
"printf_nopie",
[p1, p2],
Expand All @@ -118,7 +119,7 @@ def test_insert_data_patch(self, tlen=5):
def test_remove_data_patch(self):
self.run_one(
"printf_nopie",
[RemoveDataPatch(0x804a009, 1)],
[RemoveDataPatch(0x804A009, 1)],
expected_output=b"H",
expected_returnCode=0,
)
Expand All @@ -129,11 +130,12 @@ def test_replace_function_patch(self):
"""
self.run_one(
"replace_function_patch",
[ModifyFunctionPatch(0x119d, code)],
[ModifyFunctionPatch(0x119D, code)],
expected_output=b"70707070",
expected_returnCode=0,
)

@pytest.mark.skip(reason="waiting for cle relocation support")
def test_replace_function_patch_with_function_reference(self):
code = """
extern int add(int, int);
Expand All @@ -142,7 +144,7 @@ def test_replace_function_patch_with_function_reference(self):
"""
self.run_one(
"replace_function_patch",
[ModifyFunctionPatch(0x11c9, code)],
[ModifyFunctionPatch(0x11C9, code)],
expected_output=b"-21-21",
expected_returnCode=0,
)
Expand Down

0 comments on commit 2dc9cf0

Please sign in to comment.