# Find ARM ROP gadgets that contain a user specified instruction. #@author fuzzywalls #@category TNS #@menupath TNS.Arm Rop.Find import re from utils import armrop, utils utils.allowed_processors(currentProgram, 'ARM') op1 = None op2 = None op3 = None search = askString('ARM ROP Find', 'What instruction do you want to search for?') try: search = re.sub(' +', ' ', search) mnem, operands = search.split(' ', 1) operands = operands.replace(' ', '') operands = operands.split(',') op1, op2, op3 = operands + [None] * (3 - len(operands)) except ValueError: mnem = search if not mnem.startswith('.*'): mnem = '.*' + mnem print 'Searching for %s' % search search_ins = armrop.ArmInstruction(mnem, op1, op2, op3)
# Find MIPS ROP gadgets that contain a user specified instruction. #@author fuzzywalls #@category TNS #@menupath TNS.Mips Rops.Find import re from utils import mipsrop, utils utils.allowed_processors(currentProgram, 'MIPS') op1 = None op2 = None op3 = None search = askString('MIPS ROP Find', 'What instruction do you want to search for?') try: search = re.sub(' +', ' ', search) mnem, operands = search.split(' ', 1) operands = operands.replace(' ', '') operands = operands.split(',') op1, op2, op3 = operands + [None] * (3 - len(operands)) except ValueError: mnem = search if not mnem.startswith('.*'): mnem = '.*' + mnem search_ins = mipsrop.MipsInstruction(mnem, op1, op2, op3) mips_rop = mipsrop.MipsRop(currentProgram)
operator.function.arg_count)] for arg in additional_arguments: source = get_argument_source(call, arg) curr_call.add_argument(source) curr_call_list = curr_call.to_list() calls.append(curr_call_list) calls.sort(key=lambda call: call[0]) utils.table_pretty_print(title, calls) def _get_function_calls(self): """ Find all calls to function specified by the user. """ for ref in self._ref_man.getReferencesTo(self.function.entry_point): ref_type = ref.getReferenceType() if ref_type.isCall() or ref_type.isConditional(): self.function_calls.append(ref.fromAddress) utils.allowed_processors(currentProgram, ['MIPS', 'ARM']) operator = Operator() operator.get_callee() print 'Identifying calls to %s...' % operator.function.name operator.list_calls()