scapy.layers.sixlowpan
6LoWPAN Protocol Stack
This implementation follows the next documents:
Transmission of IPv6 Packets over IEEE 802.15.4 Networks: RFC 4944
Compression Format for IPv6 Datagrams in Low Power and Lossy networks (6LoWPAN): RFC 6282
RFC 4291
Application |
Application Protocols |
|
Transport |
UDP |
TCP |
Network |
IPv6 |
|
LoWPAN |
||
Data Link Layer |
IEEE 802.15.4 MAC |
|
Physical |
IEEE 802.15.4 PHY |
|
Note that:
Only IPv6 is supported
LoWPAN is in the middle between network and data link layer
The Internet Control Message protocol v6 (ICMPv6) is used for control messaging.
Adaptation between full IPv6 and the LoWPAN format is performed by routers at the edge of 6LoWPAN islands.
A LoWPAN support addressing; a direct mapping between the link-layer address and the IPv6 address is used for achieving compression.
- Known Issues:
Unimplemented context information
Unimplemented IPv6 extensions fields
- class scapy.layers.sixlowpan.IP6FieldLenField(name, default, length_of=None)[源代码]
基类:
IP6Field- length_of
- class scapy.layers.sixlowpan.LoWPANBroadcast(_pkt, /, *, reserved=80, seq=0)[源代码]
基类:
Packet- aliastypes
- class scapy.layers.sixlowpan.LoWPANFragmentationFirst(_pkt, /, *, reserved=24, datagramSize=0, datagramTag=0)[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED| DATAGRAMSIZE | DATAGRAMTAG | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LoWPANFragmentationFirstLoWPANFragmentationFirst fields reserved
BitField(5 bits)24datagramSize
BitField(11 bits)0datagramTag
0
- class scapy.layers.sixlowpan.LoWPANFragmentationSubsequent(_pkt, /, *, reserved=28, datagramSize=0, datagramTag=<RandShort>, datagramOffset=0)[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED| DATAGRAMSIZE | DATAGRAMTAG | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DATAGRAMOFFSET| +-+-+-+-+-+-+-+-+ Fig. LoWPANFragmentationSubsequentLoWPANFragmentationSubsequent fields reserved
BitField(5 bits)28datagramSize
BitField(11 bits)0datagramTag
<RandShort>datagramOffset
0
- class scapy.layers.sixlowpan.LoWPANMesh(_pkt, /, *, reserved=2, v=0, f=0, hopsLeft=0, src=None, dst=None)[源代码]
基类:
Packet- aliastypes
- deprecated_fields: Dict[str, Tuple[str, str]] = {'_destinyAddr': ('dst', '2.4.4'), '_f': ('f', '2.4.4'), '_sourceAddr': ('src', '2.4.4'), '_v': ('v', '2.4.4')}
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |RES|V|F|HOPSLEF| SRC | +-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | DST | +-+-+-+-+-+-+-+-+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. LoWPANMeshLoWPANMesh fields reserved
BitField(2 bits)2v
0f
0hopsLeft
BitField(4 bits)0src
MultipleTypeField(XShortField, XLongField)0dst
MultipleTypeField(XShortField, XLongField)0
- class scapy.layers.sixlowpan.LoWPANUncompressedIPv6(_pkt, /, *, _type=65)[源代码]
基类:
Packet- aliastypes
- class scapy.layers.sixlowpan.LoWPAN_HC1(_pkt, /, *, reserved=66, sp=0, si=0, dp=0, di=0, tc_fl=0, nh=0, hc2=0, hc2Field=None, hopLimit=0, src='::', dst='::', traffic_class=0, flow_label=0, udpSourcePort=None, udpDestPort=None, udpLength=0, udpChecksum=0, pad=0)[源代码]
基类:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED |S|S|D|D|T| NH|H|HC2FIEL| HOPLIMIT | SRC | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | DST | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+ | | TRAFFIC CLASS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FLOW LABEL | UDPSOURCEPORT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | UDPDESTPORT | UDPLENGTH | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | UDPCHECKSUM |PA| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LoWPAN_HC1LoWPAN_HC1 fields reserved
66sp
0si
0dp
0di
0tc_fl
0nh
0hc2
0hc2Field
MultipleTypeField(Cond, PacketField, StrFixedLenField)b''hopLimit
0src
'::'dst
'::'traffic_class
ByteField(Cond)0flow_label
BitField(Cond) (20 bits)0udpSourcePort
MultipleTypeField(Cond, BitScalingField, BitField)0udpDestPort
MultipleTypeField(Cond, BitScalingField, BitField)0udpLength
BitField(Cond) (16 bits)0udpChecksum
XBitField(Cond) (16 bits)0pad
BitFixedLenField(0 bit)0
- class scapy.layers.sixlowpan.LoWPAN_HC2_UDP(_pkt, /, *, sc=0, dc=0, lc=0, res=0)[源代码]
基类:
Packet- aliastypes
- class scapy.layers.sixlowpan.LoWPAN_IPHC(_pkt, /, *, _reserved=3, tf=0, nh=0, hlim=0, cid=0, sac=0, sam=0, m=0, dac=0, dam=0, sci=0, dci=0, tc_ecn=0, tc_dscp=0, rsv=None, flowlabel=0, nhField=0, hopLimit=0, src='::', dst='::')[源代码]
基类:
Packet6LoWPAN IPv6 header compressed packets
It follows the implementation of RFC6282
- aliastypes
- deprecated_fields: Dict[str, Tuple[str, str]] = {'_hopLimit': ('hopLimit', '2.4.4'), '_nhField': ('nhField', '2.4.4'), 'destinyAddr': ('dst', '2.4.4'), 'sourceAddr': ('src', '2.4.4'), 'udpDestinyPort': ('udpDestPort', '2.4.4')}
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESE| TF|N|HLI|C|S|SAM|M|D|DAM| SCI | DCI |TC | TC DSCP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |RSV| FLOWLABEL | NHFIELD |HOP| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | SRC | +-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | DST | +-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+ Fig. LoWPAN_IPHCLoWPAN_IPHC fields _reserved
BitField(3 bits)3tf
BitField(2 bits)0nh
0hlim
0cid
0sac
0sam
0m
0dac
0dam
0sci
BitField(Cond) (4 bits)0dci
BitField(Cond) (4 bits)0tc_ecn
BitField(Cond) (2 bits)0tc_dscp
BitField(Cond) (6 bits)0rsv
MultipleTypeField(Cond, BitField, BitField)0flowlabel
BitField(Cond) (20 bits)0nhField
ByteEnumField(Cond)0hopLimit
ByteField(Cond)0src
'::'dst
'::'
- class scapy.layers.sixlowpan.LoWPAN_NHC(_pkt, /, *, exts=[])[源代码]
基类:
Packet- aliastypes
- class scapy.layers.sixlowpan.LoWPAN_NHC_IPv6Ext(_pkt, /, *, res=14, eid=0, nh=0, nhField=0, len=None, data=b'')[源代码]
-
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RES | EID |N| NHFIELD | LEN | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. LoWPAN_NHC_IPv6ExtLoWPAN_NHC_IPv6Ext fields res
BitField(4 bits)14eid
0nh
BitField(1 bit)0nhField
ByteField(Cond)0len
Nonedata
b''
- class scapy.layers.sixlowpan.LoWPAN_NHC_UDP(_pkt, /, *, res=30, C=0, P=0, udpSourcePort=None, udpDestPort=None, udpChecksum=0)[源代码]
-
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RES |C| P | UDPSOURCEPORT | UDPDESTPORT | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | UDPCHECKSUM | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LoWPAN_NHC_UDPLoWPAN_NHC_UDP fields res
BitField(5 bits)30C
BitField(1 bit)0P
BitField(2 bits)0udpSourcePort
MultipleTypeField(BitField, BitField, BitField, BitField)0udpDestPort
MultipleTypeField(BitField, BitField, BitField, BitField)0udpChecksum
XShortField(Cond)0
- scapy.layers.sixlowpan.dest_addr_size(pkt)[源代码]
Destination address size
This function depending on the arguments returns the amount of bits to be used by the destination address.
Keyword arguments: pkt -- packet object instance
- scapy.layers.sixlowpan.sixlowpan_fragment(packet, datagram_tag=1)[源代码]
Split a packet into different links to transmit as 6lowpan packets. Usage example:
>>> ipv6 = ..... (very big packet) >>> pkts = sixlowpan_fragment(ipv6, datagram_tag=0x17) >>> send = [Dot15d4()/Dot15d4Data()/x for x in pkts] >>> wireshark(send)