about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/sniffers/kismet/default.nix
blob: 4008c5121c9e1c9d8cfab6565e9870e84e4370be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{ lib
, stdenv
, autoreconfHook
, binutils
, elfutils
, fetchurl
, glib
, libcap
, libmicrohttpd
, libnl
, libpcap
, libusb1
, libwebsockets
, lm_sensors
, networkmanager
, pcre
, pkg-config
, openssl
, protobuf
, protobufc
, python3
, sqlite
, withNetworkManager ? false
, withPython ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, withSensors ? false
, zlib
}:

stdenv.mkDerivation rec {
  pname = "kismet";
  version = "2023-07-R1";

  src = fetchurl {
    url = "https://www.kismetwireless.net/code/${pname}-${version}.tar.xz";
    hash = "sha256-8IVI4mymX6HlZ7Heu+ocpNDnIGvduWpPY5yQFxhz6Pc=";
  };

  postPatch = ''
    substituteInPlace Makefile.in \
      --replace "-m 4550" ""
    substituteInPlace configure.ac \
      --replace "pkg-config" "$PKG_CONFIG"
  '';

  postConfigure = ''
    sed -e 's/-o $(INSTUSR)//' \
        -e 's/-g $(INSTGRP)//' \
        -e 's/-g $(MANGRP)//' \
        -e 's/-g $(SUIDGROUP)//' \
        -i Makefile
  '';

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    protobuf
    protobufc
  ] ++ lib.optionals withPython [
    (python3.withPackages (ps: [
      ps.numpy
      ps.protobuf
      ps.pyserial
      ps.setuptools
      ps.websockets
    ]))
  ];

  buildInputs = [
    binutils
    elfutils
    libcap
    libmicrohttpd
    libnl
    libpcap
    openssl
    libusb1
    libwebsockets
    pcre
    protobuf
    protobufc
    sqlite
    zlib
  ] ++ lib.optionals withNetworkManager [
    networkmanager
    glib
  ] ++ lib.optionals withSensors [
    lm_sensors
  ];

  configureFlags = [
    "--disable-wifi-coconut"  # Until https://github.com/kismetwireless/kismet/issues/478
  ] ++ lib.optionals (!withNetworkManager) [
    "--disable-libnm"
  ] ++ lib.optionals (!withPython) [
    "--disable-python-tools"
  ] ++ lib.optionals (!withSensors) [
    "--disable-lmsensors"
  ];

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Wireless network sniffer";
    homepage = "https://www.kismetwireless.net/";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
  };
}