[PATCH] gnu: Add package python-scapy

  • Done
  • quality assurance status badge
Details
4 participants
  • Andreas Enge
  • Gabriel Wicki
  • Bruno Victal
  • Wicki Gabriel (wicg)
Owner
unassigned
Submitted by
Gabriel Wicki
Severity
normal
G
G
Gabriel Wicki wrote on 11 Jan 2023 17:36
New package: python-scapy
(address . guix-patches@gnu.org)
20230111163659.wudbizhylifjt3nj@blackbox
Hi!

I had time to pack some more software for our favorite distro: Python
Scapy. It's a powerful tool which allows the creation and inspection
of ethernet frames and other network traffic packets from within Python.


From f2ca7968afdc5013d78f38e47bf9bfc34af2baa0 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 9 Jan 2023 16:06:20 +0100
Subject: [PATCH] gnu: Add package python-scapy

* gnu/packages/python-xyz.scm (python-scapy): New variable.
---
gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (42 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 32d826d3c5..7e6704f4aa 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -132,6 +132,7 @@
;;; Copyright � 2022 Garek Dyszel <garekdyszel@disroot.org>
;;; Copyright � 2022 Baptiste Strazzulla <bstrazzull@hotmail.fr>
;;; Copyright � 2022 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright � 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1462,6 +1463,27 @@ (define-public python-psutil
iotop, uptime, pidof, tty, taskset, pmap.")
(license license:bsd-3)))
+(define-public python-scapy
+ (package
+ (name "python-scapy")
+ (version "2.5.0")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "scapy" version))
+ (sha256
+ (base32
+ "1hpbbmpcn4dwj3z7i7sz4cnbpkaf57p7mvl3p84x9n2gflmhq9jv"))))
+ (arguments
+ '(#:tests? #f)) ;no test
+ (build-system python-build-system)
+ (home-page "https://scapy.net")
+ (synopsis "Python network packet crafting library")
+ (description
+ "Scapy is a powerful interactive packet manipulation program.
+It is able to forge or decode packets of a wide number of protocols, send them
+on the wire, capture them, match requests and replies, and much more.")
+ (license license:gpl2)))
+
(define-public python-shapely
(package
(name "python-shapely")
--
2.38.1
B
B
Bruno Victal wrote on 11 Jan 2023 18:37
(no subject)
(name . control)(address . control@debbugs.gnu.org)
f77e6554-a24d-1b0a-924d-3eeea473f720@makinata.eu
retitle 60732 [PATCH] gnu: Add package python-scapy
tags 60732 + patch

tags 60658 + patch
tags 60661 + patch
tags 60539 + patch
tags 60540 + patch
tags 60640 + patch

quit
A
A
Andreas Enge wrote on 20 Feb 2023 22:21
Review
(address . 60732@debbugs.gnu.org)
Y/PkdO1fS9ZCQ1JX@jurong
Hello,

attached is a patch with a slightly reworked description and commit message.
I verified the license and built the package on x86_64.

However, I am not sure about the tests; there is a subdirectory "test",
but it is apparently not run by the standard procedure. Maybe it is not
meant to be an automatic test?

Then scapy.egg-info/requires.txt contains this:
[basic]
ipython

[complete]
ipython
pyx
cryptography>=2.0
matplotlib

[docs]
sphinx>=3.0.0
sphinx_rtd_theme>=0.4.3
tox>=3.0.0

So it looks like there are a number of propagated- and native-inputs that
are missing. It would be good if someone could build and try the package.
Someone who knows Python is needed, I give the task back :)

Andreas
From cc5e2cb341ae80c87f54fe0854ae8f5bc05a2a68 Mon Sep 17 00:00:00 2001
Message-Id: <cc5e2cb341ae80c87f54fe0854ae8f5bc05a2a68.1676927790.git.andreas@enge.fr>
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 9 Jan 2023 16:06:20 +0100
Subject: [PATCH] gnu: Add python-scapy.

* gnu/packages/python-xyz.scm (python-scapy): New variable.
---
gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 71a52a7ad8..af481fb9eb 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -132,6 +132,7 @@
;;; Copyright ᅵ 2022 Garek Dyszel <garekdyszel@disroot.org>
;;; Copyright ᅵ 2022 Baptiste Strazzulla <bstrazzull@hotmail.fr>
;;; Copyright ᅵ 2022 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright ᅵ 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1453,6 +1454,30 @@ (define-public python-psutil
iotop, uptime, pidof, tty, taskset, pmap.")
(license license:bsd-3)))
+(define-public python-scapy
+ (package
+ (name "python-scapy")
+ (version "2.5.0")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "scapy" version))
+ (sha256
+ (base32
+ "1hpbbmpcn4dwj3z7i7sz4cnbpkaf57p7mvl3p84x9n2gflmhq9jv"))))
+ (arguments
+ '(#:tests? #t)) ;no test
+ (build-system python-build-system)
+ (home-page "https://scapy.net")
+ (synopsis "Python network packet crafting library")
+ (description
+ "Scapy is a Python library and executable for interactively
+manipulating network packets. It can forge or decode packets of a number
+of protocols, send them on the wire, capture them, store or read them
+using pcap files, match requests and replies, and so on.
+It can handle tasks such as scanning, tracerouting, probing, unit tests,
+attacks or network discovery.")
+ (license license:gpl2)))
+
(define-public python-shapely
(package
(name "python-shapely")
--
2.39.1
W
W
Wicki Gabriel (wicg) wrote on 21 Feb 2023 18:44
Patch update
(name . 60732@debbugs.gnu.org)(address . 60732@debbugs.gnu.org)(name . andreas@enge.fr)(address . andreas@enge.fr)
ZR0P278MB02684E55FE46B54711C406A3C1A59@ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM
Hi
Thank you, Andreas, for your review.
When #:tests? #t? the following output is generated (and the build fails)
Toggle quote (2 lines)
> running test
> WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
I am not sure how to achieve this using our package management system and am not sure if it would be of great gain to do so.
According to the documentation [1] ipython, matplotlib, etc are optional dependencies. I wouldn't include them per se since one can easily invoke a Guix shell providing these.
To test one can invoke a guix shell --pure python-scapy python-ipython? and run scapy? manually.
I have adjusted the patch, thank you for your time and effort in advance!
Please let me know if i can improve it some more!
g
Attachment: file
From 0575e799328f93f6c4c5afe893ae10e6e7a9ee28 Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 9 Jan 2023 16:06:20 +0100
Subject: [PATCH] gnu: Add python-scapy.

* gnu/packages/python-xyz.scm (python-scapy): New variable.
---
gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (45 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 32d826d3c5..d9bee20eb8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -132,6 +132,7 @@
;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org>
;;; Copyright © 2022 Baptiste Strazzulla <bstrazzull@hotmail.fr>
;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1462,6 +1463,30 @@ (define-public python-psutil
iotop, uptime, pidof, tty, taskset, pmap.")
(license license:bsd-3)))
+(define-public python-scapy
+ (package
+ (name "python-scapy")
+ (version "2.5.0")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "scapy" version))
+ (sha256
+ (base32
+ "1hpbbmpcn4dwj3z7i7sz4cnbpkaf57p7mvl3p84x9n2gflmhq9jv"))))
+ (arguments
+ '(#:tests? #f)) ;The recommendation is to use tox for testing.
+ (build-system python-build-system)
+ (home-page "https://scapy.net")
+ (synopsis "Python network packet crafting library")
+ (description
+ "Scapy is a Python library and executable for interactively
+manipulating network packets. It can forge or decode packets of a number
+of protocols, send them on the wire, capture them, store or read them
+using pcap files, match requests and replies, and so on.
+It can handle tasks such as scanning, tracerouting, probing, unit tests,
+attacks or network discovery.")
+ (license license:gpl2)))
+
(define-public python-shapely
(package
(name "python-shapely")
--
2.39.1
W
W
Wicki Gabriel (wicg) wrote on 28 Feb 2023 14:50
(name . 60732@debbugs.gnu.org)(address . 60732@debbugs.gnu.org)
ZR0P278MB026829F76DC626856CC2BF50C1AC9@ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM
Hello Python Team
I'm sorry if you are well-aware of issue 60732 [0], but since i (think i) forgot to CC you on my previous emails i would like to raise awareness of this (probably) easy merge now ?
Let me know if I can change anything, i'm happy to do so.
Thank you for your time and effort,
g
Attachment: file
A
A
Andreas Enge wrote on 11 Mar 2023 23:24
Close patch
(address . 60732-done@debbugs.gnu.org)(name . Gabriel Wicki)(address . gabriel@erlikon.ch)
ZAz/jcCcQ6q3Ydbc@jurong
Hello Gabriel,

apologies for not coming back to you. I was a bit torn about the
dependencies, since we tend to package software as "completely" as
possible. Here however the optional dependencies are quite heavy,
and python-pycrypto is outdated and unmaintained and should not be
used anymore. So in the end I opted to leave them out, if someone feels
the need, we can add them to the package, or indeed as you said they
can install them into their profile themselves.

As for the tests, my impression is that they are actually not activated.
So I added a comment.

The patch is pushed now, thanks again for your patience!

Andreas
Closed
?