Skip to content

Commit

Permalink
Merge pull request JonathanSalwan#132 from mordak/arm64-blacklist
Browse files Browse the repository at this point in the history
Add blacklisted instructions for arm64.
  • Loading branch information
JonathanSalwan authored Jan 9, 2019
2 parents ff8d753 + 7484fd8 commit 4294f7f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ropgadget/gadgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ def __passCleanX86(self, gadgets, multibr=False):
new += [gadget]
return new

def __passCleanArm64(self, gadgets, multibr=False):
new = []
bl = ["brk", "smc", "hvc"]
for gadget in gadgets:
insts = gadget["gadget"].split(" ; ")
isbl = False;
for inst in insts:
if inst.split(" ")[0] in bl:
isbl = True;
if isbl:
continue
new += [gadget]
return new

def __gadgetsFinding(self, section, gadgets, arch, mode):

C_OP = 0
Expand Down Expand Up @@ -238,7 +252,7 @@ def passClean(self, gadgets, multibr):
elif arch == CS_ARCH_PPC: return gadgets
elif arch == CS_ARCH_SPARC: return gadgets
elif arch == CS_ARCH_ARM: return gadgets
elif arch == CS_ARCH_ARM64: return gadgets
elif arch == CS_ARCH_ARM64: return self.__passCleanArm64(gadgets, multibr)
else:
print("Gadgets().passClean() - Architecture not supported")
return None
Expand Down

0 comments on commit 4294f7f

Please sign in to comment.