nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 libpcap,
7 pcre2,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "ngrep";
12 version = "1.48.3";
13
14 src = fetchFromGitHub {
15 owner = "jpr5";
16 repo = "ngrep";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-2fYv9iLS+YLFLMjTpi/K4BLRSLTbkLGATlToA2ivrTo=";
19 };
20
21 nativeBuildInputs = [ autoreconfHook ];
22 buildInputs = [
23 libpcap
24 pcre2
25 ];
26
27 configureFlags = [
28 "--enable-ipv6"
29 "--enable-pcre2"
30 "--disable-pcap-restart"
31 "--with-pcap-includes=${libpcap}/include"
32 ];
33
34 preConfigure = ''
35 sed -i "s|BPF=.*|BPF=${libpcap}/include/pcap/bpf.h|" configure
36 '';
37
38 meta = {
39 description = "Network packet analyzer";
40 longDescription = ''
41 ngrep strives to provide most of GNU grep's common features, applying
42 them to the network layer. ngrep is a pcap-aware tool that will allow you
43 to specify extended regular or hexadecimal expressions to match against
44 data payloads of packets. It currently recognizes IPv4/6, TCP, UDP,
45 ICMPv4/6, IGMP and Raw across Ethernet, PPP, SLIP, FDDI, Token Ring and
46 null interfaces, and understands BPF filter logic in the same fashion as
47 more common packet sniffing tools, such as tcpdump and snoop.
48 '';
49 homepage = "https://github.com/jpr5/ngrep/";
50 license = {
51 shortName = "ngrep"; # BSD-style, see README.md and LICENSE
52 url = "https://github.com/jpr5/ngrep/blob/master/LICENSE";
53 free = true;
54 redistributable = true;
55 };
56 platforms = with lib.platforms; linux ++ darwin;
57 maintainers = [ lib.maintainers.bjornfor ];
58 mainProgram = "ngrep";
59 };
60})