repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
ad.nixNix87 lines3.4 KiBraw download
# modules/features/pentest/ad.nix — Active Directory, which is most of CPTS.
#
# impacket and its aliases come from _impacket.nix, shared with python.nix, so
# both categories install the identical derivation rather than colliding.
{ lib, ... }:
(import ./_sets.nix { inherit lib; }) {
  name = "ad";
  description = "Active Directory: kerberos, LDAP, SMB, ADCS, relaying";

  packages = pkgs:
    let
      extra = import ./_pkgs/default.nix { inherit lib pkgs; };
    in
    (import ./_impacket.nix { inherit lib pkgs; }).both
    ++ [
      # krbrelayx: `printerbug` coerces authentication out of a host over
      # MS-RPRN — the printer bug — and is the Linux counterpart to
      # SpoolSample.exe. Also krbrelayx, addspn, dnstool. Not in nixpkgs.
      extra.krbrelayx
      # linWinPwn: drives the tools in this category in sequence. Its wrapper
      # carries them all on PATH, so it works without a Kali-shaped filesystem.
      extra.linwinpwn
      extra.targetedKerberoast
      extra.passthecert
      extra.adfspoof
      extra.bloodhound-ce-python
    ]
    ++ (with pkgs; [
      netexec # `nxc`, the maintained CrackMapExec
      certipy # ADCS
      # Legacy Python, CE Python above, and Rust CE: newer writeups combine
      # the CE collectors because their enumeration coverage differs.
      bloodhound-py # `bloodhound-python` 1.9 -> LEGACY (pre-CE) JSON
      rusthound-ce # `rusthound-ce` -> BloodHound CE JSON, and much faster
      kerbrute
      responder
      mitm6
      coercer
      donpapi
      adidnsdump
      ldapdomaindump
      smbmap
      evil-winrm
      evil-winrm-py # TombWatcher, Redelegate; also supports Kerberos
      ansible # ansible-vault (Authority), clients only
      krb5
      openldap
      samba
    ])
    ++ (with pkgs.python3Packages; [
      pypykatz
      bloodyad # `bloodyAD`
      lsassy
      dploot
      masky
      pywerview
    ]);
  # pywerview is installed but kept OUT of the shared python env: it is the
  # only tool pulling ldap3-bleeding-edge while everything else pulls
  # ldap3-2.9.1, and buildEnv cannot hold both (spec C2's documented fallback).
  # Its own wrapper carries the bleeding-edge copy, so the command works.
  # PowerView proper is staged at $PAYLOADS/scripts/ad/PowerView.ps1.

  expectedBins = [
    "nxc" "certipy" "bloodhound-python" "kerbrute" "responder" "mitm6"
    "coercer" "donpapi" "adidnsdump" "ldapdomaindump" "smbmap" "evil-winrm"
    "pypykatz" "bloodyAD" "lsassy" "dploot" "masky" "pywerview"
    # From _impacket.nix: proves the shared helper composes with this category.
    "secretsdump" "ntlmrelayx" "GetUserSPNs" "secretsdump.py"
    "rusthound-ce"
    # From _pkgs/: the printer-bug family, and the automation front-end.
    "printerbug" "krbrelayx" "addspn" "dnstool" "linWinPwn"
    "targetedKerberoast" "targetedKerberoast.py" "passthecert" "passthecert.py"
    "ADFSpoof" "ADFSpoof.py" "netexec" "evil-winrm-py" "ansible-vault"
    "bloodhound-ce-python"
  ];

  # The python-heavy ones, actually executed: these are the tools that resolve
  # on PATH and then fail at import time.
  smokeBins = [
    "nxc" "certipy" "bloodhound-python" "pypykatz" "bloodyAD" "lsassy"
    "dploot" "masky" "pywerview" "donpapi" "coercer" "adidnsdump"
    "ldapdomaindump" "smbmap" "printerbug" "krbrelayx" "secretsdump"
    "targetedKerberoast" "passthecert" "ADFSpoof" "evil-winrm-py" "ansible-vault"
    "bloodhound-ce-python"
  ];
}