From 5ae544390a02af94590d807232c68969cdb42980 Mon Sep 17 00:00:00 2001 From: kenshin <14914796+AkechiShiro@users.noreply.github.com> Date: Tue, 30 Apr 2024 22:55:42 +0200 Subject: [PATCH] =?UTF-8?q?ssh-mitm:=203.0.2=20=E2=86=92=204.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Hash update * Add tkinter dependency in propagatedBuildInputs and remove setuptools from propagatedBuildInputs, add to natievBuildInputs * Format using nixfmt so nix is parsable by GitHub CI/CD ?? * Fix python3Packages to python3.pkgs * Fix for ssh-mitm askpass * Workaround for darwin users * Import stdenv missing * Fix stdenv.isDarwin * Apply fix from fabaff's review (man still missing) * Attempt to add man pages * Override paramiko, patch test_config for paramiko 3.11 (+), due to deprecated pytest setup method --- pkgs/tools/security/ssh-mitm/default.nix | 55 +++++++++++++++++------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/pkgs/tools/security/ssh-mitm/default.nix b/pkgs/tools/security/ssh-mitm/default.nix index 9d40f86354b5..745090c8e9a1 100644 --- a/pkgs/tools/security/ssh-mitm/default.nix +++ b/pkgs/tools/security/ssh-mitm/default.nix @@ -1,18 +1,29 @@ -{ lib -, fetchFromGitHub -, python3 +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch, + installShellFiles, + python3, }: let py = python3.override { packageOverrides = self: super: { paramiko = super.paramiko.overridePythonAttrs (oldAttrs: rec { - version = "3.1.0"; + version = "3.3.1"; src = oldAttrs.src.override { inherit version; - hash = "sha256-aVD6ymgZrNMhnUrmlKI8eofuONCE9wwXJLDA27i3V2k="; + hash = "sha256-ajd3qWGshtvvN1xfW41QAUoaltD9fwVKQ7yIATSw/3c="; }; - patches = [ ]; + 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 ]; }); }; @@ -20,18 +31,24 @@ let in with py.pkgs; + buildPythonApplication rec { pname = "ssh-mitm"; - version = "3.0.2"; - format = "setuptools"; + version = "4.1.1"; + pyproject = true; src = fetchFromGitHub { - owner = pname; - repo = pname; + owner = "ssh-mitm"; + repo = "ssh-mitm"; rev = "refs/tags/${version}"; - hash = "sha256-koV7g6ZmrrXk60rrDP8BwrDZk3shiyJigQgNcb4BASE="; + hash = "sha256-Uf1B7oEZyNWj4TjrLvEfFdxsvsGeMLXFsSdxGLUV4ZU="; }; + build-system = [ + hatchling + hatch-requirements-txt + ]; + propagatedBuildInputs = [ argcomplete colored @@ -39,17 +56,25 @@ buildPythonApplication rec { paramiko pytz pyyaml + python-json-logger rich + tkinter setuptools sshpubkeys - ]; + wrapt + ] ++ lib.optionals stdenv.isDarwin [ setuptools ]; + # fix for darwin users + + nativeBuildInputs = [ installShellFiles ]; # Module has no tests doCheck = false; + # Install man page + postInstall = '' + installManPage man1/* + ''; - pythonImportsCheck = [ - "sshmitm" - ]; + pythonImportsCheck = [ "sshmitm" ]; meta = with lib; { description = "Tool for SSH security audits";