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