2015-03-31 16:26:47 +02:00
|
|
|
{ stdenv, fetchFromGitHub, bison, flex, geoip, geolite-legacy, libcli, libnet
|
2015-01-17 16:46:23 +01:00
|
|
|
, libnetfilter_conntrack, libnl, libpcap, libsodium, liburcu, ncurses, perl
|
2015-03-06 17:41:59 +01:00
|
|
|
, pkgconfig, zlib }:
|
2015-01-15 21:03:32 +01:00
|
|
|
|
2015-08-20 02:26:31 +02:00
|
|
|
let version = "0.5.9-85-g71c28ef"; in
|
2015-04-14 13:44:07 +02:00
|
|
|
stdenv.mkDerivation {
|
2015-01-15 21:03:32 +01:00
|
|
|
name = "netsniff-ng-${version}";
|
|
|
|
|
2015-04-14 13:44:07 +02:00
|
|
|
# Upstream recommends and supports git
|
|
|
|
src = fetchFromGitHub rec {
|
2015-01-15 21:03:32 +01:00
|
|
|
repo = "netsniff-ng";
|
|
|
|
owner = repo;
|
2015-08-20 02:26:31 +02:00
|
|
|
rev = "71c28eff00a8a8896c45fa20330b623d265ae5c7";
|
|
|
|
sha256 = "1d0k7dydy57fn2qx5mwwx5wplbgm90y9chc5q15m8phsh0nm13qi";
|
2015-01-15 21:03:32 +01:00
|
|
|
};
|
|
|
|
|
2015-03-31 16:26:47 +02:00
|
|
|
buildInputs = [ bison flex geoip geolite-legacy libcli libnet libnl
|
|
|
|
libnetfilter_conntrack libpcap libsodium liburcu ncurses perl
|
|
|
|
pkgconfig zlib ];
|
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-01-17 16:46:23 +01:00
|
|
|
NACL_INC_DIR=${libsodium}/include/sodium NACL_LIB=sodium ./configure
|
|
|
|
'';
|
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-01-15 21:03:32 +01:00
|
|
|
makeFlags = "PREFIX=$(out) ETCDIR=$(out)/etc";
|
|
|
|
|
2015-03-31 16:26:47 +02:00
|
|
|
postInstall = ''
|
|
|
|
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 04:05:00 +02: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 16:26:47 +02: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 21:03:32 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-04-14 13:44:07 +02:00
|
|
|
inherit version;
|
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.
|
|
|
|
'';
|
|
|
|
homepage = http://netsniff-ng.org/;
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.gpl2;
|
2015-01-15 21:03:32 +01:00
|
|
|
platforms = with platforms; linux;
|
|
|
|
maintainers = with maintainers; [ nckx ];
|
|
|
|
};
|
|
|
|
}
|