2018-03-22 16:56:00 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, libpcap, pcre }:
|
2014-01-03 15:41:18 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "ngrep";
|
2018-01-28 17:16:56 +01:00
|
|
|
version = "1.47";
|
2014-01-03 15:41:18 +01:00
|
|
|
|
2018-01-28 17:16:56 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jpr5";
|
|
|
|
repo = "ngrep";
|
|
|
|
rev = "V${lib.replaceStrings ["."] ["_"] version}";
|
|
|
|
sha256 = "1x2fyd7wdqlj1r76ilal06cl2wmbz0ws6i3ys204sbjh1cj6dcl7";
|
2014-01-03 15:41:18 +01:00
|
|
|
};
|
|
|
|
|
2017-01-22 14:09:50 +01:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
2018-01-28 17:16:56 +01:00
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/jpr5/ngrep/pull/11.patch";
|
|
|
|
sha256 = "0k5qzvj8j3r1409qwwvzp7m3clgs2g7hs4q68bhrqbrsvvb2h5dh";
|
2017-01-22 14:09:50 +01:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-03-22 16:56:00 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2018-01-28 17:16:56 +01:00
|
|
|
buildInputs = [ libpcap pcre ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-ipv6"
|
|
|
|
"--enable-pcre"
|
|
|
|
"--disable-pcap-restart"
|
|
|
|
"--with-pcap-includes=${libpcap}/include"
|
|
|
|
];
|
2014-01-03 15:41:18 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i "s|BPF=.*|BPF=${libpcap}/include/pcap/bpf.h|" configure
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2014-01-03 15:41:18 +01:00
|
|
|
description = "Network packet analyzer";
|
|
|
|
longDescription = ''
|
|
|
|
ngrep strives to provide most of GNU grep's common features, applying
|
|
|
|
them to the network layer. ngrep is a pcap-aware tool that will allow you
|
|
|
|
to specify extended regular or hexadecimal expressions to match against
|
|
|
|
data payloads of packets. It currently recognizes IPv4/6, TCP, UDP,
|
|
|
|
ICMPv4/6, IGMP and Raw across Ethernet, PPP, SLIP, FDDI, Token Ring and
|
|
|
|
null interfaces, and understands BPF filter logic in the same fashion as
|
|
|
|
more common packet sniffing tools, such as tcpdump and snoop.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/jpr5/ngrep/";
|
2014-01-03 15:41:18 +01:00
|
|
|
# <ngrep>/doc/README.txt says that ngrep itself is licensed under a
|
|
|
|
# 'BSD-like' license but that the 'regex' library (in the ngrep tarball) is
|
|
|
|
# GPLv2.
|
2014-06-19 06:19:00 +02:00
|
|
|
license = "ngrep"; # Some custom BSD-style, see LICENSE.txt
|
2014-01-03 15:41:18 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.bjornfor ];
|
|
|
|
};
|
|
|
|
}
|