CN-121996561-A - Test script generation method, device, equipment and medium for vehicle-mounted intrusion detection system
Abstract
The application discloses a test script generation method, a device, equipment and a medium for a vehicle-mounted intrusion detection system, which relate to the technical field of script generation and comprise the steps of acquiring natural language information corresponding to test requirements of a target vehicle and converting the natural language information into structural semantic representation information; determining a corresponding target abstract scene template based on semantic representation information, filling target parameters in the target abstract scene template based on natural language information and a vehicle-mounted communication protocol to obtain abstract scene information, converting the abstract scene information into operation information suitable for the vehicle-mounted communication protocol, wherein the abstract scene template is an executable case template containing actions and corresponding element information, and filling the operation information into a preset script template to obtain a test script so as to test a vehicle-mounted intrusion detection system corresponding to a target vehicle by using the test script. The application can improve the generation precision from natural language requirements to test scripts aiming at the vehicle-mounted intrusion detection system.
Inventors
- YE FAN
Assignees
- 杭州麦唐科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260205
Claims (10)
- 1. A test script generation method for a vehicle-mounted intrusion detection system is characterized by comprising the following steps: Acquiring natural language information corresponding to the test requirement of a target vehicle, and converting the natural language information into structural semantic representation information; Determining a corresponding target abstract scene template based on the semantic representation information, filling target parameters in the target abstract scene template based on the natural language information and a vehicle-mounted communication protocol to obtain abstract scene information, and converting the abstract scene information into operation information suitable for the vehicle-mounted communication protocol; and filling the operation information into a preset script template to obtain a test script, so as to test the vehicle-mounted intrusion detection system corresponding to the target vehicle by using the test script.
- 2. The method for generating test scripts for an in-vehicle intrusion detection system according to claim 1, wherein said converting said natural language information into structured semantic representation information comprises: If the natural language information is in a text format, denoising and word segmentation are carried out on the natural language information to obtain first information; processing the first information by utilizing an identification rule based on a preset keyword to obtain second information; processing the second information by using a large language model or a sequence labeling model to obtain third information; Normalizing the target value and the target unit in the third information to obtain fourth information; Checking the fourth information by using a preset semantic constraint condition, and determining structured semantic representation information based on the checked fourth information; If the natural language information is in a voice format, converting the natural language information in the voice format into the natural language information in the text format, and jumping to the step of denoising and word segmentation processing on the natural language information until the structured semantic representation information is obtained.
- 3. The method for generating test scripts for an in-vehicle intrusion detection system according to claim 1, wherein said determining a corresponding target abstract scene template based on said semantic representation information comprises: determining a first vector of each abstract scene template in a preset abstract scene template library, and determining a second vector of the semantic representation information; Determining cosine similarity of the first vector and the second vector, and determining the first vector with the cosine similarity not smaller than a preset similarity threshold as a target vector; And determining the abstract scene template corresponding to the target vector as a target abstract scene template in the preset abstract scene template library.
- 4. The method for generating test scripts for the vehicle-mounted intrusion detection system according to claim 1, wherein the filling the target parameters in the target abstract scene template based on the natural language information and the vehicle-mounted communication protocol to obtain abstract scene information comprises: filling target parameters in the target abstract scene template based on the natural language information and a vehicle-mounted communication protocol by using a preset rule engine; if the target abstract scene template contains a vacancy parameter meeting a preset unknown condition, determining a similar scene template with a preset similar condition with the target abstract scene template in a history test record, and filling the vacancy parameter based on target information corresponding to the similar scene template; and determining the filled target abstract scene template as abstract scene information.
- 5. The method for generating a test script for a vehicle-mounted intrusion detection system according to claim 1, wherein the filling the operation information into a preset script template to obtain the test script comprises: Determining a vehicle-mounted test tool and a test environment of the target vehicle, and determining a script running platform based on the vehicle-mounted test tool and the test environment; And filling the operation information into a preset script template in the script operation platform to obtain a test script.
- 6. The method for generating a test script for an in-vehicle intrusion detection system according to claim 1, wherein after the obtaining the test script, further comprises: And verifying the test script based on a preset static grammar rule and a preset protocol consistency rule, and performing simulation previewing operation on the test script passing the verification in a preset simulation sandbox to detect whether the test script collides with a preset constraint inventory by using a preset constraint solver, wherein the preset constraint inventory is a constraint inventory comprising time sequence constraint conditions and safety constraint conditions for the target vehicle.
- 7. The method of generating a test script for an in-vehicle intrusion detection system according to any one of claims 1 to 6, wherein the testing of an in-vehicle intrusion detection system corresponding to the target vehicle using the test script includes: Determining a simulator or hardware in-loop simulation environment corresponding to the target vehicle, wherein the simulator or the hardware comprises a vehicle-mounted intrusion detection system in the in-loop simulation environment; And running the test script in the simulator or the hardware in a ring simulation environment to test the vehicle-mounted intrusion detection system.
- 8. The utility model provides a test script generating device towards on-vehicle intrusion detection system which characterized in that includes: the first information conversion module is used for acquiring natural language information corresponding to the test requirement of the target vehicle and converting the natural language information into structural semantic representation information; The second information conversion module is used for determining a corresponding target abstract scene template based on the semantic representation information, filling target parameters in the target abstract scene template based on the natural language information and a vehicle-mounted communication protocol to obtain abstract scene information, and converting the abstract scene information into operation information suitable for the vehicle-mounted communication protocol; And the script testing module is used for filling the operation information into a preset script template to obtain a testing script so as to test the vehicle-mounted intrusion detection system corresponding to the target vehicle by using the testing script.
- 9. An electronic device, comprising: A memory for storing a computer program; a processor for executing the computer program to implement the test script generation method for an in-vehicle intrusion detection system according to any one of claims 1 to 7.
- 10. A computer-readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the test script generation method for an in-vehicle intrusion detection system according to any one of claims 1 to 7.
Description
Test script generation method, device, equipment and medium for vehicle-mounted intrusion detection system Technical Field The present invention relates to the field of script generation technologies, and in particular, to a method, an apparatus, a device, and a medium for generating a test script for a vehicle-mounted intrusion detection system. Background Modern automobiles rely on multiple ECUs (Electronic Control Unit, electronic control units) and buses to construct a vehicle-mounted network, and the popularization of the vehicle-mounted network and an automatic driving technology makes the vehicles vulnerable to network attacks such as fake messages, and a vehicle-mounted intrusion detection system (namely VIDS, vehicle Intrusion Detection System) becomes a safety protection core. The effectiveness of VIDS depends on full test, but the existing test script generation mode is difficult to adapt to the requirements of vehicle-mounted scenes, and the test efficiency and quality are restricted. Existing test script generation techniques have significant limitations. The template and rule tools rely on manual maintenance of templates and filling parameters, can only cover preset simple scenes, face undefined complex scenes such as cross-ECU serial attack and time window replay, and the like, need to manually expand templates or handwriting scripts, and are low in coverage rate and long in development period. The automatic test scheme based on natural language is multi-oriented to GUI (GRAPHICAL USER INTERFACE )/APP (Application program) operation, semantic mapping and action library lack of CAN message frame, ECU topology, time sequence constraint and other vehicle-mounted field characteristic support, and even if analysis demands CAN not generate executable scripts conforming to vehicle-mounted protocols, a large amount of manual correction is needed. Meanwhile, the existing method does not have the closed-loop utilization capability of the historical test results, can not optimize scripts based on false alarm and missing report experience, has short boards on the support of complex scenes such as multi-node collaborative attack, concurrency simulation and the like, and has poor executable and reproducibility of the generated scripts. Therefore, how to improve the automatic generation precision from the natural language requirement to the test script for the vehicle-mounted intrusion detection system is a technical problem to be solved currently. Disclosure of Invention In view of the above, the present invention aims to provide a method, an apparatus, a device, and a medium for generating a test script for a vehicle-mounted intrusion detection system, which can improve the accuracy from natural language requirements to automatic generation of the test script for the vehicle-mounted intrusion detection system. The specific scheme is as follows: In a first aspect, the present application provides a method for generating a test script for a vehicle-mounted intrusion detection system, including: Acquiring natural language information corresponding to the test requirement of a target vehicle, and converting the natural language information into structural semantic representation information; Determining a corresponding target abstract scene template based on the semantic representation information, filling target parameters in the target abstract scene template based on the natural language information and a vehicle-mounted communication protocol to obtain abstract scene information, and converting the abstract scene information into operation information suitable for the vehicle-mounted communication protocol; and filling the operation information into a preset script template to obtain a test script, so as to test the vehicle-mounted intrusion detection system corresponding to the target vehicle by using the test script. Optionally, the converting the natural language information into the structured semantic representation information includes: If the natural language information is in a text format, denoising and word segmentation are carried out on the natural language information to obtain first information; processing the first information by utilizing an identification rule based on a preset keyword to obtain second information; processing the second information by using a large language model or a sequence labeling model to obtain third information; Normalizing the target value and the target unit in the third information to obtain fourth information; Checking the fourth information by using a preset semantic constraint condition, and determining structured semantic representation information based on the checked fourth information; If the natural language information is in a voice format, converting the natural language information in the voice format into the natural language information in the text format, and jumping to the step of denoising and word segmentation processing on the natural language