scapy.layers.can¶
A minimal implementation of the CANopen protocol, based on Wireshark dissectors. See https://wiki.wireshark.org/CANopen
-
class
scapy.layers.can.
BEFloatSignalField
(name, default, start, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
BESignedSignalField
(name, default, start, size, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
BEUnsignedSignalField
(name, default, start, size, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
CAN
(*args, **kargs)[source]¶ Bases:
scapy.base_classes.Gen
[scapy.packet.Packet
]A minimal implementation of the CANopen protocol, based on Wireshark dissectors. See https://wiki.wireshark.org/CANopen
-
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |FLAGS| IDENTIFIER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LENGTH | RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | DATA | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. CAN
CAN fields¶ flags
<Flag 0 ()>
identifier
XBitField
(29 bits)0
length
None
reserved
0
data
b''
-
static
inv_endianness
(pkt)[source]¶ Invert the order of the first four bytes of a CAN packet
This method is meant to be used specifically to convert a CAN packet between the pcap format and the socketCAN format
- Parameters
pkt – str of the CAN packet
- Returns
packet str with the first four bytes swapped
-
-
class
scapy.layers.can.
CandumpReader
(filename, interface=None)[source]¶ Bases:
object
A stateful candump reader. Each packet is returned as a CAN packet
-
dispatch
(callback)[source]¶ call the specified callback routine for each packet read
This is just a convenience function for the main loop that allows for easy launching of packet processing in a thread.
-
nonblocking_socket
= True¶
-
-
class
scapy.layers.can.
LEFloatSignalField
(name, default, start, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
LESignedSignalField
(name, default, start, size, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
LEUnsignedSignalField
(name, default, start, size, scaling=1, unit='', offset=0, ndigits=3)[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]
-
class
scapy.layers.can.
SignalField
(name, default, start, size, scaling=1, unit='', offset=0, ndigits=3, fmt='B')[source]¶ Bases:
scapy.fields._ScalingField
,scapy.fields.Field
[Union
[int
,float
],Union
[int
,float
]]-
size
¶
-
start
¶
-
-
class
scapy.layers.can.
SignalHeader
(*args, **kargs)[source]¶ Bases:
scapy.base_classes.Gen
[scapy.packet.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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |FLAGS| IDENTIFIER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LENGTH | RESERVED | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+ Fig. SignalHeader
SignalHeader fields¶ flags
<Flag 0 ()>
identifier
XBitField
(29 bits)0
length
None
reserved
0
-
-
class
scapy.layers.can.
SignalPacket
(*args, **kargs)[source]¶ Bases:
scapy.base_classes.Gen
[scapy.packet.Packet
]-
aliastypes
¶
-