diff options
author | van Hauser <vh@thc.org> | 2020-12-11 11:38:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 11:38:22 +0100 |
commit | 12d62d539353517abee8069df6e591f4fc474e93 (patch) | |
tree | c7ec08c39d3153ab3de1602fbda0739dd32dd37e /examples/afl_untracer/ida_get_patchpoints.py | |
parent | 3997d06cbd09e12cd0367170b3e2698ee71dd8cf (diff) | |
parent | d5ded820e5b610f330cf23f53c21c169032a725a (diff) | |
download | afl++-12d62d539353517abee8069df6e591f4fc474e93.tar.gz |
Merge pull request #617 from AFLplusplus/dev
push to stable
Diffstat (limited to 'examples/afl_untracer/ida_get_patchpoints.py')
-rw-r--r-- | examples/afl_untracer/ida_get_patchpoints.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/examples/afl_untracer/ida_get_patchpoints.py b/examples/afl_untracer/ida_get_patchpoints.py deleted file mode 100644 index 43cf6d89..00000000 --- a/examples/afl_untracer/ida_get_patchpoints.py +++ /dev/null @@ -1,62 +0,0 @@ -# -# IDAPython script for IDA Pro -# Slightly modified from https://github.com/googleprojectzero/p0tools/blob/master/TrapFuzz/findPatchPoints.py -# - -import idautils -import idaapi -import ida_nalt -import idc - -# See https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml - -from os.path import expanduser -home = expanduser("~") - -patchpoints = set() - -max_offset = 0 -for seg_ea in idautils.Segments(): - name = idc.get_segm_name(seg_ea) - #print("Segment: " + name) - if name != "__text" and name != ".text": - continue - - start = idc.get_segm_start(seg_ea) - end = idc.get_segm_end(seg_ea) - first = 0 - subtract_addr = 0 - #print("Start: " + hex(start) + " End: " + hex(end)) - for func_ea in idautils.Functions(start, end): - f = idaapi.get_func(func_ea) - if not f: - continue - for block in idaapi.FlowChart(f): - if start <= block.start_ea < end: - if first == 0: - if block.start_ea >= 0x1000: - subtract_addr = 0x1000 - first = 1 - - max_offset = max(max_offset, block.start_ea) - patchpoints.add(block.start_ea - subtract_addr) - #else: - # print("Warning: broken CFG?") - -# Round up max_offset to page size -size = max_offset -rem = size % 0x1000 -if rem != 0: - size += 0x1000 - rem - -print("Writing to " + home + "/Desktop/patches.txt") - -with open(home + "/Desktop/patches.txt", "w") as f: - f.write(ida_nalt.get_root_filename() + ':' + hex(size) + '\n') - f.write('\n'.join(map(hex, sorted(patchpoints)))) - f.write('\n') - -print("Done, found {} patchpoints".format(len(patchpoints))) - -# For headless script running remove the comment from the next line -#ida_pro.qexit() |