about summary refs log tree commit diff stats
path: root/snapshot.py
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2023-11-27 13:22:01 +0100
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2023-11-27 13:22:01 +0100
commit5d51b4fe0bb41bc9e86c5775de35a9aef023fec5 (patch)
tree09d1f87c8a3964f72b71b7a04945a7f5e7e12abe /snapshot.py
parent47894bb5d2e425f28d992aee6331b89b85b2058d (diff)
downloadfocaccia-5d51b4fe0bb41bc9e86c5775de35a9aef023fec5.tar.gz
focaccia-5d51b4fe0bb41bc9e86c5775de35a9aef023fec5.zip
Implement symbolic state comparison algorithm
This is the first draft of a `compare` algorithm that uses recorded
symbolic transformations. Is currently based on angr, so it's probably
going to be reworked to work with states generated by Miasm.

Co-authored-by: Theofilos Augoustis <theofilos.augoustis@gmail.com>
Co-authored-by: Nicola Crivellin <nicola.crivellin98@gmail.com>
Diffstat (limited to 'snapshot.py')
-rw-r--r--snapshot.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/snapshot.py b/snapshot.py
index 01c6446..3170649 100644
--- a/snapshot.py
+++ b/snapshot.py
@@ -38,3 +38,12 @@ class ProgramState:
 
     def __repr__(self):
         return repr(self.regs)
+
+class SnapshotSymbolResolver(SymbolResolver):
+    def __init__(self, snapshot: ProgramState):
+        self._state = snapshot
+
+    def resolve(self, symbol: str):
+        if symbol not in self._state.arch.regnames:
+            raise SymbolResolveError(symbol, 'Symbol is not a register name.')
+        return self._state.read(symbol)