Skip to content

Commit

Permalink
Merge afac84d into 5fc0390
Browse files Browse the repository at this point in the history
  • Loading branch information
diohabara committed Aug 30, 2022
2 parents 5fc0390 + afac84d commit d8004df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions docs/print_http_requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for timestamp, buf in pcap:

# Make sure the Ethernet data contains an IP packet
if not isinstance(eth.data, dpkt.ip.IP):
print 'Non IP Packet type not supported %s\n' % eth.data.__class__.__name__
print('Non IP Packet type not supported %s\n' % eth.data.__class__.__name__)
continue

# Now grab the data within the Ethernet frame (the IP packet)
Expand All @@ -45,11 +45,11 @@ for timestamp, buf in pcap:
fragment_offset = ip.off & dpkt.ip.IP_OFFMASK

# Print out the info
print 'Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp))
print 'Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type
print 'IP: %s -> %s (len=%d ttl=%d DF=%d MF=%d offset=%d)' % \
(inet_to_str(ip.src), inet_to_str(ip.dst), ip.len, ip.ttl, do_not_fragment, more_fragments, fragment_offset)
print 'HTTP request: %s\n' % repr(request)
print('Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp)))
print('Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type)
print('IP: %s -> %s (len=%d ttl=%d DF=%d MF=%d offset=%d)' % \
(inet_to_str(ip.src), inet_to_str(ip.dst), ip.len, ip.ttl, do_not_fragment, more_fragments, fragment_offset))
print('HTTP request: %s\n' % repr(request))
```

**Example Output**
Expand Down
12 changes: 6 additions & 6 deletions docs/print_icmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for timestamp, buf in pcap:

# Make sure the Ethernet data contains an IP packet
if not isinstance(eth.data, dpkt.ip.IP):
print 'Non IP Packet type not supported %s\n' % eth.data.__class__.__name__
print('Non IP Packet type not supported %s\n' % eth.data.__class__.__name__)
continue

# Now grab the data within the Ethernet frame (the IP packet)
Expand All @@ -30,11 +30,11 @@ for timestamp, buf in pcap:
fragment_offset = ip.off & dpkt.ip.IP_OFFMASK

# Print out the info
print 'Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp))
print 'Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type
print 'IP: %s -> %s (len=%d ttl=%d DF=%d MF=%d offset=%d)' % \
(inet_to_str(ip.src), inet_to_str(ip.dst), ip.len, ip.ttl, do_not_fragment, more_fragments, fragment_offset)
print 'ICMP: type:%d code:%d checksum:%d data: %s\n' % (icmp.type, icmp.code, icmp.sum, repr(icmp.data))
print('Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp)))
print('Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type)
print('IP: %s -> %s (len=%d ttl=%d DF=%d MF=%d offset=%d)' % \
(inet_to_str(ip.src), inet_to_str(ip.dst), ip.len, ip.ttl, do_not_fragment, more_fragments, fragment_offset))
print('ICMP: type:%d code:%d checksum:%d data: %s\n' % (icmp.type, icmp.code, icmp.sum, repr(icmp.data)))
```

**Example Output**
Expand Down
6 changes: 3 additions & 3 deletions docs/print_packets.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Frame and IP packet.
for timestamp, buf in pcap:

# Print out the timestamp in UTC
print 'Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp))
print('Timestamp: ', str(datetime.datetime.utcfromtimestamp(timestamp)))

# Unpack the Ethernet frame (mac src/dst, ethertype)
eth = dpkt.ethernet.Ethernet(buf)
print 'Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type
print('Ethernet Frame: ', mac_addr(eth.src), mac_addr(eth.dst), eth.type)

# Make sure the Ethernet frame contains an IP packet
if not isinstance(eth.data, dpkt.ip.IP):
print 'Non IP Packet type not supported %s\n' % eth.data.__class__.__name__
print('Non IP Packet type not supported %s\n' % eth.data.__class__.__name__)
continue

# Now access the data within the Ethernet frame (the IP packet)
Expand Down

0 comments on commit d8004df

Please sign in to comment.