repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
pivot.nixNix55 lines1.8 KiBraw download
# modules/features/pentest/pivot.nix — getting onto the next subnet.
#
# ligolo-ng is the one to reach for first: it gives a real TUN interface, so
# every tool works unmodified instead of being wrapped in proxychains.
# `ligolo-proxy` runs here, `ligolo-agent` goes on the target ($PAYLOADS has it
# built for Windows, Linux and macOS — see payloads.nix).
{ lib, ... }:
(import ./_sets.nix { inherit lib; }) {
  name = "pivot";
  description = "tunnelling, port forwarding and proxying";

  packages = pkgs: with pkgs; [
    ligolo-ng # ligolo-proxy, ligolo-agent
    chisel
    socat
    # Must be `proxychains`, matching programs.proxychains.package's default:
    # pkgs.proxychains and pkgs.proxychains-ng BOTH ship bin/proxychains4, and
    # two different paths owning one name is a profile collision. Listed here
    # as well as enabled below so the category check can see the binary.
    proxychains
    sshuttle
    gost
    frp # frpc, frps
    iodine
    pingtunnel
    stunnel
    wireguard-tools # wg
    openvpn
  ];

  expectedBins = [
    "ligolo-proxy" "ligolo-agent" "chisel" "socat" "sshuttle"
    "gost" "frpc" "frps" "iodine" "stunnel" "wg" "openvpn"
    "proxychains4" # from programs.proxychains below
  ];

  extraConfig = { ... }: {
    # /etc is read-only on NixOS, so the Kali habit of editing
    # /etc/proxychains.conf by hand does not work. This option is what makes
    # proxychains usable at all: it generates the file from Nix.
    programs.proxychains = {
      enable = true;
      proxyDNS = true;
      quietMode = false;
      # ligolo-ng needs no proxy at all; this default is for the chisel/ssh -D
      # case, where 1080 is the conventional local SOCKS port.
      proxies.socks = {
        enable = true;
        type = "socks5";
        host = "127.0.0.1";
        port = 1080;
      };
    };
  };
}