@@ -0,0 +1,62 @@
1+{ lib
2+, bitstring
3+, buildPythonApplication
4+, fetchFromGitHub
5+, fetchpatch
6+, flask
7+, mido
8+, numpy
9+, pyserial
10+, pytestCheckHook
11+, pythonOlder
12+}:
13+
14+buildPythonApplication rec {
15+ pname = "cantoolz";
16+ version = "3.7.0";
17+ disabled = pythonOlder "3.8";
18+
19+ src = fetchFromGitHub {
20+ owner = "CANToolz";
21+ repo = "CANToolz";
22+ rev = "v${version}";
23+ sha256 = "0xkj7zyx6pz866q61c84mdagpgdyd633v85hk7qxhamca33rc4yi";
24+ };
25+
26+ patches = [
27+ (fetchpatch {
28+ # Replace time.clock() which was removed, https://github.com/CANToolz/CANToolz/pull/30
29+ url = "https://github.com/CANToolz/CANToolz/pull/30/commits/d75574523d3b273c40fb714532c4de27f9e6dd3e.patch";
30+ sha256 = "0g91hywg5q6f2qk1awgklywigclrbhh6a6mwd0kpbkk1wawiiwbc";
31+ })
32+ ];
33+
34+ propagatedBuildInputs = [
35+ flask
36+ pyserial
37+ mido
38+ numpy
39+ bitstring
40+ ];
41+
42+ checkInputs = [ pytestCheckHook ];
43+ disabledTests = [ "test_process" ];
44+ pythonImportsCheck = [ "cantoolz" ];
45+
46+ meta = with lib; {
47+ description = "Black-box CAN network analysis framework";
48+ longDescription = ''
49+ CANToolz is a framework for analysing CAN networks and devices. It
50+ provides multiple modules that can be chained using CANToolz's pipe
51+ system and used by security researchers, automotive/OEM security
52+ testers in black-box analysis.
53+
54+ CANToolz can be used for ECU discovery, MitM testing, fuzzing, brute
55+ forcing, scanning or R&D, testing and validation. More can easily be
56+ implemented with a new module.
57+ '';
58+ homepage = "https://github.com/CANToolz/CANToolz";
59+ license = with licenses; [ asl20 ];
60+ maintainers = with maintainers; [ fab ];
61+ };
62+}