scapy.contrib.cansocket_native
NativeCANSocket.
- scapy.contrib.cansocket_native.CANSocket[source]
alias of
NativeCANSocket
- class scapy.contrib.cansocket_native.NativeCANSocket(channel: str | None = None, receive_own_messages: bool = False, can_filters: ~typing.List[~typing.Dict[str, int]] | None = None, fd: bool = False, basecls: ~typing.Type[~scapy.packet.Packet] = <class 'scapy.layers.can.CAN'>, **kwargs: ~typing.Dict[str, ~typing.Any])[source]
Bases:
SuperSocket
Initializes a Linux PF_CAN socket object.
Example
>>> socket = NativeCANSocket(channel="vcan0", can_filters=[{'can_id': 0x200, 'can_mask': 0x7FF}])
- Parameters:
channel – Network interface name
receive_own_messages – Messages, sent by this socket are will also be received.
can_filters – A list of can filter dictionaries.
basecls – Packet type in which received data gets interpreted.
kwargs – Various keyword arguments for compatibility with PythonCANSockets
- desc = 'read/write packets at a given CAN interface using PF_CAN sockets'