2018-01-15 04:19:49 +00:00
|
|
|
{ stdenv, fetchFromGitHub, makeWrapper, bison, flex, geoip, geolite-legacy
|
|
|
|
, libcli, libnet, libnetfilter_conntrack, libnl, libpcap, libsodium
|
|
|
|
, liburcu, ncurses, perl, pkgconfig, zlib }:
|
2015-01-15 20:03:32 +00:00
|
|
|
|
2016-01-24 19:31:44 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2015-01-15 20:03:32 +00:00
|
|
|
name = "netsniff-ng-${version}";
|
2018-01-15 04:19:49 +00:00
|
|
|
version = "0.6.3";
|
2015-01-15 20:03:32 +00:00
|
|
|
|
2015-04-14 12:44:07 +01:00
|
|
|
# Upstream recommends and supports git
|
|
|
|
src = fetchFromGitHub rec {
|
2015-01-15 20:03:32 +00:00
|
|
|
repo = "netsniff-ng";
|
|
|
|
owner = repo;
|
2015-11-09 16:27:11 +00:00
|
|
|
rev = "v${version}";
|
2018-01-15 04:19:49 +00:00
|
|
|
sha256 = "0g3105c5ha897bpwsnrp72gx4n61gspxmld594i37g8k7vwzny4l";
|
2015-01-15 20:03:32 +00:00
|
|
|
};
|
|
|
|
|
2017-11-09 00:31:08 +00:00
|
|
|
patches = [ ./glibc-2.26.patch ];
|
|
|
|
|
2015-03-31 15:26:47 +01:00
|
|
|
buildInputs = [ bison flex geoip geolite-legacy libcli libnet libnl
|
|
|
|
libnetfilter_conntrack libpcap libsodium liburcu ncurses perl
|
2018-01-15 04:19:49 +00:00
|
|
|
pkgconfig zlib makeWrapper ];
|
2015-01-17 15:46:23 +00:00
|
|
|
|
|
|
|
# ./configure is not autoGNU but some home-brewn magic
|
|
|
|
configurePhase = ''
|
|
|
|
patchShebangs configure
|
2015-03-06 16:41:59 +00:00
|
|
|
substituteInPlace configure --replace "which" "command -v"
|
2015-10-13 21:38:36 +01:00
|
|
|
NACL_INC_DIR=${libsodium.dev}/include/sodium NACL_LIB=sodium ./configure
|
2015-01-17 15:46:23 +00:00
|
|
|
'';
|
2015-01-15 20:03:32 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2015-03-31 15:26:47 +01:00
|
|
|
# All files installed to /etc are just static data that can go in the store
|
2015-11-26 17:44:44 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "ETCDIR=$(out)/etc" ];
|
2015-01-15 20:03:32 +00:00
|
|
|
|
2015-03-31 15:26:47 +01:00
|
|
|
postInstall = ''
|
2018-01-15 04:19:49 +00: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"
|
|
|
|
|
2015-03-31 15:26:47 +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
|
2015-07-23 03:05:00 +01:00
|
|
|
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
|
2015-03-31 15:26:47 +01:00
|
|
|
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
|
|
|
|
rm -v $out/etc/netsniff-ng/geoip.conf # updating databases after installation is impossible
|
|
|
|
'';
|
|
|
|
|
2015-01-15 20:03:32 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
homepage = http://netsniff-ng.org/;
|
2015-05-28 18:20:29 +01:00
|
|
|
license = licenses.gpl2;
|
2015-11-17 20:29:29 +00:00
|
|
|
platforms = platforms.linux;
|
2015-01-15 20:03:32 +00:00
|
|
|
maintainers = with maintainers; [ nckx ];
|
|
|
|
};
|
|
|
|
}
|