From c30be260a965918d1454868ed1bffc44265c3f61 Mon Sep 17 00:00:00 2001 From: tahanonu Date: Sun, 4 Aug 2024 17:58:46 +0100 Subject: [PATCH] ophcrack-cli: refactor to use ophcrack --- pkgs/by-name/op/ophcrack-cli/package.nix | 73 ------------------------ pkgs/by-name/op/ophcrack/package.nix | 63 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 65 insertions(+), 73 deletions(-) delete mode 100644 pkgs/by-name/op/ophcrack-cli/package.nix create mode 100644 pkgs/by-name/op/ophcrack/package.nix diff --git a/pkgs/by-name/op/ophcrack-cli/package.nix b/pkgs/by-name/op/ophcrack-cli/package.nix deleted file mode 100644 index bbc7b8e19978..000000000000 --- a/pkgs/by-name/op/ophcrack-cli/package.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ lib -, stdenv -, fetchurl -, fetchpatch -, autoreconfHook -, libtool -, zlib -, pkg-config -, openssl -, freetype -, expat -}: - -stdenv.mkDerivation rec { - pname = "ophcrack"; - version = "3.8.0"; - - src = fetchurl { - url = "https://sourceforge.net/projects/ophcrack/files/ophcrack/3.8.0/ophcrack-3.8.0.tar.bz2"; - hash = "sha256-BIpt9XmDo6WjGsfE7BLfFqpJ5lKilnbZPU75WdUK7uA="; - }; - - nativeBuildInputs = [ - autoreconfHook - libtool - expat - ]; - - buildInputs = [ - zlib - openssl - freetype - pkg-config - ]; - - patches = [ - (fetchpatch { - url = "https://salsa.debian.org/pkg-security-team/ophcrack/-/raw/c60118b40802e1162dcebfe5f881cf973b2334d3/debian/patches/fix_spelling_error.diff"; - hash = "sha256-Fc044hTU4Mtdym+HukGAwGzaLm7aVzV9KpvHvFUG2Sc="; - }) - (fetchpatch { - url = "https://salsa.debian.org/pkg-security-team/ophcrack/-/raw/e19d993a7dbf131d13128366e2aac270a685befc/debian/patches/qmake_crossbuild.diff"; - hash = "sha256-sOKXOBpAYGLacU6IxjRzy3HCnGm4DFowDL2qP+DzG8M="; - }) - ]; - - configureFlags = [ - "--with-libssl=yes" - "--disable-gui" - ]; - - buildPhase = '' - runHook preBuild - - make - - runHook postBuild - ''; - - postInstall = '' - mv $out/bin/ophcrack $out/bin/ophcrack-cli - ''; - - meta = with lib; { - description = "Free Windows password cracker based on rainbow tables"; - homepage = "https://ophcrack.sourceforge.io"; - license = with licenses; [ gpl2Plus ]; - maintainers = with maintainers; [ tochiaha ]; - mainProgram = "ophcrack-cli"; - platforms = platforms.all; - }; -} - diff --git a/pkgs/by-name/op/ophcrack/package.nix b/pkgs/by-name/op/ophcrack/package.nix new file mode 100644 index 000000000000..13709ad9973a --- /dev/null +++ b/pkgs/by-name/op/ophcrack/package.nix @@ -0,0 +1,63 @@ +{ + lib, + stdenv, + libsForQt5, + fetchurl, + fetchpatch, + pkg-config, + openssl, + expat, + enableGui ? true, +}: +stdenv.mkDerivation rec { + + pname = "ophcrack"; + version = "3.8.0"; + + src = fetchurl { + url = "mirror://ophcrack/ophcrack/${version}/ophcrack-${version}.tar.bz2"; + hash = "sha256-BIpt9XmDo6WjGsfE7BLfFqpJ5lKilnbZPU75WdUK7uA="; + }; + + patches = [ + (fetchpatch { + url = "https://salsa.debian.org/pkg-security-team/ophcrack/-/raw/c60118b40802e1162dcebfe5f881cf973b2334d3/debian/patches/fix_spelling_error.diff"; + hash = "sha256-Fc044hTU4Mtdym+HukGAwGzaLm7aVzV9KpvHvFUG2Sc="; + }) + (fetchpatch { + url = "https://salsa.debian.org/pkg-security-team/ophcrack/-/raw/e19d993a7dbf131d13128366e2aac270a685befc/debian/patches/qmake_crossbuild.diff"; + hash = "sha256-sOKXOBpAYGLacU6IxjRzy3HCnGm4DFowDL2qP+DzG8M="; + }) + ]; + + nativeBuildInputs = [ pkg-config ] ++ lib.optional enableGui libsForQt5.wrapQtAppsHook; + buildInputs = + [ openssl ] + ++ (if enableGui then [ libsForQt5.qtcharts ] else [ expat ]) ++ lib.optional stdenv.isDarwin expat; + + configureFlags = + [ "--with-libssl" ] + ++ ( + if enableGui then + [ + "--enable-gui" + "--with-qt5charts" + ] + else + [ "--disable-gui" ] + ); + + installPhase = lib.optional stdenv.isDarwin '' + mkdir -p $out/bin + cp -R src/ophcrack $out/bin + ''; + + meta = { + description = "Free Windows password cracker based on rainbow tables"; + homepage = "https://ophcrack.sourceforge.io"; + license = with lib.licenses; [ gpl2Plus ]; + maintainers = with lib.maintainers; [ tochiaha ]; + mainProgram = "ophcrack"; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bc45a788fde3..58b8b18899b6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11151,6 +11151,8 @@ with pkgs; openfec = callPackage ../development/libraries/openfec { }; + ophcrack-cli = ophcrack.override { enableGui = false; }; + ophis = python3Packages.callPackage ../development/compilers/ophis { }; opendylan_bin = callPackage ../development/compilers/opendylan/bin.nix { };