blob: 97c23defd098163cc4cae2975099c000673ee1ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import argparse
from symbolic import collect_symbolic_trace
def main():
program = argparse.ArgumentParser()
program.add_argument('binary')
program.add_argument('argv', action='store', nargs=argparse.REMAINDER)
program.add_argument('--start-addr',
help='Instruction at which to start')
args = program.parse_args()
binary = args.binary
argv = args.argv
pc = None
if args.start_addr:
try:
pc = int(args.start_addr, 16)
except ValueError:
print(f'Start address must be a hexadecimal number. Exiting.')
exit(1)
strace = collect_symbolic_trace(binary, [binary, *argv], pc)
print(f'--- {len(strace)} instructions traced.')
print(f'--- No new PC found. Exiting.')
if __name__ == "__main__":
main()
# TODO: To implement support for unimplemented instructions, add their
# ASM->IR implementations to the `mnemo_func` array in
# `miasm/arch/x86/sem.py:5142`.
#
# For XGETBV, I might have to add the extended control register XCR0 first.
# This might be a nontrivial patch to Miasm.
|