[PATCH] gnu: Add hping.

DoneSubmitted by Marius Bakke.
4 participants
  • Jakub Kądziołka
  • Leo Famulari
  • Marius Bakke
  • Tobias Geerinckx-Rice
Marius Bakke wrote on 24 Oct 2017 08:06
(address . guix-patches@gnu.org)(name . Marius Bakke)(address . mbakke@fastmail.com)
* gnu/packages/networking.scm (hping): New public variable.--- gnu/packages/networking.scm | 67 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
Toggle diff (101 lines)diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scmindex a6c104297..4c1771459 100644--- a/gnu/packages/networking.scm+++ b/gnu/packages/networking.scm@@ -18,6 +18,7 @@ ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com> ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com> ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>+;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; ;;; This file is part of GNU Guix. ;;;@@ -38,6 +39,7 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download)+ #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) #:use-module (guix build-system gnu)@@ -75,6 +77,7 @@ #:use-module (gnu packages qt) #:use-module (gnu packages readline) #:use-module (gnu packages ssh)+ #:use-module (gnu packages tcl) #:use-module (gnu packages textutils) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind)@@ -563,6 +566,70 @@ send out a ping packet and move on to the next target in a round-robin fashion.") (license license:expat))) +(define-public hping+ (let ((commit "3547c7691742c6eaa31f8402e0ccbb81387c1b99")+ (revision "0"))+ (package+ (name "hping")+ (version (string-append "3.0.0-" revision "-" (string-take commit 7)))+ (source (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/antirez/hping")+ (commit commit)))+ (file-name (string-append name "-" version "-checkout"))+ (sha256+ (base32+ "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb"))))+ (build-system gnu-build-system)+ (arguments+ `(#:phases+ (modify-phases %standard-phases+ (add-before 'configure 'prepare-build+ (lambda* (#:key inputs #:allow-other-keys)+ (let ((tcl (assoc-ref inputs "tcl")))+ ;; Search for bpf.h in the right place.+ (substitute* '("libpcap_stuff.c" "script.c")+ (("<net/bpf\\.h>") "<pcap/bpf.h>"))+ ;; Likewise for TCL.+ (substitute* "configure"+ (("/usr/include/tcl.h")+ (string-append tcl "/include/tcl.h"))+ (("ls -1 /usr/local/lib")+ (string-append "ls -1 " tcl "/lib")))+ ;; Required environment variables.+ (setenv "CC" "gcc")+ (setenv "TCLSH" (which "tclsh"))+ #t)))+ (add-before 'install 'pre-install+ (lambda* (#:key outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (sbin (string-append out "/sbin"))+ (man (string-append out "/share/man")))+ (mkdir-p sbin)+ (mkdir-p (string-append man "/man8"))+ (substitute* "Makefile"+ (("/usr/sbin") sbin)+ (("\\$\\{INSTALL_MANPATH\\}") man))+ ;; Fix references to wrong executable name.+ (substitute* "docs/hping3.8"+ (("hping2") "hping3")+ (("HPING2") "HPING3"))+ #t))))+ #:tests? #f)) ;no tests+ (inputs+ `(("libpcap" ,libpcap)+ ("tcl" ,tcl)))+ (home-page "http://www.hping.org/")+ (synopsis "Network testing tool")+ (description+ "hping is a command-line oriented TCP/IP packet assembler/analyzer.+The interface is inspired by the @command{ping(8)} command, but hping isn't+only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP+protocols, has a traceroute mode, the ability to send files between a covered+channel, and many other features.")+ (license license:gpl2)))) ;strlcpy.c is BSD-3+ (define-public httping (package (name "httping")-- 2.14.3
Tobias Geerinckx-Rice wrote on 24 Oct 2017 16:39
Marius Bakke wrote on 24/10/17 at 08:06:
Toggle quote (2 lines)> * gnu/packages/networking.scm (hping): New public variable.
Nice. I like stuff that sends random packets and breaks things.
Toggle quote (54 lines)> diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm> index a6c104297..4c1771459 100644> --- a/gnu/packages/networking.scm> +++ b/gnu/packages/networking.scm> @@ -563,6 +566,70 @@ send out a ping packet and move on to the next target in a round-robin> fashion.")> (license license:expat)))> > +(define-public hping> + (let ((commit "3547c7691742c6eaa31f8402e0ccbb81387c1b99")> + (revision "0"))> + (package> + (name "hping")> + (version (string-append "3.0.0-" revision "-" (string-take commit 7)))> + (source (origin> + (method git-fetch)> + (uri (git-reference> + (url "https://github.com/antirez/hping")> + (commit commit)))> + (file-name (string-append name "-" version "-checkout"))> + (sha256> + (base32> + "0y0n1ybij3yg9lfgzcwfmjz1sjg913zcqrv391xx83dm0j80sdpb"))))> + (build-system gnu-build-system)> + (arguments> + `(#:phases> + (modify-phases %standard-phases> + (add-before 'configure 'prepare-build> + (lambda* (#:key inputs #:allow-other-keys)> + (let ((tcl (assoc-ref inputs "tcl")))> + ;; Search for bpf.h in the right place.> + (substitute* '("libpcap_stuff.c" "script.c")> + (("<net/bpf\\.h>") "<pcap/bpf.h>"))> + ;; Likewise for TCL.> + (substitute* "configure"> + (("/usr/include/tcl.h")> + (string-append tcl "/include/tcl.h"))> + (("ls -1 /usr/local/lib")> + (string-append "ls -1 " tcl "/lib")))> + ;; Required environment variables.> + (setenv "CC" "gcc")> + (setenv "TCLSH" (which "tclsh"))> + #t)))> + (add-before 'install 'pre-install> + (lambda* (#:key outputs #:allow-other-keys)> + (let* ((out (assoc-ref outputs "out"))> + (sbin (string-append out "/sbin"))> + (man (string-append out "/share/man")))> + (mkdir-p sbin)> + (mkdir-p (string-append man "/man8"))> + (substitute* "Makefile"> + (("/usr/sbin") sbin)> + (("\\$\\{INSTALL_MANPATH\\}") man))
Adding (setenv "MANPATH" man) to 'prepare-build also works, and iscleaner. There's no $SBINPATH, unfortunately.
Toggle quote (5 lines)> + ;; Fix references to wrong executable name.> + (substitute* "docs/hping3.8"> + (("hping2") "hping3")> + (("HPING2") "HPING3"))
Erk. I'm sending a quick PR upstream just for that. Simple substitutionisn't ideal: there are references to things like ‘HPING2-HOWTO’ and‘editing hping2.h’ which — though dubious — shouldn't be changed.
- A question: that HPING2-HOWTO (sic: ‘this HOWTO is not completed andin some points very silly’) is mentioned several times in the man pagebut not installed. Any strong opinions?
- A side note: this package installs ‘hping3’ (the tool), with both‘hping’ and ‘hping2’ as symlinks. There are no such symlinks to the manpage: users must type ‘man hping3’. I've added it to that PR[0].
Toggle quote (8 lines)> + #t))))> + #:tests? #f)) ;no tests> + (inputs> + `(("libpcap" ,libpcap)> + ("tcl" ,tcl)))> + (home-page "http://www.hping.org/")> + (synopsis "Network testing tool")
is a tad (too) short. We should at least mention its purpose "to send(almost) arbitrary packets".
Toggle quote (3 lines)> + (description> + "hping is a command-line oriented TCP/IP packet assembler/analyzer.
I don't see the nuance of ‘oriented’, and suggest dropping it. And hpingsends more than TCP/IP.
Toggle quote (3 lines)> +The interface is inspired by the @command{ping(8)} command, but hping isn't> +only able to send ICMP echo requests. It supports TCP, UDP, ICMP and RAW-IP
‘raw IP’.
Toggle quote (3 lines)> +protocols, has a traceroute mode, the ability to send files between a covered> +channel, and many other features.")
A misspelling of ‘covert channel’?
"hping is a command-line IP packet assembler and analyzer. While its interface is inspired by the @command{ping(8)} command,hping does more than just send ICMP echo requests. It supports the TCP, UDP,ICMP, and raw IP protocols, has a traceroute mode, the ability to send filesover a covert channel, and many other features."
Toggle quote (2 lines)> + (license license:gpl2)))) ;strlcpy.c is BSD-3
There's also display_ipopt.c, which looks like BSD-4.
Kind regards,
[0]: https://github.com/antirez/hping/pull/32
Leo Famulari wrote on 13 Feb 2019 01:08
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 28964@debbugs.gnu.org)
What is the status of this patch?
Can we push it? Or close the bug? It's been a little while...
iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlxjYBsACgkQJkb6MLrKfwgHgg/+Lm490Mm9YHrtkwCS0AHDphRaUgFUrajvRJbvmglrx1A8iFPrqGWPS2g7l1keVAC4tLUjmB7BEDAnZgPw85kob3PAY05IDSXQk/NpT5rVGS8TkG/DtiItfjDc//lzZJ8PN+nRVWrGQzg5Fn/AMVJKOu2erMVWk8O0aO9mYn83r/u+oFdUMHFYihqZE3SC6FnC/c6u1uoXodAmaKkMMN4hfKdVXKoM+3TlasPBK+mkzAU7ZlzaxDPCWF5pWEtf/B9TdiOrRGrRBbgBrzlZT1xHLNSX/2hGNgTaY47ixpo9AMrLItXL894i0h4s7gz/NiQv175koQ2hei8YA5wcstkgi6BO0kn/zYqU0EiL7/He7FnqzZM4O+NA1WxtU7lukxxFwVgxDeaLS6gWZ/tHKu2YPb8GRofkUuHcrWL0F16AogQ1xRyDDeXEj4Oazt4Ujy9fNrXMV9TKMrpwc80+UWad4uC5pvmtPIt2FsbICl4usyZ7ET4nr5d5BIokZpq8jVEUpoDfJYOX6STt6ybRRiJGGOvcY4VGCKTrfIYb+xmxUkWGpwj3IAnFOyLt5yUWsTBjHEOvSrZ3m06X4WH5fy3RyDOYvdEQ3TqHZfI6Qo2FAAB4O+FNsM5C34FTY8h0lc3i+6GA7Xd58Y6RfEW89JFU1HqkgdjLhMdoh3Tac0fkhTo==UKg3-----END PGP SIGNATURE-----

