mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-13 01:03:25 +00:00
0278e1e297
ngrep works on macos/Darwin without problems. The official page even states that: ``` Confirmed Working Platforms Linux 2.0+ (RH6+, SuSE, TurboLinux, Debian, Gentoo, Ubuntu, Mandrake, Slackware)/x86, RedHat/alpha Cobalt, (Qube2) Linux/MIPS Solaris 2.5.1, 2.6/SPARC, Solaris 7, Solaris 8/SPARC, Solaris 9/SPARC FreeBSD 2.2.5, 3.1, 3.2, 3.4-RC, 3.4-RELEASE, 4.0, 5.0 OpenBSD 2.4 (after upgrading pcap from 0.2), 2.9, 3.0, 3.1+ NetBSD 1.5/SPARC Digital Unix V4.0D (OSF/1), Tru64 5.0, Tru64 5.1A HPUX 11 IRIX AIX 4.3.3.0/PowerPC BeOS R5 Mac OS X 10+ GNU HURD Windows 95, 98, NT, 2000, XP, 2003/x86, 7, 8, 8.1, 10 ```
55 lines
1.8 KiB
Nix
55 lines
1.8 KiB
Nix
{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, libpcap, pcre }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "ngrep";
|
|
version = "1.47";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "jpr5";
|
|
repo = "ngrep";
|
|
rev = "V${lib.replaceStrings ["."] ["_"] version}";
|
|
sha256 = "1x2fyd7wdqlj1r76ilal06cl2wmbz0ws6i3ys204sbjh1cj6dcl7";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
url = "https://patch-diff.githubusercontent.com/raw/jpr5/ngrep/pull/11.patch";
|
|
sha256 = "0k5qzvj8j3r1409qwwvzp7m3clgs2g7hs4q68bhrqbrsvvb2h5dh";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
buildInputs = [ libpcap pcre ];
|
|
|
|
configureFlags = [
|
|
"--enable-ipv6"
|
|
"--enable-pcre"
|
|
"--disable-pcap-restart"
|
|
"--with-pcap-includes=${libpcap}/include"
|
|
];
|
|
|
|
preConfigure = ''
|
|
sed -i "s|BPF=.*|BPF=${libpcap}/include/pcap/bpf.h|" configure
|
|
'';
|
|
|
|
meta = with lib; {
|
|
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.
|
|
'';
|
|
homepage = "https://github.com/jpr5/ngrep/";
|
|
# <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.
|
|
license = "ngrep"; # Some custom BSD-style, see LICENSE.txt
|
|
platforms = with platforms; linux ++ darwin;
|
|
maintainers = [ maintainers.bjornfor ];
|
|
};
|
|
}
|