def add_nop_in_method(smali_file, valid_op_code): """Add multiple nop sequence of random lenght (1-3) between two nop-valid istruction""" for smali_line in u.open_file_input(smali_file): # For each line print smali_line, # Print the original instruction line_op_code = re.search(r'^([ ]*)(?P<opCode>([^ ]+)) ', smali_line) if line_op_code is not None: op_code = line_op_code.group('opCode') if op_code in valid_op_code: nop_count = u.random_nop_interval() # Randomize the number of nop(s) print ' nop\n' * nop_count # Print the nop(s)
def add_nop_in_method(smali_file, valid_op_code): """Add multiple nop sequence of random lenght (1-3) between two nop-valid istruction""" for smali_line in u.open_file_input(smali_file): # For each line print smali_line, # Print the original instruction line_op_code = re.search(r'^([ ]*)(?P<opCode>([^ ]+)) ', smali_line) if line_op_code is not None: op_code = line_op_code.group('opCode') if op_code in valid_op_code: nop_count = u.random_nop_interval( ) # Randomize the number of nop(s) print ' nop\n' * nop_count # Print the nop(s)
def append_defunct_class(smali_dir_list): """Append some classes files to the class tree""" base_path = smali_dir_list[-1] # The root of the class tree for smali_dir in smali_dir_list: # For each dir for count_class in range(u.random_nop_interval()): append_defunct_class_now(base_path, smali_dir, count_class)
def add_random_fields(smali_line): """Adds a random (in lenght and name) list of fields to the class""" for _ in range(u.random_nop_interval()): print re.sub(r':', u.get_random(True, 32) + ':', smali_line), # Append