1{ lib
2, buildPythonPackage
3, capstone
4, crytic-compile
5, fetchFromGitHub
6, intervaltree
7, ply
8, prettytable
9, protobuf
10, pyelftools
11, pyevmasm
12, pysha3
13, pytestCheckHook
14, pythonOlder
15, pyyaml
16, rlp
17, stdenv
18, unicorn
19, wasm
20, yices
21, z3
22}:
23
24buildPythonPackage rec {
25 pname = "manticore";
26 version = "0.3.6";
27 format = "setuptools";
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "trailofbits";
33 repo = "manticore";
34 rev = version;
35 sha256 = "sha256-L112YwrBcdcLBeBsPLWt3C57u2WDvGLq50EzW9ojdyg=";
36 };
37
38 propagatedBuildInputs = [
39 crytic-compile
40 intervaltree
41 ply
42 prettytable
43 protobuf
44 pyevmasm
45 pysha3
46 pyyaml
47 rlp
48 wasm
49 ] ++ lib.optionals (stdenv.isLinux) [
50 capstone
51 pyelftools
52 unicorn
53 ];
54
55 # Python API is not used in the code, only z3 from PATH
56 postPatch = ''
57 sed -ie s/z3-solver// setup.py
58 '';
59
60 checkInputs = [
61 pytestCheckHook
62 ];
63
64 preCheck = ''
65 export PATH=${yices}/bin:${z3}/bin:$PATH
66 '';
67
68 disabledTestPaths = [
69 "tests/ethereum" # Enable when solc works again
70 "tests/ethereum_bench"
71 ] ++ lib.optionals (!stdenv.isLinux) [
72 "tests/native"
73 "tests/other/test_locking.py"
74 "tests/other/test_state_introspection.py"
75 ];
76
77 disabledTests = [
78 # Failing tests
79 "test_chmod"
80 "test_timeout"
81 "test_wasm_main"
82 # Slow tests
83 "testmprotectFailSymbReading"
84 "test_ConstraintsForking"
85 "test_resume"
86 "test_symbolic"
87 "test_symbolic_syscall_arg"
88 "test_state_merging"
89 "test_decree"
90 "test_register_comparison"
91 "test_arguments_assertions_armv7"
92 "test_integration_basic_stdout"
93 "test_fclose_linux_amd64"
94 "test_fileio_linux_amd64"
95 "test_arguments_assertions_amd64"
96 "test_ioctl_bogus"
97 "test_ioctl_socket"
98 "test_brk_regression"
99 "test_basic_arm"
100 "test_logger_verbosity"
101 "test_profiling_data"
102 "test_integration_basic_stdin"
103 "test_getchar"
104 "test_ccmp_reg"
105 "test_ld1_mlt_structs"
106 "test_ccmp_imm"
107 "test_try_to_allocate_greater_than_last_space_memory_page_12"
108 "test_not_enough_memory_page_12"
109 "test_PCMPISTRI_30_symbolic"
110 "test_ld1_mlt_structs"
111 "test_time"
112 "test_implicit_call"
113 "test_trace"
114 "test_plugin"
115 # Tests are failing with latest unicorn
116 "Aarch64UnicornInstructions"
117 "test_integration_resume"
118 ];
119
120 pythonImportsCheck = [
121 "manticore"
122 ];
123
124 meta = with lib; {
125 description = "Symbolic execution tool for analysis of smart contracts and binaries";
126 homepage = "https://github.com/trailofbits/manticore";
127 changelog = "https://github.com/trailofbits/manticore/releases/tag/${version}";
128 license = licenses.agpl3Only;
129 platforms = platforms.unix;
130 maintainers = with maintainers; [ arturcygan ];
131 };
132}