1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 python3,
6}:
7
8python3.pkgs.buildPythonApplication rec {
9 pname = "cantoolz";
10 version = "3.7.0";
11 format = "pyproject";
12
13 src = fetchFromGitHub {
14 owner = "CANToolz";
15 repo = "CANToolz";
16 rev = "v${version}";
17 sha256 = "sha256-0ROWx1CsKtjxmbCgPYZpvr37VKsEsWCwMehf0/0/cnY=";
18 };
19
20 patches = [
21 (fetchpatch {
22 # Import Iterable from collections.abc
23 url = "https://github.com/CANToolz/CANToolz/commit/9e818946716a744b3c7356f248e24ea650791d1f.patch";
24 hash = "sha256-BTQ0Io2RF8WpWlLoYfBj8IhL92FRR8ustGClt28/R8c=";
25 })
26 (fetchpatch {
27 # Replace time.clock() which was removed, https://github.com/CANToolz/CANToolz/pull/30
28 url = "https://github.com/CANToolz/CANToolz/pull/30/commits/d75574523d3b273c40fb714532c4de27f9e6dd3e.patch";
29 sha256 = "0g91hywg5q6f2qk1awgklywigclrbhh6a6mwd0kpbkk1wawiiwbc";
30 })
31 ];
32
33 build-system = with python3.pkgs; [
34 setuptools
35 ];
36
37 dependencies = with python3.pkgs; [
38 flask
39 pyserial
40 mido
41 numpy
42 bitstring
43 ];
44
45 nativeCheckInputs = with python3.pkgs; [
46 pytestCheckHook
47 ];
48
49 disabledTests = [
50 "test_process"
51 # Sandbox issue
52 "test_server"
53 ];
54
55 pythonImportsCheck = [
56 "cantoolz"
57 ];
58
59 meta = with lib; {
60 description = "Black-box CAN network analysis framework";
61 mainProgram = "cantoolz";
62 longDescription = ''
63 CANToolz is a framework for analysing CAN networks and devices. It
64 provides multiple modules that can be chained using CANToolz's pipe
65 system and used by security researchers, automotive/OEM security
66 testers in black-box analysis.
67
68 CANToolz can be used for ECU discovery, MitM testing, fuzzing, brute
69 forcing, scanning or R&D, testing and validation. More can easily be
70 implemented with a new module.
71 '';
72 homepage = "https://github.com/CANToolz/CANToolz";
73 license = with licenses; [ asl20 ];
74 maintainers = with maintainers; [ fab ];
75 };
76}