Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/scapy/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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::
Expand Down
18 changes: 9 additions & 9 deletions doc/scapy/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scapy/contrib/ppi_geotag.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion scapy/layers/dot15d4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions scapy/layers/sctp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down