###A Nicer Symbolic Execution for Python (Z3)
This code is a port/rewrite of the NICE project's (http://code.google.com/p/nice-of/) symbolic execution engine for Python to use the Z3 theorem prover (http://z3.codeplex.com). We have removed the NICE-specific dependences, platform-specific code, and makes various improvements so the code base can be used by students or anyone wanting to experiment with dynamic symbolic execution.
A novel aspect of the rewrite is to rely solely on Python's operator overloading to accomplish all the interception needed for symbolic execution; no AST rewriting or bytecode instrumentation is required, as was done in the NICE project. This significantly improves the robustness and portability of the engine, as well as reducing the code size.
###Setup instructions:
- Make sure that you use Python 32-bit (64-bit) if-and-only-if you use the Z3 32-bit (64-bit) binaries. Testing so far has been on Python 3.2.3 and 32-bit.
- Install Python 3.2.3 (https://www.python.org/download/releases/3.2.3/)
- Install the latest "unstable" release of Z3 to directory Z3HOME from http://z3.codeplex.com/releases (click on the "Planned" link on the right to get the latest binaries for all platforms)
- Add Z3HOME\bin to PATH and PYTHONPATH
- MacOS: see setup.sh for Homebrew default locations for Python and Z3
- Optional: -- install GraphViz utilities (http://graphviz.org/)
- Grab yourself a Brew at http://brew.sh/
- Get the newest python or python3 version:
brew install python
- Have the system prefer brew python over system python:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
- - Get z3:
brew install homebrew/science/z3
- Clone this repository:
git clone https://github.com/thomasjball/PyExZ3.git
- Set the PATH:
. PyExZ3/setup.sh
(do not run the setup script in a subshell./ PyExZ3/
)
- "python run_tests.py test" should pass all tests
- "python sym_exec.py test\FILE.py" to run a single test from test directory