nixpkgs-suyu/pkgs/tools/networking/dsniff/default.nix

90 lines
3.2 KiB
Nix
Raw Normal View History

{ gcc9Stdenv, lib, fetchFromGitLab, autoreconfHook, libpcap, db, glib, libnet, libnids, symlinkJoin, openssl
2020-08-21 14:27:42 +02:00
, rpcsvc-proto, libtirpc, libnsl
}:
# We compile with GCC 9 since GCC 10 segfaults on the code
# (see https://bugzilla.redhat.com/show_bug.cgi?id=1862809).
2018-12-03 00:59:11 +01:00
let
/*
dsniff's build system unconditionnaly wants static libraries and does not
support multi output derivations. We do some overriding to give it
satisfaction.
*/
staticdb = symlinkJoin {
inherit (db) name;
paths = with db.overrideAttrs(old: { dontDisableStatic = true; }); [ out dev ];
postBuild = ''
rm $out/lib/*.so*
'';
};
pcap = symlinkJoin {
inherit (libpcap) name;
paths = [ (libpcap.overrideAttrs(old: { dontDisableStatic = true; })) ];
2018-12-03 00:59:11 +01:00
postBuild = ''
cp -rs $out/include/pcap $out/include/net
# prevent references to libpcap
rm $out/lib/*.so*
'';
};
net = symlinkJoin {
inherit (libnet) name;
paths = [ (libnet.overrideAttrs(old: { dontDisableStatic = true; })) ];
postBuild = ''
# prevent dynamic linking, now that we have a static library
rm $out/lib/*.so*
'';
};
nids = libnids.overrideAttrs(old: {
dontDisableStatic = true;
});
ssl = symlinkJoin {
2019-07-30 03:41:32 +02:00
inherit (openssl) name;
paths = with openssl.override { static = true; }; [ out dev ];
2018-12-03 00:59:11 +01:00
};
in gcc9Stdenv.mkDerivation rec {
2018-12-03 00:59:11 +01:00
pname = "dsniff";
version = "2.4b1";
# upstream is so old that nearly every distribution packages the beta version.
# Also, upstream only serves the latest version, so we use debian's sources.
# this way we can benefit the numerous debian patches to be able to build
# dsniff with recent libraries.
src = fetchFromGitLab {
domain = "salsa.debian.org";
owner = "pkg-security-team";
repo = "dsniff";
2020-11-18 16:24:28 +01:00
rev = "debian/${version}+debian-29";
2018-12-03 00:59:11 +01:00
sha256 = "10zz9krf65jsqvlcr72ycp5cd27xwr18jkc38zqp2i4j6x0caj2g";
name = "dsniff.tar.gz";
};
2020-08-21 14:27:42 +02:00
nativeBuildInputs = [ autoreconfHook rpcsvc-proto ];
buildInputs = [ glib pcap libtirpc libnsl ];
NIX_CFLAGS_LINK = "-lglib-2.0 -lpthread -ldl -ltirpc";
NIX_CFLAGS_COMPILE = [ "-I${libtirpc.dev}/include/tirpc" ];
2018-12-03 00:59:11 +01:00
postPatch = ''
for patch in debian/patches/*.patch; do
patch < $patch
done;
'';
configureFlags = [
"--with-db=${staticdb}"
"--with-libpcap=${pcap}"
"--with-libnet=${net}"
"--with-libnids=${nids}"
"--with-openssl=${ssl}"
];
meta = with lib; {
2018-12-03 00:59:11 +01:00
description = "collection of tools for network auditing and penetration testing";
longDescription = ''
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.
'';
homepage = "https://www.monkey.org/~dugsong/dsniff/";
2018-12-03 00:59:11 +01:00
license = licenses.bsd3;
maintainers = [ maintainers.symphorien ];
# bsd and solaris should work as well
platforms = platforms.linux;
};
}