diff options
| author | van Hauser <vh@thc.org> | 2021-04-20 11:38:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 11:38:09 +0200 |
| commit | 48cef3c74727407f82c44800d382737265fe65b4 (patch) | |
| tree | 07338ec82703c20cc1f78a235ac3ad16e2465bf1 /frida_mode/test/testinstr.py | |
| parent | f7179e44f6c46fef318b6413d9c00693c1af4602 (diff) | |
| parent | 3b5fa3632b0e482b2915709d7fbec827e1d997b9 (diff) | |
| download | afl++-48cef3c74727407f82c44800d382737265fe65b4.tar.gz | |
Merge pull request #871 from AFLplusplus/dev
push to stable
Diffstat (limited to 'frida_mode/test/testinstr.py')
| -rwxr-xr-x | frida_mode/test/testinstr.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/frida_mode/test/testinstr.py b/frida_mode/test/testinstr.py new file mode 100755 index 00000000..f648808b --- /dev/null +++ b/frida_mode/test/testinstr.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import argparse +from elftools.elf.elffile import ELFFile + + +def process_file(file, section, base): + with open(file, "rb") as f: + for sect in ELFFile(f).iter_sections(): + if sect.name == section: + start = base + sect.header["sh_offset"] + end = start + sect.header["sh_size"] + print("0x%016x-0x%016x" % (start, end)) + return + + print("Section '%s' not found in '%s'" % (section, file)) + + +def hex_value(x): + return int(x, 16) + + +def main(): + parser = argparse.ArgumentParser(description="Process some integers.") + parser.add_argument( + "-f", "--file", dest="file", type=str, help="elf file name", required=True + ) + parser.add_argument( + "-s", + "--section", + dest="section", + type=str, + help="elf section name", + required=True, + ) + parser.add_argument( + "-b", + "--base", + dest="base", + type=hex_value, + help="elf base address", + required=True, + ) + + args = parser.parse_args() + process_file(args.file, args.section, args.base) + + +if __name__ == "__main__": + main() |
