diff options
Diffstat (limited to 'example')
| -rw-r--r-- | example/ida/depgraph.py | 7 | ||||
| -rw-r--r-- | example/jitter/test_x86_32_seh.py | 4 | ||||
| -rw-r--r-- | example/samples/x86_32_seh.S | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/example/ida/depgraph.py b/example/ida/depgraph.py index 73fc0f87..9e45ffa9 100644 --- a/example/ida/depgraph.py +++ b/example/ida/depgraph.py @@ -25,10 +25,11 @@ from utils import guess_machine class depGraphSettingsForm(ida_kernwin.Form): - def __init__(self, ira, ircfg): + def __init__(self, ira, ircfg, mn): self.ira = ira self.ircfg = ircfg + self.mn = mn self.stk_args = {'ARG%d' % i:i for i in range(10)} self.stk_unalias_force = False @@ -129,7 +130,7 @@ Method to use: arg_num = self.stk_args[value] stk_high = m2_expr.ExprInt(idc.GetSpd(line.offset), ir_arch.sp.size) stk_off = m2_expr.ExprInt(self.ira.sp.size // 8 * arg_num, ir_arch.sp.size) - element = m2_expr.ExprMem(mn.regs.regs_init[ir_arch.sp] + stk_high + stk_off, self.ira.sp.size) + element = m2_expr.ExprMem(self.mn.regs.regs_init[ir_arch.sp] + stk_high + stk_off, self.ira.sp.size) element = expr_simp(element) # Force stack unaliasing self.stk_unalias_force = True @@ -230,7 +231,7 @@ def launch_depgraph(): ircfg = ir_arch.new_ircfg_from_asmcfg(asmcfg) # Get settings - settings = depGraphSettingsForm(ir_arch, ircfg) + settings = depGraphSettingsForm(ir_arch, ircfg, mn) settings.Execute() loc_key, elements, line_nb = settings.loc_key, settings.elements, settings.line_nb diff --git a/example/jitter/test_x86_32_seh.py b/example/jitter/test_x86_32_seh.py index 595b9586..d29d3a22 100644 --- a/example/jitter/test_x86_32_seh.py +++ b/example/jitter/test_x86_32_seh.py @@ -24,6 +24,9 @@ def deal_exception_illegal_instruction(jitter): jitter.pc = win_api_x86_32_seh.fake_seh_handler(jitter, win_api_x86_32_seh.EXCEPTION_ILLEGAL_INSTRUCTION) return True +def deal_exception_single_step(jitter): + jitter.pc = win_api_x86_32_seh.fake_seh_handler(jitter, win_api_x86_32_seh.EXCEPTION_SINGLE_STEP) + return True def return_from_seh(jitter): win_api_x86_32_seh.return_from_seh(jitter) @@ -47,6 +50,7 @@ sb.jitter.add_exception_handler(EXCEPT_SOFT_BP, deal_exception_breakpoint) sb.jitter.add_exception_handler(EXCEPT_DIV_BY_ZERO, deal_exception_div) sb.jitter.add_exception_handler(1<<17, deal_exception_privileged_instruction) sb.jitter.add_exception_handler(EXCEPT_UNK_MNEMO, deal_exception_illegal_instruction) +sb.jitter.add_exception_handler(EXCEPT_INT_1, deal_exception_single_step) sb.jitter.add_breakpoint(win_api_x86_32_seh.return_from_exception, return_from_seh) diff --git a/example/samples/x86_32_seh.S b/example/samples/x86_32_seh.S index 7bb2c3cd..a637cccf 100644 --- a/example/samples/x86_32_seh.S +++ b/example/samples/x86_32_seh.S @@ -41,6 +41,12 @@ lbl_err_end4: ADD ESP, 4 RET +;; Single step +lbl_err_5: + INT 0x1 +lbl_err_end5: + NOP + error: MOV ECX, DWORD PTR [ESP+0xC] MOV EAX, DWORD PTR [ECX+0xB8] @@ -66,6 +72,7 @@ labels_err: .dword lbl_err_2 .dword lbl_err_3 .dword lbl_err_4 +.dword lbl_err_5 labels_err_end: @@ -74,3 +81,4 @@ labels_err_end: .dword lbl_err_end2 .dword lbl_err_end3 .dword lbl_err_end4 +.dword lbl_err_end5 |