Leo Famulari wrote on 13 Feb 2019 01:09
(no subject)
(address . control@debbugs.gnu.org)
tag 28964 moreinfo
Jakub Kądziołka wrote on 25 Feb 2020 20:12
Re: [bug#28964] [PATCH] gnu: Add hping.
(address . 28964@debbugs.gnu.org)
Since upstream has stopped merging PRs *quite* a while ago, I'd suggestwe should adopt the patches being used by other distributions. I took abrief look at Gentoo, and their patches [1] look reasonable. Thoughts?
[0]: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-analyzer/hping/files
iQIzBAEBCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl5VcXgACgkQ4xWnWEYTFWT7AhAAipcxKtFXSxVH/597IvVWJwlKvJYRY71/TOhFPFULzDz4jB1XmtI8t5l89xs3EwqV7tk9NoTbcvyUixF14NwUj1Pb7OVJAE3ovPZylm5Mchm0qu861CseJEVbwROL+W4BguoSIQdpEzdLk+cz47w5N//H9g0fpNN+RIFslffmiERMTWA5CrHilQiKpTj9NhmQY1Xfx5u5cqk2JWyzASQbak3UbPpfBl65xLIg7Mwg2QQpCYCwCsoJAAzqcrZRu/05RDSMjMQuFrqgBhaz7Gz8/Bibhl61lrsc2XsADGiA+y8BC4OwrEnDZAeELi6l2mW7NiTuxOrHeCyMUMi+XZvEQK7FJ486AMb919k2ZlU8vlVeF1/2/MN/W/O6b7qwX60XS6oMCkfiYoS9PTRSAloh6j900vp1AyZGf7vR3Ly/FK+Wso4MFPVYrpmXJuSBh75RF/ihIySn+z0wdGcliZl2v1Gmfam/nVP6M6v/cjPzpU3nJNVw+WvSgpExpY0CbTSUFIpgVtI9v3p4XV+vSCPPPCcBhl33EyIZUXIpadTElS3Ej1bum2gCCmX0VBExUmiYLGofDncRlPOq/iTswdgAkC4IVvh1573arWknBTtpv86VvYtGVs6Uhq/qp40HNapKNhXN9YrScHU/npK6d1X/JeBNYxJgjcLsJTdXTt5G1lw==M3Iu-----END PGP SIGNATURE-----

Leo Famulari wrote on 25 Feb 2020 21:15
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . 28964@debbugs.gnu.org)
On Tue, Feb 25, 2020 at 08:12:03PM +0100, Jakub Kądziołka wrote:
Toggle quote (6 lines)> Since upstream has stopped merging PRs *quite* a while ago, I'd suggest> we should adopt the patches being used by other distributions. I took a> brief look at Gentoo, and their patches [1] look reasonable. Thoughts?> > [0]: https://gitweb.gentoo.org/repo/gentoo.git/tree/net-analyzer/hping/files
In general we have always packaged upstream rather than 3rd-partyvariants, and tried to push changes upstream, etc. The idea being thatdistros are not the right place for package development.
However, in some cases we do package distro variants of programs whose"canonical" upstreams are defunct, for example w3m, which is nowdeveloped within Debian. It's a matter of judgment.
In this case I think we should drop the patch, since Marius did notpursue it.
iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAl5VgG0ACgkQJkb6MLrKfwhJAw/9HuKtE5F0hvTFFPpeVzCmqdbe1ZAFAHiKEuoWUWFTa7ypTqn6FWRU1w0gI1fbQjfPnAzpxZYpxaaMPlD8ZH18vUlEAb1EDxT+R86yqOz1rUEJp5I3vXwAW+6txbRhkBQT1cv2T8F6rBZishV2gqxgZHz/xsbBJuVBqCmG3eT3bcL5C8MGG/cmSThjyW9BaWoP5gXg9wpn9asRxJkeaHO/FpbDTgmjerlG8V/31eDapovfjz0Ng5RoYVV2OQ8Lrkqauv1UyU6lKzp18MZJlS7dp+QiMk0b9NP4ioZLQvDGWmW9/HieGnUS/Xqd28hD4ZWDYmxRGGwDH5ypyZBi/OLbLUo5eYSnfN+FK3Pgc44Onlv30NnL+Cy4QYrVh7u239gC6X3tSnApaa2nckscQx0QQ+shVFAl4f0OV6CNm/DaGUWXxNKUyJ/74K8cWwTZj97JAxz1TPOe3D5g6PALBpSQwYigxW1UNN6PlnMISla0YEkEx1DnHCPD7vw5cNI91LtttNpagTyF0I68gL6/M9PUT12ljOrarmbL766PWia8f2/CBwLvrrRb5cgfv1EtXMOU185eZYbiPNzJmuc5wiViU9lu3H5wY6AwSnKutx60Xc92JBpLvX3jLjTMfijmxfiKz7yt9xumws5gm9kTmUq2JAgAyoH9zUcO0gHw94Ha4MA==WwNh-----END PGP SIGNATURE-----

