Advertisement
saleks28

tsuib1_find_xor

Jan 30th, 2021
1,087
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from idautils import *
  2. from idc import *
  3. from ida_ida import *
  4.  
  5. xor_counter = 0
  6. ea = inf_get_min_ea()
  7. for funcAddr in Functions(get_segm_start(ea), get_segm_end(ea)):
  8.     name = get_func_name(funcAddr)
  9.     instructions_addresses = list(FuncItems(funcAddr))
  10.     for addr in instructions_addresses:
  11.         instruction = print_insn_mnem(addr)
  12.         if instruction == "xor" and print_operand(addr, 1) != print_operand(addr, 0):
  13.             xor_counter += 1
  14.             print("In function {} at addr 0x{} {} {}, {}".format(name, addr, instruction, print_operand(addr, 0), print_operand(addr, 1)))
  15. print("Total quantity of XOR operation: {}".format(xor_counter))
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement