2022-04-25 23:52:13 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, openssl, nss, nspr, libkrb5, gmp, zlib, libpcap, re2
|
2022-04-23 21:05:44 +00:00
|
|
|
, gcc, python3Packages, perl, perlPackages, makeWrapper, fetchpatch
|
2015-10-13 02:33:14 +00:00
|
|
|
}:
|
2014-09-03 23:30:04 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "john";
|
2019-06-04 01:57:14 +00:00
|
|
|
version = "1.9.0-jumbo-1";
|
2015-10-12 18:29:52 +00:00
|
|
|
|
2022-04-25 23:52:13 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openwall";
|
|
|
|
repo = pname;
|
|
|
|
rev = "1.9.0-Jumbo-1";
|
|
|
|
sha256 = "sha256-O1iPh5QTMjZ78sKvGbvSpaHFbBuVc1z49UKTbMa24Rs=";
|
2015-10-12 18:29:52 +00:00
|
|
|
};
|
|
|
|
|
2022-04-23 21:05:44 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-gcc-11-struct-allignment-incompatibility.patch";
|
|
|
|
url = "https://github.com/openwall/john/commit/154ee1156d62dd207aff0052b04c61796a1fde3b.patch";
|
|
|
|
sha256 = "sha256-3rfS2tu/TF+KW2MQiR+bh4w/FVECciTooDQNTHNw31A=";
|
|
|
|
})
|
2022-12-27 09:35:11 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "improve-apple-clang-pseudo-intrinsics-portability.patch";
|
|
|
|
url = "https://github.com/openwall/john/commit/c9825e688d1fb9fdd8942ceb0a6b4457b0f9f9b4.patch";
|
|
|
|
excludes = [ "doc/*" ];
|
|
|
|
sha256 = "sha256-hgoiz7IgR4f66fMP7bV1F8knJttY8g2Hxyk3QfkTu+g=";
|
|
|
|
})
|
2022-04-23 21:05:44 +00:00
|
|
|
];
|
|
|
|
|
2015-10-13 02:33:14 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -ri -e '
|
|
|
|
s!^(#define\s+CFG_[A-Z]+_NAME\s+).*/!\1"'"$out"'/etc/john/!
|
|
|
|
/^#define\s+JOHN_SYSTEMWIDE/s!/usr!'"$out"'!
|
|
|
|
' src/params.h
|
|
|
|
sed -ri -e '/^\.include/ {
|
|
|
|
s!\$JOHN!'"$out"'/etc/john!
|
|
|
|
s!^(\.include\s*)<([^./]+\.conf)>!\1"'"$out"'/etc/john/\2"!
|
|
|
|
}' run/*.conf
|
|
|
|
'';
|
2015-10-12 18:29:52 +00:00
|
|
|
|
2017-09-01 15:02:38 +00:00
|
|
|
preConfigure = ''
|
|
|
|
cd src
|
|
|
|
# Makefile.in depends on AS and LD being set to CC, which is set by default in configure.ac.
|
|
|
|
# This ensures we override the environment variables set in cc-wrapper/setup-hook.sh
|
|
|
|
export AS=$CC
|
|
|
|
export LD=$CC
|
|
|
|
'';
|
2019-12-06 15:43:45 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-native-tests"
|
|
|
|
"--with-systemwide"
|
|
|
|
];
|
2015-10-12 18:29:52 +00:00
|
|
|
|
2021-03-14 16:11:48 +00:00
|
|
|
buildInputs = [ openssl nss nspr libkrb5 gmp zlib libpcap re2 ];
|
2019-11-01 08:42:33 +00:00
|
|
|
nativeBuildInputs = [ gcc python3Packages.wrapPython perl makeWrapper ];
|
|
|
|
propagatedBuildInputs = (with python3Packages; [ dpkt scapy lxml ]) ++ # For pcap2john.py
|
2018-12-14 15:40:36 +00:00
|
|
|
(with perlPackages; [ DigestMD4 DigestSHA1 GetoptLong # For pass_gen.pl
|
2022-02-04 11:02:50 +00:00
|
|
|
CompressRawLzma # For 7z2john.pl
|
2018-07-22 02:03:24 +00:00
|
|
|
perlldap ]); # For sha-dump.pl
|
2017-12-31 23:15:56 +00:00
|
|
|
# TODO: Get dependencies for radius2john.pl and lion2john-alt.pl
|
2017-03-09 23:48:53 +00:00
|
|
|
|
|
|
|
# gcc -DAC_BUILT -Wall vncpcap2john.o memdbg.o -g -lpcap -fopenmp -o ../run/vncpcap2john
|
|
|
|
# gcc: error: memdbg.o: No such file or directory
|
|
|
|
enableParallelBuilding = false;
|
2015-10-13 02:33:14 +00:00
|
|
|
|
2017-12-31 23:15:56 +00:00
|
|
|
postInstall = ''
|
2020-08-17 11:11:43 +00:00
|
|
|
mkdir -p "$out/bin" "$out/etc/john" "$out/share/john" "$out/share/doc/john" "$out/share/john/rules" "$out/${perlPackages.perl.libPrefix}"
|
2017-12-31 23:15:56 +00:00
|
|
|
find -L ../run -mindepth 1 -maxdepth 1 -type f -executable \
|
|
|
|
-exec cp -d {} "$out/bin" \;
|
2015-10-13 02:33:14 +00:00
|
|
|
cp -vt "$out/etc/john" ../run/*.conf
|
|
|
|
cp -vt "$out/share/john" ../run/*.chr ../run/password.lst
|
2019-11-14 15:59:45 +00:00
|
|
|
cp -vt "$out/share/john/rules" ../run/rules/*.rule
|
2015-10-13 02:33:14 +00:00
|
|
|
cp -vrt "$out/share/doc/john" ../doc/*
|
2020-08-17 11:11:43 +00:00
|
|
|
cp -vt "$out/${perlPackages.perl.libPrefix}" ../run/lib/*
|
2014-09-03 23:30:04 +00:00
|
|
|
'';
|
2015-10-12 18:29:52 +00:00
|
|
|
|
2017-12-31 23:15:56 +00:00
|
|
|
postFixup = ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
|
|
|
|
for i in $out/bin/*.pl; do
|
2020-08-17 11:11:43 +00:00
|
|
|
wrapProgram "$i" --prefix PERL5LIB : "$PERL5LIB:$out/${perlPackages.perl.libPrefix}"
|
2017-12-31 23:15:56 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-01-24 16:35:54 +00:00
|
|
|
meta = with lib; {
|
2014-09-03 23:30:04 +00:00
|
|
|
description = "John the Ripper password cracker";
|
2022-04-25 23:52:13 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
homepage = "https://github.com/openwall/john/";
|
2019-12-06 15:47:29 +00:00
|
|
|
maintainers = with maintainers; [ offline matthewbauer ];
|
|
|
|
platforms = platforms.unix;
|
2014-09-03 23:30:04 +00:00
|
|
|
};
|
|
|
|
}
|