about summary refs log tree commit diff stats
path: root/tools/capture_transforms.py
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2024-01-17 17:08:48 +0100
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2024-01-17 17:08:48 +0100
commit605e12fc5cf0fb64e45f68378390a09aa28df2f9 (patch)
treeb8ba3c3c6f0776b5b2cd99fee7811d3c27af3f1d /tools/capture_transforms.py
parenteae0b3b08bd078ad2f621ce2ef201e656da3f16a (diff)
downloadfocaccia-605e12fc5cf0fb64e45f68378390a09aa28df2f9.tar.gz
focaccia-605e12fc5cf0fb64e45f68378390a09aa28df2f9.zip
Refactor symbolic transformation handling
Diffstat (limited to 'tools/capture_transforms.py')
-rw-r--r--tools/capture_transforms.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/capture_transforms.py b/tools/capture_transforms.py
new file mode 100644
index 0000000..de35d86
--- /dev/null
+++ b/tools/capture_transforms.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import argparse
+import logging
+
+from focaccia import parser
+from focaccia.symbolic import collect_symbolic_trace
+
+def main():
+    prog = argparse.ArgumentParser()
+    prog.description = 'Trace an executable concolically to capture symbolic' \
+                       ' transformations among instructions.'
+    prog.add_argument('binary', help='The program to analyse.')
+    prog.add_argument('args', action='store', nargs=argparse.REMAINDER,
+                      help='Arguments to the program.')
+    prog.add_argument('-o', '--output',
+                      default='trace.out',
+                      help='Name of output file. (default: trace.out)')
+    args = prog.parse_args()
+
+    logging.disable(logging.CRITICAL)
+    trace = collect_symbolic_trace(args.binary, args.args, None)
+    with open(args.output, 'w') as file:
+        parser.serialize_transformations(trace, file)
+
+if __name__ == "__main__":
+    main()