From defc725219d1fb9b56662370e014012929e557af Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Mon, 11 Aug 2025 08:20:10 +0200 Subject: [PATCH] hashcat: patch helper scripts (#430633) --- .../ha/hashcat/0001-python-shebangs.patch | 42 +++++++++++++++++++ pkgs/by-name/ha/hashcat/package.nix | 17 ++++++++ 2 files changed, 59 insertions(+) create mode 100644 pkgs/by-name/ha/hashcat/0001-python-shebangs.patch diff --git a/pkgs/by-name/ha/hashcat/0001-python-shebangs.patch b/pkgs/by-name/ha/hashcat/0001-python-shebangs.patch new file mode 100644 index 000000000000..d9715b864036 --- /dev/null +++ b/pkgs/by-name/ha/hashcat/0001-python-shebangs.patch @@ -0,0 +1,42 @@ +diff --git a/tools/bitlocker2hashcat.py b/tools/bitlocker2hashcat.py +index f7501a37b..a72fb8c78 100755 +--- a/tools/bitlocker2hashcat.py ++++ b/tools/bitlocker2hashcat.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python3 ++ + # Construct a hash for use with hashcat mode 22100 + # Usage: python3 bitlocker2hashcat.py -o + # Hashcat supports modes $bitlocker$0$ and $bitlocker$1$ and therefore this script will output hashes that relate to a VMK protected by a user password only. +diff --git a/tools/keybag2hashcat.py b/tools/keybag2hashcat.py +index 83da25c5e..6a30384ac 100755 +--- a/tools/keybag2hashcat.py ++++ b/tools/keybag2hashcat.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python3 ++ + import argparse + import logging + import sys +diff --git a/tools/shiro1-to-hashcat.py b/tools/shiro1-to-hashcat.py +old mode 100755 +new mode 100644 +index 9619530ef..86ee8e502 +--- a/tools/shiro1-to-hashcat.py ++++ b/tools/shiro1-to-hashcat.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python3 ++ + import os + import re + import glob +diff --git a/tools/veeamvbk2hashcat.py b/tools/veeamvbk2hashcat.py +index e8d6ac05c..5f6d1977a 100755 +--- a/tools/veeamvbk2hashcat.py ++++ b/tools/veeamvbk2hashcat.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python3 ++ + import argparse + import binascii + diff --git a/pkgs/by-name/ha/hashcat/package.nix b/pkgs/by-name/ha/hashcat/package.nix index ddc90d75be08..c4f8f9f6b295 100644 --- a/pkgs/by-name/ha/hashcat/package.nix +++ b/pkgs/by-name/ha/hashcat/package.nix @@ -10,6 +10,8 @@ minizip, opencl-headers, ocl-icd, + perl, + python3, xxHash, zlib, libiconv, @@ -24,6 +26,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-hCtx0NNLAgAFiCR6rp/smg/BMnfyzTpqSSWw8Jszv3U="; }; + patches = [ + ./0001-python-shebangs.patch + ]; + postPatch = '' # MACOSX_DEPLOYMENT_TARGET is defined by the enviroment # Remove hardcoded paths on darwin @@ -44,6 +50,17 @@ stdenv.mkDerivation rec { buildInputs = [ minizip opencl-headers + perl + (python3.withPackages ( + ps: with ps; [ + # leveldb # Required for bitwarden2hashcat.py, broken since python 3.12 https://github.com/NixOS/nixpkgs/pull/342756 + protobuf + pyasn1 + pycryptodome + python-snappy + simplejson + ] + )) xxHash zlib ]