# modules/features/pentest/_pkgs/default.nix — what nixpkgs does not carry.
#
# Not a flake-parts module (the path contains `/_`, so import-tree skips it);
# payloads.nix and the categories import it as a plain function.
#
# Every source is pinned by revision or by file hash, so the toolkit rolls back
# with the system generation and an upstream force-push cannot change what you
# staged on a target. `pentest-update` re-pins them on demand.
#
# Two kinds of thing live here:
#
# * Prebuilt .NET binaries (SharpCollection, the potato family, winPEAS).
# Building .NET offline under Nix is brittle, so these are pinned release
# assets, installed verbatim. This is the one place the toolkit trusts
# someone else's build — the hashes are what make that reviewable.
# * Scripts (krbrelayx, nishang, linpeas, PrintNightmare). Plain files, and
# the python ones get a wrapper so they run without a venv.
#
# Windows and non-x86 binaries are NOT here: those are cross-compiled from
# source in payloads.nix, which is better provenance than any download.
{ lib, pkgs }:
let
gh = args: pkgs.fetchFromGitHub args;
# The krbrelayx scripts import impacket, ldap3, dnspython and pyasn1.
krbPython = pkgs.python3.withPackages (ps: with ps; [
impacket
ldap3
dnspython
pyasn1
]);
# Standalone upstream scripts, with their own Python closure and data files.
# Keep the caller's cwd: loot and generated files belong in the box workspace.
pythonScript = { name, owner, repo, rev, hash, script, libraries,
aliases ? [ ], postPatch ? "", installCheck ? "" }:
let python = pkgs.python3.withPackages libraries;
in pkgs.stdenvNoCC.mkDerivation {
pname = name;
version = "unstable-${builtins.substring 0 7 rev}";
src = gh { inherit owner repo rev hash; };
nativeBuildInputs = [ pkgs.makeWrapper ];
dontBuild = true;
dontPatchShebangs = true;
inherit postPatch;
installPhase = ''
runHook preInstall
mkdir -p $out/share/${name} $out/bin
cp -r . $out/share/${name}/
makeWrapper ${python}/bin/python3 $out/bin/${name} \
--add-flags $out/share/${name}/${script} \
--unset PYTHONPATH --unset NIX_PYTHONPATH
${lib.concatMapStringsSep "\n" (alias: "ln -s ${name} $out/bin/${alias}") aliases}
runHook postInstall
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/${name} --help >/dev/null
${installCheck}
runHook postInstallCheck
'';
meta = {
homepage = "https://github.com/${owner}/${repo}";
description = "${name}, with pinned source and Python dependencies";
platforms = lib.platforms.linux;
mainProgram = name;
};
};
in
rec {
# Shared by core and the optional database shell, without server binaries.
redis-client = pkgs.runCommand "pentest-redis-client" { } ''
mkdir -p $out/bin
ln -s ${pkgs.redis}/bin/redis-cli $out/bin/redis-cli
'';
# Separate application, never in pentest-python's library environment: both
# collectors import a module named bloodhound but produce different formats.
bloodhound-ce-python = let
application = pkgs.python3Packages.buildPythonApplication {
pname = "bloodhound-ce";
version = "1.9.1";
pyproject = true;
src = pkgs.fetchPypi {
pname = "bloodhound_ce";
version = "1.9.1";
hash = "sha256-CD3z3DrZmO3P+Ptj/dj1tGSqtf2sjgXMmztlICEPeas=";
};
build-system = [ pkgs.python3Packages.setuptools ];
dependencies = with pkgs.python3Packages; [
dnspython impacket ldap3 pyasn1 pycryptodome
];
pythonImportsCheck = [ "bloodhound" ];
meta = {
description = "Python collector for BloodHound Community Edition";
homepage = "https://github.com/dirkjanm/BloodHound.py/tree/bloodhound-ce";
license = lib.licenses.mit;
mainProgram = "bloodhound-ce-python";
};
};
in pkgs.runCommand "bloodhound-ce-python" { meta = application.meta; } ''
# Export only the CLI, keeping CE's bloodhound module inside its closure.
# Profiles merge lib/ too, so installing both raw applications collides.
mkdir -p $out/bin
ln -s ${application}/bin/bloodhound-ce-python $out/bin/bloodhound-ce-python
'';
firepwd = pythonScript {
name = "firepwd";
owner = "lclevy"; repo = "firepwd";
rev = "68a3d16ad6453cf8d717e12254f092bda4321d90";
hash = "sha256-0tnYqua0hqii3GuvJ4WXZTqoal98Sm97rhcQu1pO15g=";
script = "firepwd.py";
aliases = [ "firepwd.py" ];
libraries = ps: with ps; [ pycryptodome pyasn1 ];
};
ntlm-theft = pythonScript {
name = "ntlm_theft";
owner = "Greenwolf"; repo = "ntlm_theft";
rev = "7ef7fb5cda5cc3b03d512f2a9bc4d17bb93d0656";
hash = "sha256-va1qDfQ0s1/VsZc9xCIqGBfI3EGl+sfYTvYDnJqFe+0=";
script = "ntlm_theft.py";
aliases = [ "ntlm_theft.py" ];
libraries = ps: [ ps.xlsxwriter ];
installCheck = ''
mkdir wax-test
cd wax-test
$out/bin/ntlm_theft -g wax -s 192.0.2.1 -f sample
grep -q '192.0.2.1' sample/sample.wax
'';
};
# viewgen: ASP.NET __VIEWSTATE forge/decode from leaked machineKeys, pure
# Python so it runs where ysoserial.net (a .NET Framework app) will not. Pairs
# with vs45 below for the .NET 4.5 purpose-string signing viewgen omits.
viewgen = pythonScript {
name = "viewgen";
owner = "0xacb"; repo = "viewgen";
rev = "06e26dea866fda5e62e9abedff326977c099b6bc";
hash = "sha256-Sg+/Adf83NQgwBFM6khlOgznhnFHxMiglHAwUOgFhLg=";
script = "viewgen";
libraries = ps: with ps; [ colored viewstate pycryptodome ];
installCheck = ''
$out/bin/viewgen --help | grep -q 'ViewState'
'';
};
# vs45: our ASP.NET 4.5 purpose-string ViewState signer + driver (from HTB
# Pov). Signs a viewgen TypeConfuseDelegate gadget with the SP800-108 KDF +
# NetFXCryptoService envelope that viewgen's legacy signer and ysoserial.net
# under wine/mono cannot produce. `vs45 "<command>"` forges and POSTs; the
# target defaults to Pov (VSURL, VPATH, … override it) and the machineKey
# comes from VKEY/DKEY, which are required: box loot stays out of the repo.
viewstate45 =
let python = pkgs.python3.withPackages (ps: [ ps.pycryptodome ]);
in pkgs.stdenvNoCC.mkDerivation {
pname = "vs45";
version = "1.0";
dontUnpack = true;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/share/vs45
cp ${./vs45/vs45.py} $out/share/vs45/vs45.py
cp ${./vs45/vs45_pwn.py} $out/share/vs45/vs45_pwn.py
cp ${./vs45/gadget_template.b64} $out/share/vs45/gadget_template.b64
makeWrapper ${python}/bin/python3 $out/bin/vs45 \
--add-flags "$out/share/vs45/vs45_pwn.py"
'';
installCheck = ''
$out/bin/vs45 2>&1 | grep -q 'usage: vs45_pwn'
'';
doInstallCheck = true;
};
targetedKerberoast = pythonScript {
name = "targetedKerberoast";
owner = "ShutdownRepo"; repo = "targetedKerberoast";
rev = "ebed0790002dfae503eb5e5525a0630f131fa117";
hash = "sha256-PVXYZ1rWvoHOzhuGHOOieO98gdr+jBfw17AAerelHYU=";
script = "targetedKerberoast.py";
aliases = [ "targetedKerberoast.py" ];
libraries = ps: with ps; [ ldap3 pyasn1 impacket rich pycryptodome ];
};
passthecert = pythonScript {
name = "passthecert";
owner = "AlmondOffSec"; repo = "PassTheCert";
rev = "b210d0f16e70e29e9ced2035483b272bbd1d02ea";
hash = "sha256-17l0VF4z2w9Nk6NlUeX/aBo2o9SMrLiyPkVXTi4wAdM=";
script = "Python/passthecert.py";
aliases = [ "passthecert.py" ];
libraries = ps: with ps; [ impacket ldap3 ldapdomaindump ];
};
adfspoof = pythonScript {
name = "ADFSpoof";
owner = "mandiant"; repo = "ADFSpoof";
rev = "714b113db9d8cc98d4c39ccdfddae4a4b456f05d";
hash = "sha256-MK3wc24SZD+/AvIHaC5vK/mW1cRDNs62SJtPUXK8cqc=";
script = "ADFSpoof.py";
aliases = [ "ADFSpoof.py" ];
libraries = ps: with ps; [ cryptography lxml pyasn1 signxml six ];
# 2026-10-11: upstream pins cryptography 2.9.2. Adapt its custom Microsoft
# KDF to current APIs, preserving its length-in-BYTES semantics. The normal
# SP800-108 KDF encodes bits, so replacing it with that would break decryption.
postPatch = ''
substituteInPlace microsoft_kbkdf.py \
--replace-fail '@utils.register_interface(KeyDerivationFunction)' '@KeyDerivationFunction.register' \
--replace-fail 'utils.int_to_bytes(1, value)' '(1).to_bytes(value, "big")' \
--replace-fail 'utils.int_to_bytes(1, self._rlen)' '(1).to_bytes(self._rlen, "big")' \
--replace-fail 'utils.int_to_bytes(i, self._rlen)' 'i.to_bytes(self._rlen, "big")' \
--replace-fail 'utils.int_to_bytes(self._length, self._llen)' 'self._length.to_bytes(self._llen, "big")'
# The HMAC constructor performs algorithm support validation now.
${pkgs.python3}/bin/python3 - <<'PY'
from pathlib import Path
p = Path('microsoft_kbkdf.py')
s = p.read_text()
start = s.index(' if not backend.hmac_supported(algorithm):')
end = s.index(' if not isinstance(mode, Mode):', start)
p.write_text(s[:start] + s[end:])
PY
substituteInPlace SamlSigner.py \
--replace-fail 'import string' 'import string; from pathlib import Path' \
--replace-fail 'open("templates/{0}.xml".format(template),' \
'open(Path(__file__).parent / "templates" / "{0}.xml".format(template),'
'';
installCheck = ''
${pkgs.python3.withPackages (ps: with ps; [ cryptography lxml pyasn1 signxml six ])}/bin/python3 \
${../../../../tests/test_adfspoof_compat.py} $out/share/ADFSpoof
'';
};
# Snoopy's DMG generator. Plain image creation needs zlib, not the obsolete
# OpenSSL 1.0 FileVault encryption implementation in this upstream project.
libdmg = pkgs.stdenv.mkDerivation {
pname = "libdmg-hfsplus";
version = "unstable-7ac55ec";
src = gh {
owner = "planetbeing"; repo = "libdmg-hfsplus";
rev = "7ac55ec64c96f7800d9818ce64c79670e7f02b67";
hash = "sha256-5HHb08GEPzgLQC8y9YyhGoin1Oxy2UtOCx/4Xmb4ATQ=";
};
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [ pkgs.zlib ];
cmakeFlags = [ "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" ];
env.NIX_CFLAGS_COMPILE = "-fcommon";
postPatch = ''
substituteInPlace dmg/CMakeLists.txt \
--replace-fail 'INCLUDE(FindOpenSSL)' '# FileVault support disabled'
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ pkgs.cdrkit pkgs.binutils ];
installCheckPhase = ''
mkdir image-src
printf 'benign DMG construction check\n' > image-src/check.txt
genisoimage -D -V tool-check -no-pad -r -apple -file-mode 0777 \
-o test.img image-src >/dev/null 2>&1
$out/bin/dmg dmg test.img test.dmg >/dev/null
test -s test.dmg
strings test.dmg | grep -q '<plist'
'';
meta = {
description = "DMG image builder (without FileVault encryption)";
homepage = "https://github.com/planetbeing/libdmg-hfsplus";
platforms = lib.platforms.linux;
mainProgram = "dmg";
};
};
psgetsystem = pkgs.stdenvNoCC.mkDerivation {
pname = "psgetsystem";
version = "unstable-bbe480f";
src = gh {
owner = "decoder-it"; repo = "psgetsystem";
rev = "bbe480f91664b8eca40770bb0cebbec944acfc0d";
hash = "sha256-v7+qUrgqmiMO5XQy5CQySVUMjMJMM9AqfV2Q4Z+nIoo=";
};
dontBuild = true;
dontPatchShebangs = true;
installPhase = ''
install -Dm0644 psgetsys.ps1 $out/psgetsys.ps1
'';
};
##### Prebuilt .NET #########################################################
# 102 tools per framework/arch: Rubeus, SharpHound, Seatbelt, Certify,
# Whisker, SharpUp, SharpView, StandIn, ADCSPwn, SweetPotato, SharpPrinter,
# DeployPrinterNightmare, KrbRelay(Up), SafetyKatz, Snaffler, Inveigh…
# One pin covers most of the Windows AD arsenal.
sharpcollection = pkgs.stdenvNoCC.mkDerivation {
pname = "sharpcollection";
version = "unstable-2026-10-08";
src = gh {
owner = "Flangvik";
repo = "SharpCollection";
rev = "c53d7eb583d853de0bd693c1bb61581d59b2f44e";
hash = "sha256-Uqf9QyTRbItUJifRbMIcVrP2YPTo0BH7ybiig64zuHg=";
};
dontBuild = true;
installPhase = ''
mkdir -p $out
cp -r NetFramework_* $out/
cp README.md $out/ 2>/dev/null || true
'';
meta = {
description = "Nightly builds of common C# offensive tools";
homepage = "https://github.com/Flangvik/SharpCollection";
platforms = lib.platforms.all;
};
};
# linpeas.sh and the winPEAS builds come from the release, not the repo:
# the repo only holds the builder that assembles them.
peass =
let
version = "20261006-4cf2d06d";
asset = name: hash: pkgs.fetchurl {
url = "https://github.com/peass-ng/PEASS-ng/releases/download/${version}/${name}";
inherit hash;
};
in
pkgs.runCommand "peass-${version}"
{
# linpeas.sh runs on the TARGET. stdenv's fixupPhase would rewrite its
# shebang to a /nix/store bash that does not exist there.
dontPatchShebangs = true;
}
''
mkdir -p $out/linux $out/windows
install -m0755 ${asset "linpeas.sh" "sha256-5Eso9YNTGbvD6R31h5Yl8q0CY07s+L3dAhbmfD64Cjs="} $out/linux/linpeas.sh
install -m0644 ${asset "winPEASx64.exe" "sha256-6eLCsHPPrhwiqDxGbsQ+Qp11KoONY01evH5Zf/LAYOw="} $out/windows/winPEASx64.exe
install -m0644 ${asset "winPEASx86.exe" "sha256-pZvQ8UUvnHdGhtGJxUUeqj98zpyp8gvzvFcGQEcJKQM="} $out/windows/winPEASx86.exe
install -m0644 ${asset "winPEASany.exe" "sha256-7BbBDWubysMakm2qN8fym8OIJuADnZPUv+24UEceu/w="} $out/windows/winPEASany.exe
'';
# BloodHound Legacy (4.3.1), the old Electron GUI.
#
# nixpkgs REMOVED this on 2025-09-08 with the message "bloodhound's upstream
# is archived, and the package is running on Electron 11", and both halves of
# that are true: upstream is archived, and Electron 11 is years out of
# support. It is here because legacy BloodHound reads the OLD JSON format
# that bloodhound-python 1.9 and SharpHound v1 produce, which BloodHound CE
# cannot ingest — so for old collection data this is still the only viewer.
#
# Treat it as what it is: an unmaintained browser engine. Point it at your own
# lab data, not at anything untrusted.
bloodhoundLegacy =
let
version = "4.3.1";
# An unmaintained, unsandboxed Chromium renders AD data that, on HTB,
# other players control. If a renderer is exploited it must not reach
# what matters: the home directory is read-only with keys, secrets,
# browser profiles and VPN profiles hidden, /run/user (where sops-nix
# decrypts secrets) is absent, and bwrap sets no_new_privs, so nothing
# inside can use sudo — which cuts any chain to root. Loopback stays
# reachable (it talks to neo4j on 127.0.0.1:7687).
bloodhoundLegacyJail = pkgs.writeShellScript "bloodhound-legacy" ''
set -euo pipefail
state="''${XDG_CONFIG_HOME:-$HOME/.config}/bloodhound"
mkdir -p "$state"
args=(
--die-with-parent --new-session --unshare-pid --unshare-ipc --unshare-uts
--ro-bind /nix/store /nix/store
--ro-bind /etc /etc
--ro-bind /sys /sys
--dev /dev --dev-bind-try /dev/dri /dev/dri --dev-bind-try /dev/shm /dev/shm
--proc /proc
--tmpfs /tmp --tmpfs /run
--ro-bind-try /run/current-system /run/current-system
--ro-bind-try /run/opengl-driver /run/opengl-driver
--ro-bind-try /tmp/.X11-unix /tmp/.X11-unix
--ro-bind "$HOME" "$HOME"
--bind "$state" "$state"
)
[ -n "''${XAUTHORITY:-}" ] && [ -e "$XAUTHORITY" ] && args+=(--ro-bind "$XAUTHORITY" "$XAUTHORITY")
if [ -n "''${WAYLAND_DISPLAY:-}" ] && [ -n "''${XDG_RUNTIME_DIR:-}" ] && [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then
args+=(--ro-bind "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY")
fi
for d in .ssh .gnupg .password-store .passage .local/share/passage .local/share/keyrings \
.config/sops .config/sops-nix .config/dcx .config/htb .config/gh .config/git-site \
.zen .floorp .mozilla .config/vesktop .config/discord .config/Signal .local/share/TelegramDesktop \
.aws .kube .docker .config/rclone .local/share/atuin .zsh_history .bash_history \
NixDaemon/secrets git/DAEMONSEC-VAULT; do
t="$HOME/$d"
[ -e "$t" ] || continue
# home-manager links some of these; bwrap cannot mount over a
# symlink, so hide its target — unless that is the (public) store.
if [ -L "$t" ]; then
t=$(${pkgs.coreutils}/bin/realpath "$t")
case "$t" in "$HOME"/*) ;; *) continue ;; esac
fi
if [ -d "$t" ]; then args+=(--tmpfs "$t"); else args+=(--ro-bind /dev/null "$t"); fi
done
exec ${pkgs.bubblewrap}/bin/bwrap "''${args[@]}" -- @app@ "$@"
'';
zipFile = pkgs.fetchurl {
url = "https://github.com/SpecterOps/BloodHound-Legacy/releases/download/v${version}/BloodHound-linux-x64.zip";
hash = "sha256-OtQNrbPGAw5WoDeli6+REcx9ajor0CeF89L7Gg44aB0=";
};
in
pkgs.stdenv.mkDerivation {
pname = "bloodhound-legacy";
inherit version;
src = zipFile;
nativeBuildInputs = [
pkgs.unzip
pkgs.autoPatchelfHook
pkgs.makeWrapper
];
buildInputs = with pkgs; [
alsa-lib at-spi2-atk at-spi2-core atk cairo cups dbus expat
gdk-pixbuf glib gtk3 libdrm libxkbcommon libgbm mesa nspr nss pango
libGL libglvnd systemdLibs
libX11 libXcomposite libXdamage libXext libXfixes libXrandr libxcb
libxscrnsaver libxshmfence libxtst
];
unpackPhase = "unzip -q $src";
dontBuild = true;
dontWrapGApps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/bloodhound-legacy $out/bin
cp -r BloodHound-linux-x64/. $out/share/bloodhound-legacy/
# --no-sandbox: Electron 11 insists on its setuid helper, which cannot be
# setuid in the store (without the flag it dies of SIGTRAP; tested,
# --disable-setuid-sandbox too). Its renderers therefore run with no
# Chromium sandbox at all, so the whole app goes into bubblewrap below.
makeWrapper $out/share/bloodhound-legacy/BloodHound $out/libexec/bloodhound-legacy-unconfined \
--add-flags "--no-sandbox"
install -Dm755 ${bloodhoundLegacyJail} $out/bin/bloodhound-legacy
substituteInPlace $out/bin/bloodhound-legacy --replace-fail @app@ $out/libexec/bloodhound-legacy-unconfined
runHook postInstall
'';
meta = {
description = "BloodHound Legacy 4.3.1 GUI (archived upstream, Electron 11) — reads pre-CE JSON";
homepage = "https://github.com/SpecterOps/BloodHound-Legacy";
platforms = [ "x86_64-linux" ];
mainProgram = "bloodhound-legacy";
};
};
# linWinPwn: a bash front-end that drives the AD tools in sequence —
# enumeration, ADCS, kerberoasting, relay checks, BloodHound collection.
# It shells out to nxc, impacket, certipy, bloodhound-python, kerbrute,
# ldapdomaindump, smbmap and friends, every one of which the `ad` category
# already installs, so the wrapper just puts them on its PATH.
linwinpwn = pkgs.stdenvNoCC.mkDerivation {
pname = "linwinpwn";
version = "unstable-2026-10-08";
src = gh {
owner = "lefayjey";
repo = "linWinPwn";
rev = "5eea01aa754fbe005fee77d51be523e8836b730a";
hash = "sha256-6wp1nRNX1Af81gi/zVXtIuJNKHiOyvmUqzFb9n8IGEE=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
dontBuild = true;
installPhase = ''
mkdir -p $out/share/linwinpwn $out/bin
cp -r . $out/share/linwinpwn/
chmod +x $out/share/linwinpwn/linWinPwn.sh
# linWinPwn calls impacket under several spellings depending on distro
# (secretsdump.py on Kali, impacket-secretsdump on Debian), so give it
# both: the package's own .py names and the alias set.
makeWrapper $out/share/linwinpwn/linWinPwn.sh $out/bin/linWinPwn \
--prefix PATH : ${
lib.makeBinPath (
(with pkgs; [
bash coreutils gnugrep gnused gawk findutils which
netexec certipy bloodhound-py rusthound-ce kerbrute smbmap
ldapdomaindump enum4linux-ng nmap john hashcat
krb5 openldap samba curl jq openssl python3
])
++ (with pkgs.python3Packages; [ impacket pypykatz bloodyad lsassy ])
++ (import ../_impacket.nix { inherit lib pkgs; }).both
)
}
ln -s $out/bin/linWinPwn $out/bin/linwinpwn
'';
meta = {
description = "Bash script that streamlines the use of a number of Active Directory tools";
homepage = "https://github.com/lefayjey/linWinPwn";
platforms = lib.platforms.linux;
mainProgram = "linWinPwn";
};
};
##### Scripts ###############################################################
# dirkjanm's relay toolkit. printerbug.py is the one you reach for to coerce
# authentication out of a host via MS-RPRN — the "printer bug" — and it is
# the Linux counterpart to SpoolSample.exe.
krbrelayx = pkgs.stdenvNoCC.mkDerivation {
pname = "krbrelayx";
version = "unstable-2026-10-08";
src = gh {
owner = "dirkjanm";
repo = "krbrelayx";
rev = "10b45a33bc4361ec4a5546eea62db2e4244d3255";
hash = "sha256-NnC14jVkWPhEtoGicTFMAef1/kHt8wZr6+Am4NQ4nUg=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
dontBuild = true;
# printerbug.py is staged into $PAYLOADS to run elsewhere; keep its
# `#!/usr/bin/env python3`. The bin/ wrappers are makeWrapper-generated and
# unaffected.
dontPatchShebangs = true;
installPhase = ''
mkdir -p $out/share/krbrelayx $out/bin
cp -r *.py lib $out/share/krbrelayx/
for s in krbrelayx addspn dnstool printerbug; do
makeWrapper ${krbPython}/bin/python $out/bin/$s \
--add-flags $out/share/krbrelayx/$s.py \
--prefix PYTHONPATH : $out/share/krbrelayx
done
'';
meta = {
description = "Kerberos relaying and unconstrained delegation abuse (krbrelayx, printerbug, addspn, dnstool)";
homepage = "https://github.com/dirkjanm/krbrelayx";
platforms = lib.platforms.linux;
mainProgram = "krbrelayx";
};
};
# Linux privilege-escalation enumeration, the thorough one.
lse = pkgs.stdenvNoCC.mkDerivation {
pname = "linux-smart-enumeration";
version = "unstable-2026-10-08";
src = gh {
owner = "diego-treitos";
repo = "linux-smart-enumeration";
rev = "b83a26f91641f85705c802f44aacb2ec42002157";
hash = "sha256-QKJvjmSUtwcgZyz7KX5JYEWSznQuRyTBeDIv+5KpITg=";
};
dontBuild = true;
# Same reason as peass: lse.sh is meant to run on the target. /bin/sh
# exists on NixOS too, so the unpatched shebang works locally as well.
dontPatchShebangs = true;
installPhase = ''
install -Dm0755 lse.sh $out/bin/lse
install -Dm0755 lse.sh $out/share/lse/lse.sh
'';
meta = {
description = "Linux enumeration for privilege escalation, with levels of detail";
homepage = "https://github.com/diego-treitos/linux-smart-enumeration";
platforms = lib.platforms.linux;
mainProgram = "lse";
};
};
# PowerShell offensive scripts: Invoke-PowerShellTcp, Get-Information,
# Invoke-Mimikatz, the Escalation and Gather sets.
nishang = pkgs.stdenvNoCC.mkDerivation {
pname = "nishang";
version = "unstable-2026-10-08";
src = gh {
owner = "samratashok";
repo = "nishang";
rev = "d87229d2112456470ad30a50edbf312463f2b09a";
hash = "sha256-q0baS6x7ayfzfopM7FgL7bcSmPChMryMAryfjfg4ym0=";
};
dontBuild = true;
installPhase = ''
mkdir -p $out/share/nishang
cp -r ActiveDirectory Antak-WebShell Backdoors Bypass Client Escalation \
Execution Gather Misc MITM Pivot Prasadhak Scan Shells Utility \
$out/share/nishang/ 2>/dev/null || true
cp *.md *.txt $out/share/nishang/ 2>/dev/null || true
'';
meta = {
description = "Offensive PowerShell for penetration testing";
homepage = "https://github.com/samratashok/nishang";
platforms = lib.platforms.all;
};
};
# PrintNightmare (CVE-2021-1675 / CVE-2021-34527), the python driver.
printnightmare = pkgs.stdenvNoCC.mkDerivation {
pname = "printnightmare";
version = "unstable-2026-10-08";
src = gh {
owner = "cube0x0";
repo = "CVE-2021-1675";
rev = "d2e96c1dc79f60f87eb88e22f01280e01c94a226";
hash = "sha256-baFt3r03tWWSvHYxItz/49liLQe11ki20FaGdNqIT2Q=";
};
dontBuild = true;
installPhase = ''
mkdir -p $out/share/printnightmare
cp CVE-2021-1675.py $out/share/printnightmare/
cp -r SharpPrintNightmare $out/share/printnightmare/ 2>/dev/null || true
'';
meta = {
description = "PrintNightmare (CVE-2021-1675 / CVE-2021-34527) exploit";
homepage = "https://github.com/cube0x0/CVE-2021-1675";
platforms = lib.platforms.all;
};
};
# Neo4j 4.4.42 — the version BloodHound actually works with.
#
# nixpkgs ships neo4j 2026.09.0, and BloodHound CE 8.3.1 cannot use it: its
# graph migration calls `db.indexes`, a procedure removed in Neo4j 5. The CE
# API starts, fails the migration and exits:
# "There is no procedure with the name `db.indexes` registered"
# BloodHound's own docker-compose pins neo4j:4.4.42, and legacy BloodHound
# 4.3 expects 4.x too, so this one version serves both viewers.
#
# Yes, this is an EOL database. That is upstream BloodHound's constraint,
# not a choice made here — delete this the day BHCE supports Neo4j 5.
neo4j44 =
let
version = "4.4.42";
in
pkgs.stdenvNoCC.mkDerivation {
pname = "neo4j";
inherit version;
src = pkgs.fetchurl {
url = "https://dist.neo4j.org/neo4j-community-${version}-unix.tar.gz";
hash = "sha256-LB67TUDWV9jHNd31shRLjITR95sFwSrGYr7deOZgghQ=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
dontBuild = true;
# JDK 11, not 17: neo4j 4.4 says "unsupported Java runtime" on 17 and
# then dies with
# LinkageError: Cannot to link java.nio.DirectByteBuffer
# module java.base does not open java.nio to unnamed module
# because JDK 17's module system refuses the reflective access it needs.
# 11 is the runtime upstream supports for this version.
#
# The distribution's shell scripts are meant to run from a writable
# NEO4J_HOME; the service builds one and points at this for lib/.
dontPatchShebangs = false;
installPhase = ''
runHook preInstall
mkdir -p $out/share/neo4j $out/bin
cp -r . $out/share/neo4j/
for b in neo4j neo4j-admin cypher-shell; do
makeWrapper $out/share/neo4j/bin/$b $out/bin/$b \
--set JAVA_HOME ${pkgs.jdk11} \
--prefix PATH : ${
lib.makeBinPath (with pkgs; [ jdk11 which gawk gnused coreutils procps gnugrep ])
}
done
runHook postInstall
'';
meta = {
description = "Neo4j 4.4 community — the version BloodHound requires";
homepage = "https://neo4j.com/";
license = lib.licenses.gpl3Only;
platforms = [ "x86_64-linux" ];
mainProgram = "neo4j";
};
};
# NOTE: `pentest-update` will always report this pin as "NEWER available".
# That is correct and must NOT be "fixed": the whole point is to keep an
# older build alongside the current one. nixpkgs provides the new one.
#
# mimikatz, the older build. nixpkgs carries one version (2.2.0-20220919);
# this is the 2021 build, kept because which one a given host tolerates
# varies, and "the old one works" is a real finding on an old box. Staged as
# a distinct FILENAME — two versions cannot both be `mimikatz.exe`, which is
# exactly why payloads are files and not commands.
mimikatzOld =
let
version = "2.2.0-20210810-2";
zipFile = pkgs.fetchurl {
url = "https://github.com/gentilkiwi/mimikatz/releases/download/${version}/mimikatz_trunk.zip";
hash = "sha256-M/MZDlXkkDwvES2T+J23uY7Q4hzChVsKPoWAbgPVf0Q=";
};
in
pkgs.runCommand "mimikatz-${version}" { } ''
mkdir -p $out
${pkgs.unzip}/bin/unzip -q -o ${zipFile} -d $out
test -f $out/x64/mimikatz.exe || { echo "mimikatzOld: x64/mimikatz.exe missing" >&2; exit 1; }
test -f $out/Win32/mimikatz.exe || { echo "mimikatzOld: Win32/mimikatz.exe missing" >&2; exit 1; }
'';
# Source only — zcgonvh ships no binary. Kept because compiling it on the
# target with the in-box csc.exe is the documented way to use it.
efspotatoSource = pkgs.stdenvNoCC.mkDerivation {
pname = "efspotato-source";
version = "unstable-2026-10-08";
src = gh {
owner = "zcgonvh";
repo = "EfsPotato";
rev = "0474c9fa732656c95b31d923bec5d845a965c874";
hash = "sha256-kJgvSTgySD9YfHcYEzXo2GRcOOti4ovzppDMX1oR2GM=";
};
dontBuild = true;
installPhase = ''
mkdir -p $out
cp EfsPotato.cs README.md $out/
'';
meta = {
description = "EfsPotato (MS-EFSR coercion to SYSTEM), C# source to compile on target";
homepage = "https://github.com/zcgonvh/EfsPotato";
platforms = lib.platforms.all;
};
};
}