Skip to content

Commit

Permalink
加入调试的时候自动根据相对地址和so名字跳转到绝对地址的脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
yao.mai committed Mar 28, 2020
1 parent 97e2614 commit 7e8e764
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion comment-trace.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import sys
import os.path
#idaapi.split_sreg_range(instruction_pointer, idaapi.str2reg("T"), required_t_value, idaapi.SR_user)

if __name__ == "__main__":
trace_path = ""
Expand All @@ -16,7 +17,7 @@
#
is_clean=0
if (in_ida):
trace_path = idc.AskStr("trace-jni.txt", "trace path")
trace_path = idc.AskFile(0, "*.*", "trace path")
is_clean = idc.AskLong(0, "clean path?")
if (not os.path.isabs(trace_path)):
script_path = os.path.split(os.path.realpath(__file__))[0]
Expand Down
22 changes: 22 additions & 0 deletions dbg-loc-off.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import idc
import os

somodule = AskStr('libcms.so', 'module name')

off_str = AskStr('0x0', 'in hex')

off = int(off_str, 16)
modulebase = GetFirstModule()

while (modulebase != None) and (GetModuleName(modulebase).find(somodule) == -1):
modulebase = GetNextModule(modulebase)

if modulebase == None:
print ('failed to find module:' , somodule)

else:
abs_off = modulebase + off
print ('module of %s base address is: 0x%08X'%(somodule, modulebase))
print("jump to 0x%08X"%abs_off)
Jump(abs_off)
#

0 comments on commit 7e8e764

Please sign in to comment.