summary refs log tree commit diff
path: root/pkgs/tools/networking/hping
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2012-12-12 06:27:01 +0100
committeraszlig <aszlig@redmoonstudios.org>2012-12-12 12:36:17 +0100
commit7cd641a4e77b4901be00ab75d47ecb732c216871 (patch)
tree6878b90ab851253a3027d898134dbd26afa68f36 /pkgs/tools/networking/hping
parentc6dd35c2ac1dd0de93ad6a07c363763babc8caa1 (diff)
downloadnixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar.gz
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar.bz2
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar.lz
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar.xz
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.tar.zst
nixpkgs-7cd641a4e77b4901be00ab75d47ecb732c216871.zip
hping: New package, version 20051105.
Quite a lot of patching involved here, but the upstream package is no longer
maintained anymore. Nevertheless the tool is still useful in some environments.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/tools/networking/hping')
-rw-r--r--pkgs/tools/networking/hping/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/tools/networking/hping/default.nix b/pkgs/tools/networking/hping/default.nix
new file mode 100644
index 00000000000..aa2574fbc1d
--- /dev/null
+++ b/pkgs/tools/networking/hping/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, libpcap, tcl }:
+
+stdenv.mkDerivation rec {
+  name = "hping-${version}";
+  version = "20051105";
+
+  src = fetchurl {
+    url = "http://www.hping.org/hping3-${version}.tar.gz";
+    sha256 = "1s5f9xd1msx05ibhwaw37jmc7l9fahcxxslqz8a83p0i5ak739pm";
+  };
+
+  buildInputs = [ libpcap tcl ];
+
+  configurePhase = ''
+    MANPATH="$out/share/man" ./configure
+    sed -i -r -e 's|/usr(/s?bin)|'"$out"'\1|g' Makefile
+  '';
+
+  TCLSH = "${tcl}/bin/tclsh";
+
+  prePatch = ''
+    sed -i -e '/#if.*defined(__i386__)/a \
+      || defined(__x86_64__) \\
+    ' bytesex.h
+
+    sed -i -e 's|#include.*net/bpf.h|#include <pcap/bpf.h>|' \
+      libpcap_stuff.c script.c
+
+    sed -i -r -e 's|"(/usr/(local/)?)?bin/"|"${tcl}/bin"|g' \
+              -e 's!/usr/(local/)?(lib|include)!${tcl}/\2!g' \
+              configure
+  '';
+
+  preInstall = ''
+    mkdir -vp "$out/sbin" "$out/share/man/man8"
+  '';
+
+  postInstall = ''
+    ln -vs hping3.8.gz "$out/share/man/man8/hping.8.gz"
+    ln -vs hping3.8.gz "$out/share/man/man8/hping2.8.gz"
+  '';
+
+  meta = {
+    description = "A command-line oriented TCP/IP packet assembler/analyzer";
+    homepage = "http://www.hping.org/";
+    license = stdenv.lib.licenses.gpl2;
+  };
+}