2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, libpcap, withTcl ? true, tcl }:
|
2012-12-12 06:27:01 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "hping";
|
2020-09-06 21:10:45 +02:00
|
|
|
version = "2014-12-26";
|
2012-12-12 06:27:01 +01:00
|
|
|
|
2020-09-06 21:10:45 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "antirez";
|
|
|
|
repo = pname;
|
|
|
|
rev = "3547c7691742c6eaa31f8402e0ccbb81387c1b99"; # there are no tags/releases
|
|
|
|
sha256 = "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb";
|
2012-12-12 06:27:01 +01:00
|
|
|
};
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
buildInputs = [ libpcap ] ++ lib.optional withTcl tcl;
|
2012-12-12 06:27:01 +01:00
|
|
|
|
2020-09-06 21:10:45 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile.in --replace "gcc" "$CC"
|
|
|
|
substituteInPlace version.c --replace "RELEASE_DATE" "\"$version\""
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString stdenv.isLinux ''
|
2020-09-06 21:10:45 +02:00
|
|
|
sed -i -e 's|#include <net/bpf.h>|#include <pcap/bpf.h>|' \
|
2012-12-12 06:27:01 +01:00
|
|
|
libpcap_stuff.c script.c
|
|
|
|
'';
|
|
|
|
|
2020-09-06 21:10:45 +02:00
|
|
|
configureFlags = [ (if withTcl then "TCLSH=${tcl}/bin/tclsh" else "--no-tcl") ];
|
2012-12-12 06:27:01 +01:00
|
|
|
|
2020-09-06 21:10:45 +02:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 hping3 -t $out/sbin
|
|
|
|
ln -s $out/sbin/hping3 $out/sbin/hping
|
|
|
|
ln -s $out/sbin/hping3 $out/sbin/hping2
|
|
|
|
install -Dm644 docs/hping3.8 -t $out/share/man/man8
|
|
|
|
ln -s hping3.8.gz $out/share/man/man8/hping.8.gz
|
|
|
|
ln -s hping3.8.gz $out/share/man/man8/hping2.8.gz
|
2012-12-12 06:27:01 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2012-12-12 06:27:01 +01:00
|
|
|
description = "A command-line oriented TCP/IP packet assembler/analyzer";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.hping.org/";
|
2020-09-06 21:10:45 +02:00
|
|
|
license = licenses.gpl2Only;
|
|
|
|
platforms = platforms.unix;
|
2012-12-12 06:27:01 +01:00
|
|
|
};
|
|
|
|
}
|