2021-01-12 15:56:36 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, bison
|
|
|
|
, flex
|
|
|
|
, geoip
|
|
|
|
, geolite-legacy
|
|
|
|
, libcli
|
|
|
|
, libnet
|
|
|
|
, libnetfilter_conntrack
|
|
|
|
, libnl
|
|
|
|
, libpcap
|
|
|
|
, libsodium
|
|
|
|
, liburcu
|
|
|
|
, ncurses
|
|
|
|
, pkg-config
|
|
|
|
, zlib
|
|
|
|
}:
|
2015-01-15 21:03:32 +01:00
|
|
|
|
2016-01-24 20:31:44 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-05-12 15:29:39 +02:00
|
|
|
pname = "netsniff-ng";
|
2021-01-12 15:56:36 +01:00
|
|
|
version = "0.6.8";
|
2015-01-15 21:03:32 +01:00
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
src = fetchFromGitHub {
|
2019-05-12 15:29:39 +02:00
|
|
|
repo = pname;
|
|
|
|
owner = pname;
|
2015-11-09 17:27:11 +01:00
|
|
|
rev = "v${version}";
|
2021-01-12 15:56:36 +01:00
|
|
|
sha256 = "10ih8amaqspy0zwg7hqvypa1v7ixpjl0n608cyfgyfzffp73lbqf";
|
2015-01-15 21:03:32 +01:00
|
|
|
};
|
|
|
|
|
2021-01-12 15:56:36 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bison
|
|
|
|
flex
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2019-05-12 15:29:39 +02:00
|
|
|
buildInputs = [
|
2021-01-12 15:56:36 +01:00
|
|
|
geoip
|
|
|
|
geolite-legacy
|
|
|
|
libcli
|
|
|
|
libnet
|
|
|
|
libnl
|
|
|
|
libnetfilter_conntrack
|
|
|
|
libpcap
|
|
|
|
libsodium
|
|
|
|
liburcu
|
|
|
|
ncurses
|
|
|
|
zlib
|
2019-05-12 15:29:39 +02:00
|
|
|
];
|
2015-01-17 16:46:23 +01:00
|
|
|
|
|
|
|
# ./configure is not autoGNU but some home-brewn magic
|
|
|
|
configurePhase = ''
|
|
|
|
patchShebangs configure
|
2015-03-06 17:41:59 +01:00
|
|
|
substituteInPlace configure --replace "which" "command -v"
|
2015-10-13 22:38:36 +02:00
|
|
|
NACL_INC_DIR=${libsodium.dev}/include/sodium NACL_LIB=sodium ./configure
|
2015-01-17 16:46:23 +01:00
|
|
|
'';
|
2015-01-15 21:03:32 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2015-03-31 16:26:47 +02:00
|
|
|
# All files installed to /etc are just static data that can go in the store
|
2015-11-26 18:44:44 +01:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "ETCDIR=$(out)/etc" ];
|
2015-01-15 21:03:32 +01:00
|
|
|
|
2015-03-31 16:26:47 +02:00
|
|
|
postInstall = ''
|
2018-01-15 05:19:49 +01:00
|
|
|
# trafgen and bpfc can call out to cpp to process config files.
|
|
|
|
wrapProgram "$out/sbin/trafgen" --prefix PATH ":" "${stdenv.cc}/bin"
|
|
|
|
wrapProgram "$out/sbin/bpfc" --prefix PATH ":" "${stdenv.cc}/bin"
|
|
|
|
|
2021-01-12 15:56:36 +01:00
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIP.dat $out/etc/netsniff-ng/country4.dat
|
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIPv6.dat $out/etc/netsniff-ng/country6.dat
|
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIPCity.dat $out/etc/netsniff-ng/city4.dat
|
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIPCityv6.dat $out/etc/netsniff-ng/city6.dat
|
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIPASNum.dat $out/etc/netsniff-ng/asname4.dat
|
|
|
|
ln -sv ${geolite-legacy}/share/GeoIP/GeoIPASNumv6.dat $out/etc/netsniff-ng/asname6.dat
|
2015-03-31 16:26:47 +02:00
|
|
|
rm -v $out/etc/netsniff-ng/geoip.conf # updating databases after installation is impossible
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-01-15 21:03:32 +01:00
|
|
|
description = "Swiss army knife for daily Linux network plumbing";
|
|
|
|
longDescription = ''
|
|
|
|
netsniff-ng is a free Linux networking toolkit. Its gain of performance
|
|
|
|
is reached by zero-copy mechanisms, so that on packet reception and
|
|
|
|
transmission the kernel does not need to copy packets from kernel space
|
|
|
|
to user space and vice versa. The toolkit can be used for network
|
|
|
|
development and analysis, debugging, auditing or network reconnaissance.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://netsniff-ng.org/";
|
2021-01-12 15:56:36 +01:00
|
|
|
license = with licenses; [ gpl2Only ];
|
2015-11-17 21:29:29 +01:00
|
|
|
platforms = platforms.linux;
|
2015-01-15 21:03:32 +01:00
|
|
|
};
|
|
|
|
}
|