{"id":5150,"library":"claripy","title":"Claripy","description":"Claripy is an abstraction layer for constraint solvers, providing a unified way to interact with concrete and symbolic expressions. It acts as the solver engine for the Angr binary analysis framework. The library allows users to define symbolic variables, add constraints, and evaluate expressions using various backends like Z3. The current version is 9.2.209, with releases closely tied to the Angr project's development cycle, most recently updated on April 7, 2026.","status":"active","version":"9.2.209","language":"en","source_language":"en","source_url":"https://github.com/angr/claripy","tags":["constraint solver","symbolic execution","SMT","bitvector","angr","binary analysis"],"install":[{"cmd":"pip install claripy","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for caching mechanisms within the solver engine.","package":"cachetools","optional":false},{"reason":"Provides backported and future typing features.","package":"typing-extensions","optional":false},{"reason":"Primary SMT solver backend for symbolic execution. Requires a specific version (e.g., 4.13.0.0) for full compatibility.","package":"z3-solver","optional":false}],"imports":[{"symbol":"claripy","correct":"import claripy"},{"note":"Main entry point for creating and managing constraints.","symbol":"Solver","correct":"import claripy\ns = claripy.Solver()"},{"note":"claripy.BV was renamed to claripy.BVS (Bit-Vector Symbol) to clarify its purpose.","wrong":"x = claripy.BV('x', 32)","symbol":"BVS","correct":"import claripy\nx = claripy.BVS('x', 32)"},{"note":"Used to create concrete Bit-Vector Values.","symbol":"BVV","correct":"import claripy\ny = claripy.BVV(10, 32)"}],"quickstart":{"code":"import claripy\n\ns = claripy.Solver()\nx = claripy.BVS('x', 8) # Create an 8-bit symbolic bit-vector\ny = claripy.BVV(65, 8) # Create an 8-bit concrete bit-vector with value 65\n\n# Add constraints\ns.add(claripy.ULT(x, 5)) # Unsigned Less Than x < 5\ns.add(x != 1)\n\n# Evaluate the symbolic variable\nsolutions = s.eval(x, 10) # Get up to 10 possible solutions for x\nprint(f\"Possible values for x: {sorted(solutions)}\")\nassert sorted(solutions) == [0, 2, 3, 4]\n\n# Max and Min values\nprint(f\"Max value for x: {s.max(x)}\")\nprint(f\"Min value for x: {s.min(x)}\")","lang":"python","description":"This quickstart demonstrates how to initialize a Claripy solver, create symbolic and concrete bit-vectors, add constraints, and then evaluate the possible values for the symbolic variable. It showcases basic operations like `BVS` for symbolic variables, `BVV` for concrete values, `add` for constraints, and `eval`, `max`, `min` for solution retrieval."},"warnings":[{"fix":"Replace all instances of `claripy.BV` with `claripy.BVS`.","message":"The class `claripy.BV` has been renamed to `claripy.BVS` (Bit-Vector Symbol). Old code using `claripy.BV` will break.","severity":"breaking","affected_versions":"Likely around Angr 4.6.3.28 release cycle (older versions)"},{"fix":"Use `state.se.BVS` and `state.se.BVV` instead when working with symbolic expressions attached to an Angr state (`state.se` refers to the symbolic execution engine).","message":"Accessing bit-vectors via `state.BV` or `state.BVV` within an Angr state is deprecated.","severity":"deprecated","affected_versions":"Likely around Angr 4.6.3.28 release cycle (older versions)"},{"fix":"Instead of `BV.model`, convert the bit-vector with the appropriate backend directly, e.g., `claripy.backend_concrete.convert(bv)` if you need a specific model.","message":"The `BV.model` attribute is deprecated.","severity":"deprecated","affected_versions":"Likely around Angr 4.6.3.28 release cycle (older versions)"},{"fix":"Ensure `z3-solver` is installed at the exact version specified by Claripy's `pyproject.toml` or the Angr project. For current versions, this is `z3-solver==4.13.0.0`.","message":"Claripy has strong dependencies on specific `z3-solver` versions. Incompatibilities can lead to `AttributeError` (e.g., `Z3_get_symbol_string_bytes`) or functional issues, especially with floating-point operations.","severity":"gotcha","affected_versions":"All versions, especially when upgrading `z3-solver` independently."}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}