about summary refs log tree commit diff
path: root/pkgs/tools/security/john/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/john/default.nix')
-rw-r--r--pkgs/tools/security/john/default.nix27
1 files changed, 18 insertions, 9 deletions
diff --git a/pkgs/tools/security/john/default.nix b/pkgs/tools/security/john/default.nix
index 37946b940cf1..7552b21ed333 100644
--- a/pkgs/tools/security/john/default.nix
+++ b/pkgs/tools/security/john/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, openssl, nss, nspr, kerberos, gmp, zlib, libpcap, re2
-, writeText, gcc
+, writeText, gcc, pythonPackages, perl, perlPackages, makeWrapper
 }:
 
 with stdenv.lib;
@@ -35,7 +35,11 @@ stdenv.mkDerivation rec {
   '';
   configureFlags = [ "--disable-native-macro" ];
 
-  buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 gcc ];
+  buildInputs = [ openssl nss nspr kerberos gmp zlib libpcap re2 gcc pythonPackages.wrapPython perl makeWrapper ];
+  propagatedBuildInputs = (with pythonPackages; [ dpkt scapy lxml ]) ++ # For pcap2john.py
+                          (with perlPackages; [ DigestMD4 DigestMD5 DigestSHA1 GetoptLong MIMEBase64 # For pass_gen.pl
+                                                NetLDAP ]); # For sha-dump.pl
+                          # TODO: Get dependencies for radius2john.pl and lion2john-alt.pl
 
   # gcc -DAC_BUILT -Wall vncpcap2john.o memdbg.o -g    -lpcap -fopenmp -o ../run/vncpcap2john
   # gcc: error: memdbg.o: No such file or directory
@@ -43,18 +47,23 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = [ "-DJOHN_SYSTEMWIDE=1" ];
 
-  installPhase = ''
-    mkdir -p "$out/etc/john" "$out/share/john" "$out/share/doc/john"
-    find ../run -mindepth 1 -maxdepth 1 -type f -executable \
-      -exec "${stdenv.shell}" "${writeText "john-binary-install.sh" ''
-        filename="$(basename "$1")"
-        install -vD "$1" "$out/bin/''${filename%.*}"
-      ''}" {} \;
+  postInstall = ''
+    mkdir -p "$out/bin" "$out/etc/john" "$out/share/john" "$out/share/doc/john"
+    find -L ../run -mindepth 1 -maxdepth 1 -type f -executable \
+      -exec cp -d {} "$out/bin" \;
     cp -vt "$out/etc/john" ../run/*.conf
     cp -vt "$out/share/john" ../run/*.chr ../run/password.lst
     cp -vrt "$out/share/doc/john" ../doc/*
   '';
 
+  postFixup = ''
+    wrapPythonPrograms
+
+    for i in $out/bin/*.pl; do
+      wrapProgram "$i" --prefix PERL5LIB : $PERL5LIB
+    done
+  '';
+
   meta = {
     description = "John the Ripper password cracker";
     license = licenses.gpl2;