scapy.contrib.automotive.uds_scan

class scapy.contrib.automotive.uds_scan.UDS_CCEnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_DSCEnumerator[源代码]

基类:UDS_Enumerator, StateGeneratingServiceEnumerator

static enter_state(socket: SuperSocket | SingleConversationSocket, configuration: AutomotiveTestCaseExecutorConfiguration, request: Packet) bool[源代码]
static enter_state_with_tp(sock: SuperSocket | SingleConversationSocket, conf: AutomotiveTestCaseExecutorConfiguration, kwargs: Dict[str, Any]) bool[源代码]
execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • delay_state_change (int) -- Specifies an additional delay after after a session is modified from the transition function. In unit-test scenarios, this delay should be set to zero.

  • overwrite_timeout (bool) -- True by default. This enumerator overwrites the timeout argument, since most ECUs take some time until a session is changed. This ensures that more results are gathered by default. In unit-test scenarios, this value should be set to False, in order to use the timeout specified by the 'timeout' argument.

get_new_edge(socket: SuperSocket | SingleConversationSocket, config: AutomotiveTestCaseExecutorConfiguration) Tuple[EcuState, EcuState] | None[源代码]
get_transition_function(socket: SuperSocket | SingleConversationSocket, edge: Tuple[EcuState, EcuState]) Tuple[Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration, Dict[str, Any]], bool], Dict[str, Any], Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration], bool] | None] | None[源代码]
class scapy.contrib.automotive.uds_scan.UDS_EREnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_Enumerator[源代码]

基类:ServiceEnumerator, ABC

class scapy.contrib.automotive.uds_scan.UDS_IOCBIEnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_RCEnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_RCSelectiveEnumerator[源代码]

基类:StagedAutomotiveTestCase

expansion_width = 253
static points_to_ranges(pois: Iterable[int]) Iterable[int][源代码]
class scapy.contrib.automotive.uds_scan.UDS_RCStartEnumerator[源代码]

基类:UDS_RCEnumerator

class scapy.contrib.automotive.uds_scan.UDS_RDBIEnumerator[源代码]

基类:UDS_Enumerator

static print_information(resp: Packet) str[源代码]
class scapy.contrib.automotive.uds_scan.UDS_RDBIRandomEnumerator[源代码]

基类:UDS_RDBIEnumerator

block_size = 64
execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • probe_start (int) -- Specifies the start identifier for probing.

  • probe_end (int) -- Specifies the end identifier for probing.

class scapy.contrib.automotive.uds_scan.UDS_RDBISelectiveEnumerator[源代码]

基类:StagedAutomotiveTestCase

static points_to_blocks(pois: Sequence[int]) Iterable[int][源代码]
class scapy.contrib.automotive.uds_scan.UDS_RDBPIEnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_RDEnumerator[源代码]

基类:UDS_Enumerator

execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • unittest (bool) -- Enables smaller search space for unit-test scenarios. This safes execution time.

class scapy.contrib.automotive.uds_scan.UDS_RMBAEnumerator[源代码]

基类:StagedAutomotiveTestCase

class scapy.contrib.automotive.uds_scan.UDS_RMBAEnumeratorABC[源代码]

基类:UDS_Enumerator

static get_addr(pkt: UDS_RMBA) int[源代码]

Helper function to get the memoryAddress from a UDS_RMBA packet :param pkt: UDS_RMBA request :return: memory address of the request

static get_size(pkt: UDS_RMBA) int[源代码]

Helper function to gets the memorySize of a UDS_RMBA packet :param pkt: UDS_RMBA request

static set_addr(pkt: UDS_RMBA, addr: int) None[源代码]

Helper function to set the memoryAddress of a UDS_RMBA packet :param pkt: UDS_RMBA request :param addr: memory address to be set

static set_size(pkt: UDS_RMBA, size: int) None[源代码]

Helper function to set the memorySize of a UDS_RMBA packet :param pkt: UDS_RMBA request :param size: memory size to be set

class scapy.contrib.automotive.uds_scan.UDS_RMBARandomEnumerator[源代码]

基类:UDS_RMBAEnumeratorABC

execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • unittest (bool) -- Enables smaller search space for unit-test scenarios. This saves execution time.

class scapy.contrib.automotive.uds_scan.UDS_RMBASequentialEnumerator[源代码]

基类:UDS_RMBAEnumeratorABC

execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • points_of_interest (list) -- A list of _PointOfInterest objects as starting points for sequential search.

pre_execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None[源代码]
show(dump: bool = False, filtered: bool = True, verbose: bool = False) str | None[源代码]
class scapy.contrib.automotive.uds_scan.UDS_SAEnumerator[源代码]

基类:UDS_Enumerator

static evaluate_security_access_response(res: Packet | None, seed: Packet, key: Packet | None) bool[源代码]
static get_seed_pkt(sock: SuperSocket | SingleConversationSocket, level: int = 1, record: bytes = b'') Packet | None[源代码]
pre_execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration) None[源代码]
class scapy.contrib.automotive.uds_scan.UDS_SA_XOR_Enumerator[源代码]

基类:UDS_SAEnumerator, StateGenerator

