diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-12-24 16:25:16 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2020-12-24 16:25:16 +0000 |
commit | 14397865a676d26e7f73ea4897f12dc1db8a3406 (patch) | |
tree | 4ae1452faae07a3cd38c717b6677f23c2b1b90da | |
parent | f9799f5bcfdecb0bb8b977e1fb6d611ca0146472 (diff) |
Switch to scapy with python 3.
-rw-r--r-- | regress/sys/net/pf_state/LICENSE | 28 | ||||
-rw-r--r-- | regress/sys/net/pf_state/Makefile | 12 | ||||
-rw-r--r-- | regress/sys/net/pf_state/challenge_ack.py | 16 |
3 files changed, 28 insertions, 28 deletions
diff --git a/regress/sys/net/pf_state/LICENSE b/regress/sys/net/pf_state/LICENSE index d38be67275f..89cd9f5fd6f 100644 --- a/regress/sys/net/pf_state/LICENSE +++ b/regress/sys/net/pf_state/LICENSE @@ -1,14 +1,14 @@ -# Copyright (c) 2016 Alexandr Nedvedicky <sashan@openbsd.org> -# Copyright (c) 2015-2016 Alexander Bluhm <bluhm@openbsd.org> -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +Copyright (c) 2016 Alexandr Nedvedicky <sashan@openbsd.org> +Copyright (c) 2015-2020 Alexander Bluhm <bluhm@openbsd.org> + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/regress/sys/net/pf_state/Makefile b/regress/sys/net/pf_state/Makefile index e8fde007eff..0e30288ad3d 100644 --- a/regress/sys/net/pf_state/Makefile +++ b/regress/sys/net/pf_state/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.11 2020/12/17 00:51:13 bluhm Exp $ +# $OpenBSD: Makefile,v 1.12 2020/12/24 16:25:15 bluhm Exp $ # Copyright (c) 2016-2020 Alexander Bluhm <bluhm@openbsd.org> # @@ -22,9 +22,9 @@ .if ! (make(clean) || make(cleandir) || make(obj)) -.if ! exists(/usr/local/bin/scapy) +.if ! exists(/usr/local/bin/scapy-3) regress: - @echo Install scapy package to run this regress. + @echo Install py3-scapy package to run this regress. @echo SKIPPED .endif @@ -78,10 +78,10 @@ regress: .if make (regress) || make (all) .BEGIN: - @echo ${SUDO} true ssh -t ${REMOTE_SSH} ${SUDO} true rm -f stamp-pfctl + @echo .endif # Create python include file containing the addresses. @@ -108,9 +108,9 @@ stamp-pfctl: addr.py pf.conf # Set variables so that make runs with and without obj directory. # Only do that if necessary to keep visible output short. .if ${.CURDIR} == ${.OBJDIR} -PYTHON = python2.7 -u ./ +PYTHON = python3 -u ./ .else -PYTHON = PYTHONPATH=${.OBJDIR} python2.7 -u ${.CURDIR}/ +PYTHON = PYTHONPATH=${.OBJDIR} python3 -u ${.CURDIR}/ .endif REGRESS_TARGETS += run-challenge-ack diff --git a/regress/sys/net/pf_state/challenge_ack.py b/regress/sys/net/pf_state/challenge_ack.py index 793e407895e..2703ae8d1de 100644 --- a/regress/sys/net/pf_state/challenge_ack.py +++ b/regress/sys/net/pf_state/challenge_ack.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/local/bin/python3 # check wether path mtu to dst is as expected import os @@ -27,20 +27,20 @@ tport=os.getpid() & 0xffff ip=IP(src=FAKE_NET_ADDR, dst=REMOTE_ADDR) -print "Send SYN packet, receive SYN+ACK" +print("Send SYN packet, receive SYN+ACK") syn=TCP(sport=tport, dport='echo', seq=1, flags='S', window=(2**16)-1) synack=sr1(ip/syn, iface=LOCAL_IF, timeout=5) if synack is None: - print "ERROR: no matching SYN+ACK packet received" + print("ERROR: no matching SYN+ACK packet received") exit(1) -print "Send ACK packet to finish handshake." +print("Send ACK packet to finish handshake.") ack=TCP(sport=synack.dport, dport=synack.sport, seq=2, flags='A', ack=synack.seq+1) send(ip/ack, iface=LOCAL_IF) -print "Connection is established, send bogus SYN, expect challenge ACK" +print("Connection is established, send bogus SYN, expect challenge ACK") bogus_syn=TCP(sport=syn.sport, dport=syn.dport, seq=1000000, flags='S', window=(2**16)-1) sniffer = Sniff1(); @@ -53,12 +53,12 @@ sniffer.join(timeout=7) challenge_ack = sniffer.packet if challenge_ack is None: - print "ERROR: no matching ACK packet received" + print("ERROR: no matching ACK packet received") exit(1) if challenge_ack.getlayer(TCP).seq != (synack.seq + 1): - print "ERROR: expecting seq %d got %d in challange ack" % \ - (challenge_ack.getlayer(TCP).seq, (synack.seq + 1)) + print("ERROR: expecting seq %d got %d in challange ack" % \ + (challenge_ack.getlayer(TCP).seq, (synack.seq + 1))) exit(1) exit(0) |