audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / ds / dsniff / package.nix
blob088405f92c4799553e6e0bdfab9de4f1a3a35a39
2   stdenv,
3   lib,
4   fetchFromGitLab,
5   autoreconfHook,
6   libpcap,
7   db,
8   glib,
9   libnet,
10   libnids,
11   symlinkJoin,
12   openssl,
13   rpcsvc-proto,
14   libtirpc,
15   libnsl,
16   libnl,
19 let
20   /*
21     dsniff's build system unconditionnaly wants static libraries and does not
22     support multi output derivations. We do some overriding to give it
23     satisfaction.
24   */
25   staticdb = symlinkJoin {
26     inherit (db) name;
27     paths = with db.overrideAttrs { dontDisableStatic = true; }; [
28       out
29       dev
30     ];
31     postBuild = ''
32       rm $out/lib/*.so*
33     '';
34   };
35   pcap = symlinkJoin {
36     inherit (libpcap) name;
37     paths = [ (libpcap.overrideAttrs { dontDisableStatic = true; }) ];
38     postBuild = ''
39       cp -rs $out/include/pcap $out/include/net
40       # prevent references to libpcap
41       rm $out/lib/*.so*
42     '';
43   };
44   net = symlinkJoin {
45     inherit (libnet) name;
46     paths = [ (libnet.overrideAttrs { dontDisableStatic = true; }) ];
47     postBuild = ''
48       # prevent dynamic linking, now that we have a static library
49       rm $out/lib/*.so*
50     '';
51   };
52   nids = libnids.overrideAttrs {
53     dontDisableStatic = true;
54   };
55   ssl = symlinkJoin {
56     inherit (openssl) name;
57     paths = with openssl.override { static = true; }; [
58       out
59       dev
60     ];
61   };
63 stdenv.mkDerivation rec {
64   pname = "dsniff";
65   version = "2.4b1";
66   # upstream is so old that nearly every distribution packages the beta version.
67   # Also, upstream only serves the latest version, so we use debian's sources.
68   # this way we can benefit the numerous debian patches to be able to build
69   # dsniff with recent libraries.
70   src = fetchFromGitLab {
71     domain = "salsa.debian.org";
72     owner = "pkg-security-team";
73     repo = "dsniff";
74     rev = "debian/${version}+debian-34";
75     sha256 = "sha256-CY0+G09KZXtAwKuaYh5/qcmZjuNhdGis3zCG14hWtqw=";
76     name = "dsniff.tar.gz";
77   };
79   nativeBuildInputs = [
80     autoreconfHook
81     rpcsvc-proto
82   ];
83   buildInputs = [
84     glib
85     pcap
86     libtirpc
87     libnsl
88     libnl
89   ];
90   NIX_CFLAGS_LINK = "-lglib-2.0 -lpthread -ltirpc -lnl-3 -lnl-genl-3";
91   env.NIX_CFLAGS_COMPILE = toString [ "-I${libtirpc.dev}/include/tirpc" ];
92   postPatch = ''
93     for patch in debian/patches/*.patch; do
94       patch < $patch
95     done;
96   '';
97   configureFlags = [
98     "--with-db=${staticdb}"
99     "--with-libpcap=${pcap}"
100     "--with-libnet=${net}"
101     "--with-libnids=${nids}"
102     "--with-openssl=${ssl}"
103   ];
105   meta = with lib; {
106     description = "collection of tools for network auditing and penetration testing";
107     longDescription = ''
108       dsniff, filesnarf, mailsnarf, msgsnarf, urlsnarf, and webspy passively monitor a network for interesting data (passwords, e-mail, files, etc.). arpspoof, dnsspoof, and macof facilitate the interception of network traffic normally unavailable to an attacker (e.g, due to layer-2 switching). sshmitm and webmitm implement active monkey-in-the-middle attacks against redirected SSH and HTTPS sessions by exploiting weak bindings in ad-hoc PKI.
109     '';
110     homepage = "https://www.monkey.org/~dugsong/dsniff/";
111     license = licenses.bsd3;
112     maintainers = [ maintainers.symphorien ];
113     # bsd and solaris should work as well
114     platforms = platforms.linux;
115   };