From 0fee8b9f9f6fc484936ddbb3287a07f45140423b Mon Sep 17 00:00:00 2001
From: Tochiaha <tochipreciousahan@gmail.com>
Date: Tue, 11 Jun 2024 23:48:47 +0100
Subject: [PATCH] ophcrack-cli: init at 3.8.0

---
 pkgs/by-name/op/ophcrack-cli/package.nix | 73 ++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 pkgs/by-name/op/ophcrack-cli/package.nix

diff --git a/pkgs/by-name/op/ophcrack-cli/package.nix b/pkgs/by-name/op/ophcrack-cli/package.nix
new file mode 100644
index 000000000000..bbc7b8e19978
--- /dev/null
+++ b/pkgs/by-name/op/ophcrack-cli/package.nix
@@ -0,0 +1,73 @@
+{ 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;
+  };
+}
+