scapy.contrib.cansocket_python_can

Python-CAN CANSocket Wrapper.

scapy.contrib.cansocket_python_can.CANSocket[源代码]

PythonCANSocket 的别名

class scapy.contrib.cansocket_python_can.PythonCANSocket(**kwargs: Dict[str, Any])[源代码]

基类:SuperSocket

Initializes a python-can bus object as Scapy PythonCANSocket.

All provided keyword arguments, except basecls are forwarded to the python-can can_Bus init function. For further details on python-can check: https://python-can.readthedocs.io/

示例

>>> socket = PythonCANSocket(bustype='socketcan', channel='vcan0', bitrate=250000)
close() None[源代码]

Closes this socket

desc = 'read/write packets at a given CAN interface using a python-can bus object'
nonblocking_socket: bool = True
recv_raw(x: int = 65535) Tuple[Type[Packet] | None, bytes | None, float | None][源代码]

Returns a tuple containing (cls, pkt_data, time)

static select(sockets: List[SuperSocket], remain: float | None = 0.05) List[SuperSocket][源代码]

This function is called during sendrecv() routine to select the available sockets.

参数:

sockets -- an array of sockets that need to be selected

返回:

an array of sockets that were selected and the function to be called next to get the packets (i.g. recv)

send(x: Packet) int[源代码]