repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
wireless.nixNix91 lines3.4 KiBraw download
# modules/features/pentest/wireless.nix — 802.11 and on-the-wire capture.
# Off by default. `daemon.pentest.wireless.enable = true;`
#
# Bluetooth, RFID/NFC and software-defined radio are NOT here — they are their
# own category (radio.nix), because this one is about a wifi adapter in monitor
# mode and that one is about an SDR dongle or a Proxmark. Enabling one should
# not drag in the other's drivers and GUIs.
#
# Most of this needs a card that supports monitor mode and injection, and all
# of it needs root. `airmon-ng start wlan1` will fight NetworkManager for the
# interface; `airmon-ng check kill` is the usual answer.
{ lib, ... }:
(import ./_sets.nix { inherit lib; }) {
  name = "wireless";
  description = "wifi attacks, rogue APs and packet capture";
  default = false;

  packages = pkgs: with pkgs; [
    # The classics
    aircrack-ng
    hcxtools
    hcxdumptool # PMKID capture, the modern first move
    bettercap

    # Drivers of the above
    wifite2 # `wifite`: wraps aircrack/reaver/bully/hcx into one attack loop
    airgeddon # the menu-driven equivalent, when you want to see each step

    # WPS
    reaverwps-t6x # `reaver` and `wash`, the t6x fork (the maintained one)
    bully
    pixiewps # offline WPS pin recovery

    # WPA handshake and enterprise
    cowpatty # cowpatty, genpmk
    asleap # LEAP/PPTP MS-CHAPv2

    # Deauth, beacon flood, rogue AP
    mdk4
    hostapd # the honest way to stand up a rogue AP

    # Interface wrangling
    iw
    wirelesstools # iwconfig, iwlist — older tools some scripts still call
    macchanger
    horst # a quick 802.11 top(1)

    # Capture
    kismet
    termshark
    tcpdump
    # The full wireshark, not wireshark-cli: gui.nix installs this same
    # attribute, and two DIFFERENT wireshark builds both ship androiddump,
    # dumpcap and friends — a profile collision when both categories are on.
    # Identical paths merge fine. It provides `tshark` for headless use.
    wireshark
  ];

  expectedBins = [
    "aircrack-ng" "airmon-ng" "airodump-ng" "aireplay-ng"
    "hcxpcapngtool" "hcxhashtool" "hcxdumptool" "bettercap"
    "wifite" "airgeddon"
    "reaver" "wash" "bully" "pixiewps"
    "cowpatty" "genpmk" "asleap"
    "mdk4" "hostapd"
    "iw" "iwconfig" "iwlist" "macchanger" "horst"
    "kismet" "termshark" "tcpdump" "tshark"
  ];

  extraConfig = { pkgs, lib, ... }: {
    # As in gui.nix: the group and the dumpcap capability wrapper, without
    # which capture needs full root.
    #
    # `package` is set at a WEAKER priority than gui.nix's mkDefault (1000) on
    # purpose. Two mkDefaults are not interchangeable here: `types.package`
    # merges with mergeEqualOption, which compares definitions with `==`, and
    # `==` on two derivations compares their `override`/`overrideAttrs`
    # functions and is therefore false even for the same store path. So two
    # equal-priority definitions are a hard "defined multiple times" error the
    # moment `gui` and `wireless` are both on. The ladder makes gui win and
    # leaves this one effective when gui is off.
    #
    # It must be the full wireshark either way: this category installs that
    # attribute in `packages`, and the module's own default (wireshark-cli)
    # would be a SECOND package owning bin/tshark and bin/dumpcap.
    programs.wireshark = {
      enable = lib.mkDefault true; # bool merges when the values are equal
      package = lib.mkOverride 1500 pkgs.wireshark;
    };
  };
}