about summary refs log tree commit diff
path: root/pkgs/tools/security/ssh-mitm/default.nix
blob: 4c59595ec936003ecd1f559732d04cc03dfe54d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  installShellFiles,
  python3,
}:

let
  py = python3.override {
    self = py;
    packageOverrides = self: super: {
      paramiko = super.paramiko.overridePythonAttrs (oldAttrs: rec {
        version = "3.3.1";
        src = oldAttrs.src.override {
          inherit version;
          hash = "sha256-ajd3qWGshtvvN1xfW41QAUoaltD9fwVKQ7yIATSw/3c=";
        };
        patches = [
          (fetchpatch {
            name = "Use-pytest-s-setup_method-in-pytest-8-the-nose-method-setup-is-deprecated.patch";
            url = "https://github.com/paramiko/paramiko/pull/2349.diff";
            hash = "sha256-4CTIZ9BmzRdh+HOwxSzfM9wkUGJOnndctK5swqqsIvU=";
          })

        ];
        propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ python3.pkgs.icecream ];
      });
    };
  };
in
with py.pkgs;


buildPythonApplication rec {
  pname = "ssh-mitm";
  version = "4.1.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ssh-mitm";
    repo = "ssh-mitm";
    rev = "refs/tags/${version}";
    hash = "sha256-Uf1B7oEZyNWj4TjrLvEfFdxsvsGeMLXFsSdxGLUV4ZU=";
  };

  build-system = [
    hatchling
    hatch-requirements-txt
  ];

  propagatedBuildInputs = [
    argcomplete
    colored
    packaging
    paramiko
    pytz
    pyyaml
    python-json-logger
    rich
    tkinter
    setuptools
    sshpubkeys
    wrapt
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ setuptools ];
  # fix for darwin users

  nativeBuildInputs = [ installShellFiles ];

  # Module has no tests
  doCheck = false;
  # Install man page
  postInstall = ''
    installManPage man1/*
  '';

  pythonImportsCheck = [ "sshmitm" ];

  meta = with lib; {
    description = "Tool for SSH security audits";
    homepage = "https://github.com/ssh-mitm/ssh-mitm";
    changelog = "https://github.com/ssh-mitm/ssh-mitm/blob/${version}/CHANGELOG.md";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ fab ];
  };
}