Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ucsb-seclab/greed into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ruaronicola committed Jan 4, 2024
2 parents 7b5e38b + d10fc9b commit d081de8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# `greed`
# greed
[![python](https://img.shields.io/badge/Python-3.11+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![License](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=flat)]([https://pypi.org/project/ethpwn/](https://raw.githubusercontent.com/ethpwn/ethpwn/main/LICENSE))
[![Docs](https://img.shields.io/badge/Documentation-gh_pages)](https://ucsb-seclab.github.io/greed/)

<img align="left" width="250" src="logo.png">

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 🚀 Welcome to greed's documentation!
[![License](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](https://github.com/ucsb-seclab/greed/blob/main/LICENSE) [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/ucsb-seclab/greed) ![Python3](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)
[![License](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](https://github.com/ucsb-seclab/greed/blob/main/LICENSE.md) [![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/ucsb-seclab/greed) ![Python3](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)


<center><img src="./imgs/logo.png" width="256" height="256" /></center>
Expand Down Expand Up @@ -28,4 +28,4 @@ Some of the folks developing greed are also angr's contributor, thus, many of th
year={2024}
}

Thanks!
Thanks!
7 changes: 6 additions & 1 deletion greed/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from greed import options as opt
from greed.memory import LambdaMemory, PartialConcreteStorage
from greed.solver.shortcuts import *
from greed.state_plugins import SimStatePlugin, SimStateSolver, SimStateGlobals, SimStateInspect
from greed.state_plugins import SimStatePlugin, SimStateSolver, SimStateGlobals, SimStateInspect, ShaResolver
from greed.utils.exceptions import VMNoSuccessors, VMUnexpectedSuccessors
from greed.utils.exceptions import VMSymbolicError
from greed.utils.extra import UUIDGenerator
Expand Down Expand Up @@ -295,6 +295,11 @@ def _register_default_plugins(self):
"""
self.register_plugin("solver", SimStateSolver())
self.register_plugin("globals", SimStateGlobals())

sha_resolver = ShaResolver()
self.register_plugin("sha_resolver",sha_resolver)
sha_resolver.set_state(self)

if opt.STATE_INSPECT:
self.register_plugin("inspect", SimStateInspect())

Expand Down
5 changes: 5 additions & 0 deletions greed/state_plugins/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,17 @@ def pop_all(self):
def add_path_constraint(self, constraint):
"""
Add a path constraint to the state (at the current frame level).
Args:
constraint: The constraint to add.
"""
self._path_constraints[self._curr_frame_level].add(constraint)
self._add_assertion(constraint)

def add_memory_constraint(self, constraint):
"""
Add a memory constraint to the state (at the current frame level).
Args:
constraint: The constraint to add.
"""
self._memory_constraints[self._curr_frame_level].add(constraint)
self._add_assertion(constraint)
Expand All @@ -115,6 +119,7 @@ def simplify(self):
if not self.state.solver.is_formula_sat(NotEqual(reg_val, reg_val_sol)):
self.state.registers[reg_var] = reg_val_sol
self.state.registers[reg_var].is_simplified = True

@property
def timed_out(self):
return self._solver.timed_out
Expand Down

0 comments on commit d081de8

Please sign in to comment.