diff --git a/doc/scapy/development.rst b/doc/scapy/development.rst index 3c2fcda23d5..90df9807776 100644 --- a/doc/scapy/development.rst +++ b/doc/scapy/development.rst @@ -120,7 +120,7 @@ The generic format for a test campaign is shown in the following table:: * Comments for unit test 1 # Python statements follow a = 1 - print a + print(a) a == 1 @@ -196,7 +196,7 @@ Table 5 shows a simple test campaign with multiple tests set definitions. Additi = Unit Test 1 ~ test_set_1 simple a = 1 - print a + print(a) = Unit test 2 ~ test_set_1 simple @@ -234,7 +234,7 @@ Table 5 shows a simple test campaign with multiple tests set definitions. Additi = Unit Test 6 ~ test_set_2 hardest - print e + print(e) e == 1296 To see an example that is targeted to Scapy, go to http://www.secdev.org/projects/UTscapy. Cut and paste the example at the bottom of the page to the file ``demo_campaign.txt`` and run UTScapy against it:: diff --git a/doc/scapy/usage.rst b/doc/scapy/usage.rst index 9bb678a0849..1795d1058e2 100644 --- a/doc/scapy/usage.rst +++ b/doc/scapy/usage.rst @@ -502,8 +502,8 @@ A TCP traceroute:: ***...... Received 33 packets, got 21 answers, remaining 1 packets >>> for snd,rcv in ans: - ... print snd.ttl, rcv.src, isinstance(rcv.payload, TCP) - ... + ... print(snd.ttl, rcv.src, isinstance(rcv.payload, TCP)) + ... 5 194.51.159.65 0 6 194.51.159.49 0 4 194.250.107.181 0 @@ -1644,7 +1644,7 @@ In this case we got 2 replies, so there were two active DHCP servers on the test We are only interested in the MAC and IP addresses of the replies: - >>> for p in ans: print p[1][Ether].src, p[1][IP].src + >>> for p in ans: print(p[1][Ether].src, p[1][IP].src) ... 00:de:ad:be:ef:00 192.168.1.1 00:11:11:22:22:33 192.168.1.11 @@ -1670,16 +1670,16 @@ Firewalking TTL decrementation after a filtering operation only not filtered packets generate an ICMP TTL exceeded - >>> ans, unans = sr(IP(dst="172.16.4.27", ttl=16)/TCP(dport=(1,1024))) - >>> for s,r in ans: - if r.haslayer(ICMP) and r.payload.type == 11: - print s.dport + >>> ans, unans = sr(IP(dst="172.16.4.27", ttl=16)/TCP(dport=(1,1024))) + >>> for s,r in ans: + ... if r.haslayer(ICMP) and r.payload.type == 11: + ... print(s.dport) Find subnets on a multi-NIC firewall only his own NIC’s IP are reachable with this TTL:: - >>> ans, unans = sr(IP(dst="172.16.5/24", ttl=15)/TCP()) - >>> for i in unans: print i.dst + >>> ans, unans = sr(IP(dst="172.16.5/24", ttl=15)/TCP()) + >>> for i in unans: print(i.dst) TCP Timestamp Filtering diff --git a/scapy/contrib/ppi_geotag.py b/scapy/contrib/ppi_geotag.py index 80e47f78769..6a704a16fa7 100644 --- a/scapy/contrib/ppi_geotag.py +++ b/scapy/contrib/ppi_geotag.py @@ -198,7 +198,7 @@ def any2i(self, pkt, x): pass else: y = x - # print "any2i: %s --> %s" % (str(x), str(y)) + # print("any2i: %s --> %s" % (str(x), str(y))) return y diff --git a/scapy/layers/dot15d4.py b/scapy/layers/dot15d4.py index 5854abff1a3..b83933de6ef 100644 --- a/scapy/layers/dot15d4.py +++ b/scapy/layers/dot15d4.py @@ -91,7 +91,7 @@ def lengthFromAddrMode(self, pkt, x): if pkttop.underlayer is None: break pkttop = pkttop.underlayer - # print "Underlayer field value of", x, "is", addrmode + # print("Underlayer field value of", x, "is", addrmode) if addrmode == 2: return 2 elif addrmode == 3: diff --git a/scapy/layers/sctp.py b/scapy/layers/sctp.py index b69d6c193ed..649ca59aa29 100644 --- a/scapy/layers/sctp.py +++ b/scapy/layers/sctp.py @@ -124,13 +124,13 @@ def crc32c(buf): def update_adler32(adler, buf): s1 = adler & 0xffff s2 = (adler >> 16) & 0xffff - print s1,s2 + print(s1, s2) for c in buf: - print orb(c) + print(orb(c)) s1 = (s1 + orb(c)) % BASE s2 = (s2 + s1) % BASE - print s1,s2 + print(s1, s2) return (s2 << 16) + s1 def sctp_checksum(buf):