Adjust payload shift

This commit is contained in:
Nico Schottelius 2019-03-04 18:31:20 +01:00
parent 77b21207b9
commit b465b366ea

View file

@ -10,7 +10,7 @@ from scapy.all import sniff, get_if_list, Ether, get_if_hwaddr, sendp
from scapy.all import IP, Raw, IPv6, TCP, TCP_client, Ether from scapy.all import IP, Raw, IPv6, TCP, TCP_client, Ether
from scapy.all import sniff from scapy.all import sniff
from scapy.all import Packet, BitField, IntEnumField, ShortField, XShortEnumField, ShortEnumField from scapy.all import Packet, BitField, IntEnumField, ShortField, XShortEnumField, ShortEnumField
from scapy.all import ICMPv6ND_NS from scapy.all import ICMPv6ND_NS, ICMPv6ND_RS
from scapy.data import ETHER_TYPES from scapy.data import ETHER_TYPES
import sys import sys
@ -243,14 +243,13 @@ class L2Controller(object):
log.debug("CPU packet") log.debug("CPU packet")
cpu_header = CpuHeader(packet.payload) cpu_header = CpuHeader(packet.payload)
print("cpu = {} {}".format(cpu_header.__repr__(), len(cpu_header))) log.debug("cpu = {} {}".format(cpu_header.__repr__()))
ether_part = pkg[Ether] ether_part = pkg[Ether]
ether_part.type = cpu_header.type ether_part.type = cpu_header.type
ether_orig = Ether(src=packet.src, dst=packet.dst, type=0x86dd) ether_orig = Ether(src=packet.src, dst=packet.dst, type=0x86dd)
orig_packet = ether_orig / IPv6(packet.load[6:])
orig_packet = ether_orig / IPv6(packet.load[5:])
log.debug("o={}".format(orig_packet.__repr__())) log.debug("o={}".format(orig_packet.__repr__()))