1{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkg-config, fetchpatch
2, ncurses, libpcap, libnet
3# alpha version of GTK interface
4, withGtk ? false, gtk2
5# enable remote admin interface
6, enableAdmin ? false
7}:
8
9stdenv.mkDerivation rec {
10 pname = "yersinia";
11 version = "0.8.2";
12
13 src = fetchFromGitHub {
14 owner = "tomac";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "06yfpf9iyi525rly1ychsihzvw3sas8kp0nxxr99xkwiqp5dc78b";
18 };
19
20 patches = [
21 # ncurses-6.3 support, included in next release
22 (fetchpatch {
23 name = "ncurses-6.3.patch";
24 url = "https://github.com/tomac/yersinia/commit/d91bbf6f475e7ea39f131b77ce91b2de9646d5ca.patch";
25 sha256 = "fl1pZKWA+nLtBm9+3FBFqaeuVZjszQCNkNl6Cf++BAI=";
26 })
27
28 # Pull upstream fix for -fno-common toolchain support:
29 # https://github.com/tomac/yersinia/pull/66
30 (fetchpatch {
31 name = "fno-common.patch";
32 url = "https://github.com/tomac/yersinia/commit/36247225dc7a6f38c4ba70537e20351f04762749.patch";
33 sha256 = "KHaN8gfgNROEico27gWnYiP9ZVhpWz0KjFYy2t5tPBo=";
34 })
35 ];
36
37 nativeBuildInputs = [ autoreconfHook pkg-config ];
38 buildInputs = [ libpcap libnet ncurses ]
39 ++ lib.optional withGtk gtk2;
40
41 autoreconfPhase = "./autogen.sh";
42
43 configureFlags = [
44 "--with-pcap-includes=${libpcap}/include"
45 "--with-libnet-includes=${libnet}/include"
46 ]
47 ++ lib.optional (!enableAdmin) "--disable-admin"
48 ++ lib.optional (!withGtk) "--disable-gtk";
49
50 makeFlags = [ "LDFLAGS=-lncurses" ];
51
52 meta = with lib; {
53 description = "A framework for layer 2 attacks";
54 homepage = "https://github.com/tomac/yersinia";
55 license = licenses.gpl2Plus;
56 maintainers = with maintainers; [ vdot0x23 ];
57 # INSTALL and FAQ in this package seem a little outdated
58 # so not sure, but it could work on openbsd, illumos, and freebsd
59 # if you have a machine to test with, feel free to add these
60 platforms = with platforms; linux;
61 # never built on aarch64-linux since first introduction in nixpkgs
62 broken = stdenv.isLinux && stdenv.isAarch64;
63 };
64}