Skip to content

Commit

Permalink
Merge pull request #171 from ramikg/patch-1
Browse files Browse the repository at this point in the history
Make badbytes range inclusive
  • Loading branch information
SweetVishnya authored Apr 2, 2021
2 parents a4b583f + 6777354 commit 2f49bdf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ropgadget/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def __isGadgetCallPreceded(gadget):
print("Options().removeNonCallPreceded(): Unsupported architecture.")

def __deleteBadBytes(self):
archMode = self.__binary.getArchMode()
if not self.__options.badbytes:
return
new = []
Expand All @@ -131,7 +130,7 @@ def __deleteBadBytes(self):
rng = bb.split('-')
low = ord(codecs.decode(rng[0], "hex"))
high = ord(codecs.decode(rng[1], "hex"))
bbytes += bytes(bytearray(i for i in range(low, high)))
bbytes += bytes(bytearray(i for i in range(low, high + 1)))
else:
bbytes.append(codecs.decode(bb.encode("ascii"), "hex"))

Expand Down
Binary file modified test-suite-binaries/ref_output.bz2
Binary file not shown.
4 changes: 2 additions & 2 deletions test-suite-binaries/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ echo "RUN elf-Linux-x86 --memstr \"/bin/sh\"" | tee -a ./test_output
$RUN --binary ./elf-Linux-x86 --memstr "/bin/sh" 1>> ./test_output
echo "RUN elf-Linux-x86 --badbytes \"00|01-1f|7f|42\"" | tee -a ./test_output
$RUN --binary ./elf-Linux-x86 --badbytes "00|01-1f|7f|42" 1>> ./test_output
echo "RUN elf-Linux-x86 --offset 5555e000 --badbytes \"00-20|80-ff|ff\"" | tee -a ./test_output
$RUN --binary ./elf-Linux-x86 --offset 5555e000 --badbytes "00-20|80-ff|ff" 1>> ./test_output
echo "RUN elf-Linux-x86 --offset 5555e000 --badbytes \"00-20|80-ff\"" | tee -a ./test_output
$RUN --binary ./elf-Linux-x86 --offset 5555e000 --badbytes "00-20|80-ff" 1>> ./test_output
echo "RUN Linux_lib64.so --offset 0xdeadbeef00000000" | tee -a ./test_output
$RUN --binary ./Linux_lib64.so --offset 0xdeadbeef00000000 1>> ./test_output
echo "RUN elf-ARMv7-ls --depth 5" | tee -a ./test_output
Expand Down

0 comments on commit 2f49bdf

Please sign in to comment.