scapy.contrib.automotive.scanner.enumerator
- class scapy.contrib.automotive.scanner.enumerator.ServiceEnumerator[源代码]
-
Base class for ServiceEnumerators of automotive diagnostic protocols
- property completed: 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.
- property filtered_results: List[_AutomotiveTestCaseFilteredScanResult]
- property negative_response_blacklist: List[int]
- property results: List[_AutomotiveTestCaseScanResult]
- property results_with_negative_response: List[_AutomotiveTestCaseFilteredScanResult]
Helper function to get all results with negative response :return: all results with negative response
- property results_with_positive_response: List[_AutomotiveTestCaseFilteredScanResult]
Helper function to get all results with positive response :return: all results with positive response
- property results_with_response: List[_AutomotiveTestCaseFilteredScanResult]
- property results_without_response: List[_AutomotiveTestCaseScanResult]
Helper function to get all results without response :return: all results without response
- property scanned_states: Set[EcuState]
Helper function to get all sacnned states in results :return: all scanned states
- sr1_with_retry_on_error(req: Packet, socket: SuperSocket | SingleConversationSocket, state: EcuState, timeout: int) Packet | None [源代码]
- property supported_responses: List[EcuResponse]
- class scapy.contrib.automotive.scanner.enumerator.StateGeneratingServiceEnumerator[源代码]
基类:
ServiceEnumerator
,StateGenerator
- get_new_edge(socket: SuperSocket | SingleConversationSocket, config: AutomotiveTestCaseExecutorConfiguration) Tuple[EcuState, EcuState] | None [源代码]
Basic identification of a new edge. The last response is evaluated. If this response packet can modify the state of an Ecu, this new state is returned, otherwise None.
- 参数:
socket -- Socket to the DUT (unused)
config -- Global configuration of the executor (unused)
- 返回:
tuple of old EcuState and new EcuState, or 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 [源代码]
- static transition_function(sock: SuperSocket | SingleConversationSocket, config: AutomotiveTestCaseExecutorConfiguration, kwargs: Dict[str, Any]) bool [源代码]
Very basic transition function. This function sends a given request in kwargs and evaluates the response.
- 参数:
sock -- Connection to the DUT
config -- Global configuration of the executor (unused)
kwargs -- Dictionary with arguments. This function only uses the argument "req" which must contain a Packet, causing an EcuState transition of the DUT.
- 返回:
True in case of a successful transition, else False