static get_key_pkt(seed: Packet, level: int = 1) Packet | None[源代码]
get_new_edge(socket: SuperSocket | SingleConversationSocket, config: AutomotiveTestCaseExecutorConfiguration) Tuple[EcuState, EcuState] | None[源代码]
get_security_access(sock: SuperSocket | SingleConversationSocket, level: int = 1, seed_pkt: Packet | None = None) bool[源代码]
get_transition_function(socket: SuperSocket | SingleConversationSocket, edge: Tuple[EcuState, EcuState]) Tuple[Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration, Dict[str, Any]], bool], Dict[str, Any], Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration], bool] | None] | None[源代码]
transition_function(sock: SuperSocket | SingleConversationSocket, _: AutomotiveTestCaseExecutorConfiguration, kwargs: Dict[str, Any]) bool[源代码]
class scapy.contrib.automotive.uds_scan.UDS_Scanner(socket: SuperSocket | SingleConversationSocket, reset_handler: Callable[[], None] | None = None, reconnect_handler: Callable[[], SuperSocket | SingleConversationSocket] | None = None, test_cases: List[AutomotiveTestCaseABC | Type[AutomotiveTestCaseABC]] | None = None, **kwargs: Dict[str, Any] | None)[源代码]

基类:AutomotiveTestCaseExecutor

示例

>>> def reconnect():
>>>     return UDS_DoIPSocket("169.254.186.237")
>>>
>>> es = [UDS_ServiceEnumerator, UDS_DSCEnumerator]
>>>
>>> def reset():
>>>     reconnect().sr1(UDS()/UDS_ER(resetType="hardReset"),
>>>                     verbose=False, timeout=1)
>>>
>>> s = UDS_Scanner(reconnect(), reconnect_handler=reconnect,
>>>                 reset_handler=reset, test_cases=es,
>>>                 UDS_DSCEnumerator_kwargs={
>>>                     "timeout": 20,
>>>                     "overwrite_timeout": False,
>>>                     "scan_range": [1, 3]})
>>>
>>> try:
>>>     s.scan()
>>> except KeyboardInterrupt:
>>>     pass
>>>
>>> s.show_testcases_status()
>>> s.show_testcases()
property default_test_case_clss: List[Type[AutomotiveTestCaseABC]]
class scapy.contrib.automotive.uds_scan.UDS_ServiceEnumerator[源代码]

基类:UDS_Enumerator

execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • request_length (int) -- Specifies the maximum length of arequest packet. The enumerator will generate all packets from a length of 1 (UDS Service ID only) up to the specified request_length.

class scapy.contrib.automotive.uds_scan.UDS_TDEnumerator[源代码]

基类:UDS_Enumerator

class scapy.contrib.automotive.uds_scan.UDS_TPEnumerator[源代码]

基类:UDS_Enumerator, StateGeneratingServiceEnumerator

static cleanup(_: SuperSocket | SingleConversationSocket, configuration: AutomotiveTestCaseExecutorConfiguration) bool[源代码]
static enter(socket: SuperSocket | SingleConversationSocket, configuration: AutomotiveTestCaseExecutorConfiguration, _: Dict[str, Any]) bool[源代码]
get_transition_function(socket: SuperSocket | SingleConversationSocket, edge: Tuple[EcuState, EcuState]) Tuple[Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration, Dict[str, Any]], bool], Dict[str, Any], Callable[[SuperSocket | SingleConversationSocket, AutomotiveTestCaseExecutorConfiguration], bool] | None] | None[源代码]
class scapy.contrib.automotive.uds_scan.UDS_WDBIEnumerator[源代码]

基类:UDS_Enumerator

execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None[源代码]
参数:
  • timeout (integer or float) -- Timeout until a response will arrive after a request

  • count (integer) -- Number of request to be sent in one execution

  • execution_time (int) -- Time in seconds until the execution of this enumerator is stopped.

  • state_allow_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is allowed. If provided, other states will not be executed.

  • state_block_list (EcuState or list) -- List of EcuState objects or EcuState object in which the the execution of this enumerator is blocked.

  • retry_if_none_received (bool) -- Specifies if a request will be send again, if None was received (usually because of a timeout).

  • exit_if_no_answer_received (bool) -- Specifies to finish the execution of this enumerator once None is received.

  • exit_if_service_not_supported (bool) -- Specifies to finish the execution of this enumerator, once the negative return code 'serviceNotSupported' is received.

  • exit_scan_on_first_negative_response (bool) -- Specifies to finish the execution once a negative response is received.

  • retry_if_busy_returncode (bool) -- Specifies to retry a request, if the 'busyRepeatRequest' negative response code is received.

  • debug (bool) -- Enables debug functions during execute.

  • stop_event (Event) -- Signals immediate stop of the execution.

  • scan_range (list or tuple or range or iterable) -- Specifies the identifiers to be scanned.

  • rdbi_enumerator (UDS_RDBIEnumerator) -- Specifies an instance of an UDS_RDBIEnumerator which is used to extract possible data identifiers.

class scapy.contrib.automotive.uds_scan.UDS_WDBISelectiveEnumerator[源代码]

基类:StagedAutomotiveTestCase