Basic Encapsulation Example (#64)

* Adding initial implementation of basic_encap example

* Updated basic_encap example to count the number of valid packets

* Updated basic_encap example to put encapsulation layer after Ethernet
header.

* Added solution file for basic_encap example

* Changed the name of the basic_encap example to basic_tunnel and called
the new header myTunnel. Also changed the myTunnel field names slightly.
This commit is contained in:
sibanez12
2017-10-25 16:22:23 -07:00
committed by Robert Soule
parent 597b5b401c
commit 7738341012
11 changed files with 757 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
from scapy.all import *
import sys, os
TYPE_MYTUNNEL = 0x1212
TYPE_IPV4 = 0x0800
class MyTunnel(Packet):
name = "MyTunnel"
fields_desc = [
ShortField("pid", 0),
ShortField("dst_id", 0)
]
def mysummary(self):
return self.sprintf("pid=%pid%, dst_id=%dst_id%")
bind_layers(Ether, MyTunnel, type=TYPE_MYTUNNEL)
bind_layers(MyTunnel, IP, pid=TYPE_IPV4)