repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
radio.nixNix71 lines2.9 KiBraw download
# modules/features/pentest/radio.nix — everything that is a radio but not wifi:
# software-defined radio, Bluetooth, and RFID/NFC.
# Off by default. `daemon.pentest.radio.enable = true;`
#
# Split from wireless.nix on purpose. That category is a wifi card in monitor
# mode; this one is a dongle on the USB bus — HackRF, RTL-SDR, Ubertooth,
# Proxmark3 — and it pulls in Qt GUIs and a different set of udev rules. If
# you have no SDR hardware, leaving this off saves a large closure.
#
# gnuradio and sdrangel are deliberately NOT here: each is a very large
# closure, and `gqrx` already brings a gnuradio runtime for the common case of
# "look at a spectrum and demodulate it". Add them to this list if you start
# building flowgraphs.
#
# Nearly all of it needs device access. The udev rules come from the packages
# themselves via services.udev.packages below, so an unprivileged user can
# talk to the hardware without sudo.
{ lib, ... }:
(import ./_sets.nix { inherit lib; }) {
  name = "radio";
  description = "SDR, Bluetooth and RFID/NFC: hackrf, rtl-sdr, ubertooth, proxmark3";
  default = false;

  packages = pkgs: with pkgs; [
    # Software-defined radio
    hackrf # hackrf_info, hackrf_sweep, hackrf_transfer
    rtl-sdr # rtl_sdr, rtl_fm, rtl_power, rtl_test
    rtl_433 # decode the 433/868/915 MHz device zoo
    gqrx # spectrum + demodulation, the one you actually open
    inspectrum # offline analysis of a capture
    urh # Universal Radio Hacker: urh, urh_cli
    multimon-ng # POCSAG, FLEX, DTMF and friends

    # Bluetooth
    ubertooth # ubertooth-btle, ubertooth-rx, ubertooth-specan
    btlejack # BLE connection hijacking
    bluez-tools # bt-adapter, bt-device, bt-network, bt-obex
    spooftooph # clone a device's address and name

    # RFID / NFC
    proxmark3 # `pm3` — the 125 kHz / 13.56 MHz workhorse
    libnfc # nfc-list, nfc-poll, nfc-mfclassic, …
    mfoc # MIFARE Classic key recovery (nested attack)
    mfcuk # the darkside attack, for when mfoc has no known key
  ];

  expectedBins = [
    "hackrf_info" "hackrf_sweep" "hackrf_transfer"
    "rtl_sdr" "rtl_fm" "rtl_power" "rtl_test" "rtl_433"
    "gqrx" "inspectrum" "urh" "urh_cli" "multimon-ng"
    "ubertooth-btle" "ubertooth-rx" "ubertooth-specan" "ubertooth-util"
    "btlejack" "bt-adapter" "bt-device" "spooftooph"
    "pm3" "proxmark3" "nfc-list" "nfc-poll" "nfc-mfclassic" "mfoc" "mfcuk"
  ];

  extraConfig = { pkgs, lib, ... }: {
    # Without these, every one of the above needs root to open its USB device.
    # Each package ships the rules for its own hardware.
    services.udev.packages = with pkgs; [
      hackrf
      rtl-sdr
      ubertooth
      proxmark3
      libnfc
    ];

    # Bluetooth attacks need the stack up, and bluez's own tools (bluetoothctl,
    # hcitool) alongside bluez-tools'. mkDefault: the host may already set this.
    hardware.bluetooth.enable = lib.mkDefault true;
  };
}