Marius Bakke wrote on 26 Feb 2020 21:54
(address . 28964-done@debbugs.gnu.org)
Leo Famulari <leo@famulari.name> writes:
Toggle quote (3 lines)> In this case I think we should drop the patch, since Marius did not> pursue it.
I agree, closing.
iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl5W2w0ACgkQoqBt8qM6VPrKtQf+IXMc8BB7TjNy1XYEQnYjmp/0jPMf0lgu7bvN8S0ZbbQQXoLJoiKSei1iBrGR+kmn/+pqzLmNJp6MmZxFkBQZTiBfQm8I5m/xQpQ3KxLnxZZZ3hpQVVCW4GfQ90e3x2qUduKX+HM02yhFbLISDva3RCnnTbGpu6P+y53QX2q65Ovm0Tss7izbbEYSIK7e41Vp6M3nwyvTapQpn6931UJH8vVLR0dt9XpoGtu1pJwlfQIW9ZKaeXJLjv3C8U0BRqKLYswh8X4ekAN9X9ITTnbZVs00T7PWNfn3lScRpEaR4gUG77r6zZhMdKFL6R6TXxL4kV0WpMzkqmqggeD2ODQATw===YDI8-----END PGP SIGNATURE-----
Your comment

This issue is archived.

To comment on this conversation send email to 28964@debbugs.gnu.org