Charging pile communication test method and device and electronic equipment

By acquiring the communication parameters of the charging pile, determining the initial test message, and generating diverse and effective test messages through multiple iterations and transformations, the problem of insufficient test message diversity in charging pile communication testing is solved, thereby improving the comprehensiveness and security of charging pile communication testing.

CN121842031APending Publication Date: 2026-04-10STATE GRID BEIJING ELECTRIC POWER CO
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
STATE GRID BEIJING ELECTRIC POWER CO
Filing Date
2026-01-16
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

The lack of diversity in test messages during charging pile communication testing makes it difficult to cover potential security vulnerabilities.

Method used

By acquiring the communication parameters of the charging pile, multiple test messages are determined and processed iteratively multiple times, including target transformation operations and message updates, to generate test messages with diversity and effectiveness.

Benefits of technology

This improves the comprehensiveness and security of charging pile communication testing, ensuring that testing covers multiple scenarios and accurately targets potential security vulnerabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121842031A_ABST
    Figure CN121842031A_ABST
Patent Text Reader

Abstract

The invention discloses a charging pile communication test method and device and electronic equipment. The method comprises the following steps: acquiring communication parameters of a charging pile; determining a plurality of test messages according to the communication parameters; according to an execution sequence of performing multiple iterations on the multiple test messages, performing any iteration in the multiple iterations on the multiple test messages, and determining multiple reference messages from the multiple test messages under the any iteration; executing a target operation on the plurality of reference messages to obtain a plurality of target messages; and according to the plurality of target messages, updating the plurality of test messages to obtain a plurality of test messages after any iteration update until multiple iteration processing is completed, and obtaining a plurality of test messages after target iteration update. According to the method and the device, the technical problem that the communication test of the charging pile is difficult to cover potential security holes due to insufficient diversity of the generated test message when the communication test is carried out on the charging pile in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of charging piles, and more specifically, to a charging pile communication testing method, apparatus, and electronic device. Background Technology

[0002] In related technologies, charging piles, as core equipment for replenishing the power supply of electric vehicles, need to frequently interact with external devices such as onboard systems (e.g., reporting charging status, receiving start / stop commands, and transmitting billing information). The stability and security of their communication directly affect the reliability of the charging process; therefore, communication testing of charging piles is necessary. However, a technical problem exists in communication testing of charging piles: insufficient diversity of generated test messages makes it difficult to cover potential security vulnerabilities.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This invention provides a charging pile communication testing method, apparatus, and electronic device to at least solve the technical problem in the related art where the diversity of generated test messages is insufficient when conducting communication tests on charging piles, making it difficult to cover potential security vulnerabilities in the communication tests.

[0005] According to one aspect of the present invention, a method for testing communication of a charging pile is provided, comprising: acquiring communication parameters of the charging pile; determining a plurality of test messages corresponding to the charging pile based on the communication parameters; performing any one iteration of the plurality of test messages in a sequence of multiple iterations, and determining a plurality of reference messages in the plurality of test messages in the any one iteration; performing a target operation on the plurality of reference messages in the any one iteration to obtain a plurality of target messages in the any one iteration, wherein the target operation includes a target transformation operation, the target transformation operation being used to transform target fields in the plurality of reference messages respectively; updating the plurality of test messages based on the plurality of target messages in the any one iteration to obtain a plurality of test messages updated in the any one iteration, until the multiple iterations are completed, and obtaining a plurality of test messages updated in the next target iteration, for testing communication of the charging pile.

[0006] Optionally, performing a target operation on multiple reference messages in any iteration to obtain multiple target messages in any iteration includes: when the target transformation operation includes a first transformation operation and a second transformation operation, and the target field includes a first field and a second field, performing a first transformation operation on the first field corresponding to each of the multiple reference messages to obtain multiple first transformed messages, wherein the length of the first field is greater than the length of the second field, and the multiple first transformed messages correspond one-to-one with the multiple reference messages; determining a predetermined number of messages to be transformed from the multiple first transformed messages; performing a second transformation operation on the second field corresponding to each of the predetermined number of messages to be transformed to obtain the predetermined number of second transformed messages; and determining the multiple target messages in any iteration based on the other first transformed messages in the multiple first transformed messages besides the predetermined number of messages to be transformed, and the predetermined number of second transformed messages.

[0007] Optionally, performing a first transformation operation on the first fields corresponding to the plurality of reference messages to obtain a plurality of first transformed messages includes: determining a plurality of message pairs based on the plurality of reference messages; for any target message pair among the plurality of message pairs, swapping the first fields corresponding to the two reference messages in the target message pair to obtain the first transformed messages corresponding to the two reference messages in the target message pair; and determining the first transformed messages corresponding to the two reference messages of other message pairs besides the target message pair by using the method of obtaining the first transformed messages corresponding to the two reference messages in the target message pair.

[0008] Optionally, the step of performing a second transformation operation on the second fields corresponding to the predetermined number of messages to be transformed to obtain the predetermined number of second transformed messages includes: determining the transformation interval parameters of the second fields corresponding to the predetermined number of messages to be transformed; and performing transformation processing on the second fields corresponding to the predetermined number of messages to be transformed according to the transformation interval parameters of the second fields corresponding to the predetermined number of messages to be transformed to obtain the predetermined number of second transformed messages.

[0009] Optionally, updating the plurality of test packets based on the plurality of target packets in any iteration to obtain the plurality of test packets updated in any iteration includes: determining the packet selection index corresponding to each of the plurality of target packets in any iteration; determining the total selection index in any iteration based on the packet selection index corresponding to each of the plurality of target packets in any iteration; selecting target replacement packets with a target difference of a certain number from the plurality of target packets in any iteration based on the packet selection index corresponding to each of the plurality of target packets in any iteration and the total selection index in any iteration, wherein the target difference of a certain number is determined based on the difference between the number of packets corresponding to the plurality of test packets and the number of packets corresponding to the plurality of target packets in any iteration; updating the plurality of test packets based on the target replacement packets with a target difference of a certain number and the plurality of target packets in any iteration to obtain the plurality of test packets updated in any iteration.

[0010] Optionally, the step of selecting target replacement messages with a target difference of a certain number from the multiple target messages in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration and the total selection index in any iteration includes: selecting first replacement messages with a first difference of a certain number from the multiple target messages in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration, wherein the first difference of a certain number is less than or equal to the target difference of a certain number; based on The message selection index corresponding to the multiple target messages in any iteration, and the total selection index in any iteration, are used to filter out the second complement messages with a second number of differences from the multiple target messages in any iteration. The second number of differences is determined based on the difference between the target number of differences and the first number of differences. The target complement messages with a target number of differences are determined based on the first complement messages with a first number of differences in any iteration and the second complement messages with a second number of differences in any iteration.

[0011] Optionally, determining multiple reference messages from multiple test messages in any given iteration includes: determining test parameters corresponding to the charging pile; determining similarity indices corresponding to the multiple test messages in any given iteration; and determining multiple reference messages in any given iteration based on the similarity indices corresponding to the multiple test messages in any given iteration, wherein the corresponding similarity index represents the degree of similarity between the corresponding test message and a predetermined message, the predetermined message is determined based on the test parameters, and the multiple reference messages are test messages among the multiple test messages whose similarity indices are greater than or equal to a similarity threshold.

[0012] According to one aspect of the present invention, a charging pile communication testing device is provided, comprising: an acquisition module for acquiring communication parameters of a charging pile; a first determination module for determining a plurality of test messages corresponding to the charging pile based on the communication parameters; a second determination module for performing any one of the multiple iterations on the plurality of test messages in an execution order of multiple iterations, and determining a plurality of reference messages in the multiple test messages in the multiple iterations; a third determination module for performing a target operation on the multiple reference messages in the multiple iterations to obtain a plurality of target messages in the multiple iterations, wherein the target operation includes a target transformation operation, and the target transformation operation is used to transform target fields in the plurality of reference messages respectively; and a fourth determination module for updating the plurality of test messages based on the multiple target messages in the multiple iterations to obtain a plurality of test messages updated in the multiple iterations, until the multiple iterations are completed, to obtain a plurality of test messages updated in the next target iteration, for communication testing of the charging pile.

[0013] According to one aspect of the present invention, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the charging pile communication testing method described in any of the preceding embodiments.

[0014] According to one aspect of the present invention, a computer-readable storage medium is provided, comprising: when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enabling the electronic device to perform the charging pile communication testing method described above.

[0015] In this embodiment of the invention, communication parameters of the charging pile are obtained; based on the communication parameters, multiple test messages corresponding to the charging pile are determined; according to the execution order of multiple iterations of the multiple test messages, any one iteration of the multiple iterations is performed on the multiple test messages, and multiple reference messages of any one iteration are determined from the multiple test messages of any one iteration; target operations are performed on the multiple reference messages of any one iteration to obtain multiple target messages of any one iteration, wherein the target operation includes a target transformation operation, which is used to transform the target fields in the multiple reference messages respectively; based on the multiple target messages of any one iteration, the multiple test messages are updated to obtain multiple test messages updated after any one iteration, until the multiple iterations are completed to obtain multiple test messages updated after the next target iteration, so as to perform communication testing on the charging pile. By acquiring the communication parameters of the charging pile and determining the initial test message accordingly, basic data conforming to the protocol specifications is provided for subsequent tests, avoiding invalid tests due to inconsistent message formats. Based on this, multiple reference messages are selected from multiple test messages in any iteration, allowing for optimization of high-quality messages (such as messages with high vulnerability triggering potential), reducing invalid calculations, and performing target operations on the target fields of the reference messages to generate diverse target messages, breaking through the limitation of a single message type. The test messages are then updated with the target messages, and the above iterative cycle is repeated to finally obtain test messages that combine diversity and effectiveness. This ensures that the test covers multiple scenarios of charging pile communication and accurately targets potential security vulnerabilities, effectively solving the problem of insufficient diversity of test messages and difficulty in covering potential vulnerabilities in related technologies. This improves the comprehensiveness and security of charging pile communication testing, and thus solves the technical problem in related technologies where the generated test messages lack diversity, making it difficult to cover potential security vulnerabilities in the communication testing of charging piles. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0017] Figure 1 This is a flowchart of a charging pile communication testing method according to an embodiment of the present invention;

[0018] Figure 2 This is a flowchart of a conventional genetic algorithm in an optional embodiment of the present invention;

[0019] Figure 3 This is a schematic diagram of a system model for generating test cases based on a genetic algorithm in an optional embodiment of the present invention;

[0020] Figure 4This is a schematic diagram of the intersection of two points in an optional embodiment of the present invention;

[0021] Figure 5 This is a structural block diagram of a charging pile communication testing device according to an embodiment of the present invention. Detailed Implementation

[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0024] Example 1

[0025] According to an embodiment of the present invention, an embodiment of a charging pile communication testing method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0026] Figure 1 This is a flowchart of a charging pile communication testing method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:

[0027] S102, obtain the communication parameters of the charging pile.

[0028] In step S102 of this application, the communication parameters of the charging pile are obtained.

[0029] This includes charging stations, which are devices that provide power to electric vehicles.

[0030] This involves communication parameters, which are the communication configurations and protocols used when the charging pile interacts with external devices (such as vehicle systems).

[0031] Communication parameters reflect the core technical specifications that the charging pile must follow when interacting with external devices (such as vehicle systems). By obtaining communication parameters, it can be ensured that the multiple test messages determined by them in subsequent steps conform to the actual communication logic and technical requirements of the charging pile, thus avoiding invalid tests due to mismatch between test messages and the charging pile's communication standards.

[0032] S104: Based on the communication parameters, determine multiple test messages corresponding to the charging pile.

[0033] In step S104 of this application, multiple test messages corresponding to the charging pile are determined based on communication parameters.

[0034] This involves multiple test messages, which are test cases used to test the communication function of the charging pile, i.e., test data.

[0035] Using communication parameters as a compliance benchmark, we ensure that the generated test cases can accurately match the actual communication logic of the charging pile (such as communication protocols, data interaction rules, etc.), avoiding subsequent test failures due to incompatibility between test data and charging pile communication standards. Furthermore, by generating multiple sets of test cases, we provide an initial foundation for subsequent iterations and optimizations.

[0036] S106, according to the execution order of multiple iterations of multiple test messages, perform any one of the multiple iterations of multiple test messages, and determine multiple reference messages in any one iteration from the multiple test messages in any one iteration.

[0037] In step S106 provided in this application, the execution order of multiple iterations of multiple test messages is followed. For any one iteration of multiple iterations of multiple test messages, multiple reference messages of any one iteration are determined from the multiple test messages of any one iteration.

[0038] This involves multiple iterations, which are processes of repeatedly processing the test packets. Each iteration builds upon the results of the previous iteration, progressively optimizing the test packets to improve test coverage and effectiveness. The goal of these multiple iterations is to generate test cases that cover more potential vulnerabilities through gradual adjustment and optimization of the test packets.

[0039] This involves any iteration, which is any specific iteration operation within a multi-iteration process. Each iteration has its specific input (test message) and output (optimized test message). The goal of any iteration is to select messages with higher testing value from the current test messages as the basis for the next operation.

[0040] This involves multiple reference messages, which are test messages with higher testing value selected from the current multiple test messages in any iteration. These multiple reference messages can be test messages whose similarity index is greater than or equal to the similarity threshold among the multiple test messages.

[0041] By iterating through multiple test messages in the order of execution, multiple reference messages can be identified from the test messages in any iteration. This allows for a gradual focus on messages that are more likely to trigger potential vulnerabilities or cover more communication scenarios. This avoids performing subsequent operations on invalid or low-value messages, thereby reducing redundant calculations and improving the efficiency and effectiveness of the test. It also ensures that the charging pile communication test can more comprehensively cover potential security issues.

[0042] S108, Perform target operations on multiple reference messages in any iteration to obtain multiple target messages in any iteration. The target operations include target transformation operations, which are used to transform the target fields in the multiple reference messages respectively.

[0043] In step S108 provided in this application, target operations are performed on multiple reference messages under any iteration to obtain multiple target messages under any iteration.

[0044] This involves target operations, which are used to modify and adjust reference messages to increase message diversity and make them more suitable for charging pile communication testing. These target operations include target transformation operations.

[0045] This involves target transformation operations, which are used to transform target fields in reference messages, thereby increasing the diversity and coverage of test messages.

[0046] By transforming the target fields in the reference message, the limitation of the initial single test message type can be effectively broken, thereby increasing the diversity and coverage of the test messages. This allows the generated target messages to more comprehensively simulate different data interaction scenarios in the charging pile communication scenario, providing a diverse and adaptable message foundation for subsequent iterative updates of test messages and accurate coverage of potential security vulnerabilities in charging pile communication.

[0047] S110: Based on multiple target messages in any iteration, update multiple test messages to obtain multiple test messages updated in any iteration, until multiple iterations are completed, and obtain multiple test messages updated in the next target iteration, so as to perform communication tests on the charging pile.

[0048] In step S110 of this application, multiple test messages are updated based on multiple target messages under any iteration to obtain multiple test messages updated after any iteration, until multiple iterations are completed to obtain multiple test messages updated after the target iteration, so as to perform communication testing on the charging pile.

[0049] This involves multiple test messages updated in any given iteration. These updated test messages are target messages generated by performing target operations (such as target transformation operations) on reference messages in any iteration of the multiple iteration process, and are used to replace or supplement the original set of test messages. These updated test messages have been optimized and adjusted, have higher testing value and diversity, and can better cover various scenarios of charging pile communication.

[0050] This involves multiple test messages updated in the target iteration. These test messages are the final set of test messages obtained after multiple iterations of processing. These test messages have undergone multiple rounds of optimization and adjustment, possessing the highest testing value and diversity, and comprehensively covering various scenarios and potential vulnerabilities in charging pile communication. These messages will be used in the final charging pile communication test to ensure the comprehensiveness and effectiveness of the test.

[0051] After multiple iterations, the final target iteration update results in multiple test messages, which combine the cumulative optimization effects of target operations and message updates in each iteration. They have stronger diversity and scenario coverage capabilities, and can comprehensively simulate various data interaction situations in the charging pile communication process. This can effectively solve the problems of insufficient test message diversity and difficulty in covering vulnerabilities in related technologies.

[0052] Through the above steps S102-S110, the communication parameters of the charging pile are obtained; based on the communication parameters, multiple test messages corresponding to the charging pile are determined; according to the execution order of multiple iterations of the multiple test messages, any one of the multiple iterations is performed on the multiple test messages, and multiple reference messages are determined from the multiple test messages in any one iteration; target operations are performed on the multiple reference messages in any one iteration to obtain multiple target messages in any one iteration, wherein the target operations include target transformation operations, which are used to transform the target fields in the multiple reference messages respectively; based on the multiple target messages in any one iteration, the multiple test messages are updated to obtain multiple test messages updated in any one iteration, until the multiple iterations are completed, and multiple test messages updated in the next target iteration are obtained to perform communication testing on the charging pile. By acquiring the communication parameters of the charging pile and determining the initial test message accordingly, basic data conforming to the protocol specifications is provided for subsequent tests, avoiding invalid tests due to inconsistent message formats. Based on this, multiple reference messages are selected from multiple test messages in any iteration, allowing for optimization of high-quality messages (such as messages with high vulnerability triggering potential), reducing invalid calculations, and performing target operations on the target fields of the reference messages to generate diverse target messages, breaking through the limitation of a single message type. The test messages are then updated with the target messages, and the above iterative cycle is repeated to finally obtain test messages that combine diversity and effectiveness. This ensures that the test covers multiple scenarios of charging pile communication and accurately targets potential security vulnerabilities, effectively solving the problem of insufficient diversity of test messages and difficulty in covering potential vulnerabilities in related technologies. This improves the comprehensiveness and security of charging pile communication testing, and thus solves the technical problem in related technologies where the generated test messages lack diversity, making it difficult to cover potential security vulnerabilities in the communication testing of charging piles.

[0053] As an optional embodiment, performing a target operation on multiple reference messages in any iteration to obtain multiple target messages in any iteration includes: when the target transformation operation includes a first transformation operation and a second transformation operation, and the target field includes a first field and a second field, performing a first transformation operation on the first field corresponding to each of the multiple reference messages to obtain multiple first transformed messages, wherein the length of the first field is greater than the length of the second field, and the multiple first transformed messages correspond one-to-one with the multiple reference messages; determining a predetermined number of messages to be transformed from the multiple first transformed messages; performing a second transformation operation on the second field corresponding to each of the predetermined number of messages to be transformed to obtain a predetermined number of second transformed messages; and determining the multiple target messages in any iteration based on the other first transformed messages in the multiple first transformed messages excluding the predetermined number of messages to be transformed, and the predetermined number of second transformed messages.

[0054] This embodiment describes the specific steps for performing target operations on multiple reference messages in any iteration to obtain multiple target messages in any iteration.

[0055] This involves a first transformation operation, which is a transformation process performed on the first field in the reference message. This first transformation operation can be an interleaving operation.

[0056] This involves a second transformation operation, which is a further transformation of the second field in the message after the first transformation operation. This second transformation operation supplements or refines the result of the first transformation operation, increasing the diversity and coverage of the test messages. This second transformation operation can be a mutation operation.

[0057] This involves the first field, which is a field in the reference message that does not include fixed format identifiers, message type markers, or other information related to communication validity conditions.

[0058] This involves a second field, which is also a field in the reference message that does not include fixed format identifiers, message type markers, or other information related to communication validity conditions. However, the length of the second field is shorter than the length of the first field.

[0059] This involves a first transformed message, which is a message generated after a first transformation operation. It is obtained by transforming the first field of a reference message. There is a one-to-one correspondence between the first transformed message and the reference message; that is, a corresponding first transformed message is generated for each reference message.

[0060] This involves a predetermined number of messages, which is a pre-set number of messages among multiple first-transformation messages that require the second-transformation operation. This number can be determined based on testing requirements and resource constraints, and is used to control the scope of the second-transformation operation.

[0061] This involves messages to be transformed, which are messages selected from multiple first-transformed messages that require a second transformation operation.

[0062] This involves a second transformed message, which is a message generated after a second transformation operation. These messages are obtained by transforming the second field of the message to be transformed. That is, a corresponding second transformed message is generated for each message to be transformed.

[0063] When the target transformation operation includes a first transformation operation (such as a crossover operation) and a second transformation operation (such as a mutation operation), and the target field includes a first field (longer in length, without communication validity condition information) and a second field (shorter in length, without communication validity condition information), a one-to-one corresponding first transformation message is generated by performing a first transformation operation on the first field of multiple reference messages. A predetermined number of messages to be transformed are determined from these, and a second transformation operation is performed on their second fields to obtain second transformation messages. Finally, the target message is determined by combining the remaining first transformation messages and second transformation messages. With a hierarchical and differentiated transformation strategy (first performing basic transformation on long fields, and then performing supplementary transformation on short fields of some messages), the core features of the message are adjusted through the first transformation operation, and the differences of the message are further refined within a controllable range (controlled by a predetermined number) by the second transformation operation, without violating the communication validity condition. This dually improves the diversity and coverage of the test messages, while balancing transformation efficiency and test requirements, and provides a richer test foundation that is adapted to the charging pile communication test scenario for subsequent iterations and updates.

[0064] Specifically, by splitting the target transformation operation into a first transformation operation (such as crossover) for long fields (first field) and a second transformation operation (such as mutation) for short fields (second field), the first transformation operation is first performed on the first field of all reference messages to generate a basic first transformation message, ensuring the effective recombination and transmission of high-quality long field features. Then, a predetermined number of first transformation messages are selected to perform the second transformation operation, making local fine-tuning of the short fields to supplement niche features, while retaining the remaining unmutated first transformation messages to maintain a high-quality foundation. Finally, the two types of messages are combined to form the target message. This achieves a large-scale improvement in diversity through long field crossover and accurately supplements detailed differences through local mutation of short fields, avoiding feature destruction or insufficient diversity caused by a single transformation. This effectively ensures that the target message has compliance, diversity, and high vulnerability triggering potential, providing a rich data foundation for subsequent iterative updates of test messages and improving the coverage of charging pile communication tests.

[0065] As an optional embodiment, a first transformation operation is performed on the first fields corresponding to multiple reference messages to obtain multiple first transformed messages, including: determining multiple message pairs based on the multiple reference messages; for any target message pair in the multiple message pairs, swapping the first fields corresponding to the two reference messages in the target message pair to obtain the first transformed messages corresponding to the two reference messages in the target message pair; and determining the first transformed messages corresponding to the two reference messages of other message pairs besides the target message pairs by using the method of obtaining the first transformed messages corresponding to the two reference messages in the target message pair.

[0066] This embodiment describes the specific steps of performing a first transformation operation on the first field corresponding to multiple reference messages to obtain multiple first transformed messages.

[0067] This involves multiple message pairs, which are combinations of multiple reference messages paired together. Each message pair contains two reference messages, and these message pairs are used for subsequent exchange processing.

[0068] This involves a target message pair, which is the message pair currently undergoing the first transformation operation among multiple message pairs.

[0069] This involves a swapping process, which involves exchanging the first fields of the two reference messages in a message pair. Specifically, the first field of one message is swapped with the first field of another message, thereby generating two new message versions. The purpose of this swapping operation is to increase the diversity of test messages by combining fields from different messages to generate new test scenarios.

[0070] This involves other messages, which are messages in multiple message pairs other than the target message pair being processed. These messages also undergo swapping to generate corresponding first transformed messages. The processing method for other messages is the same as for the target message pair, ensuring that all message pairs undergo the same transformation operation.

[0071] By pairing reference messages and exchanging their first field (a long field excluding communication validity information), the core field features of different reference messages can be quickly combined without compromising the basic communication validity and quality characteristics of the messages, thereby increasing the diversity of test messages.

[0072] As an optional embodiment, a second transformation operation is performed on the second fields corresponding to a predetermined number of messages to be transformed to obtain a predetermined number of second transformed messages, including: determining the transformation interval parameters of the second fields corresponding to the predetermined number of messages to be transformed; and performing transformation processing on the second fields corresponding to the predetermined number of messages to be transformed according to the transformation interval parameters of the second fields corresponding to the predetermined number of messages to be transformed to obtain a predetermined number of second transformed messages.

[0073] This embodiment describes the specific steps of performing a second transformation operation on the second fields corresponding to a predetermined number of messages to be transformed, to obtain a predetermined number of second transformed messages.

[0074] This involves transformation interval parameters, which define the range or conditions for transformation when performing transformation operations on the second field. These parameters can be numerical ranges, data types, specific datasets, or other rules used to determine how to transform the second field. Specifically, transformation interval parameters can include the following types:

[0075] Numerical Range: The numerical range refers to the allowed range of values ​​when transforming the second field. For example, if the second field is a numeric field, the transformation interval parameter can be defined as a minimum and a maximum value. During the transformation operation, the new value will be randomly generated within this range or generated according to a certain rule.

[0076] Data type: The data type refers to the type of the second field, such as integer, floating-point number, string, etc. The transformation range parameter can specify that the transformed fields should maintain the same data type, or it can define how to convert a field from one type to another.

[0077] Transformed datasets (also known as malformed datasets): Transformed datasets refer to a predefined set of data used to replace or modify the value of the second field. For example, there could be a collection containing common vulnerability triggering data, which could be used to generate test messages that can trigger specific vulnerabilities.

[0078] By specifying the transformation range parameters of the second field of the message to be transformed, it is possible to ensure that the transformed second field not only meets the requirements of the test scenario, but also improves the difference in message details in a targeted manner. This avoids invalid messages caused by irregular transformations and enhances the ability to trigger potential vulnerabilities in charging piles.

[0079] Specifically, the second transformation operation supplements the diversity of details in the second field (such as fine-tuning specific binary bits to explore potential vulnerability scenarios), and avoids the problem of invalid messages caused by transformations exceeding the protocol's allowed range by using transformation range parameters. This ensures the compliance and availability of the second transformed message, further supporting the diversity and practicality of the target message, and helping to improve the accuracy and reliability of charging pile communication testing.

[0080] As an optional embodiment, multiple test messages are updated based on multiple target messages in any iteration to obtain multiple test messages updated in any iteration, including: determining the message selection index corresponding to each of the multiple target messages in any iteration; determining the total selection index in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration; selecting target replacement messages with a target difference of a certain number from the multiple target messages in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration and the total selection index in any iteration, wherein the target difference of a certain number is determined by the difference between the number of messages corresponding to the multiple test messages and the number of messages corresponding to the multiple target messages in any iteration; updating the multiple test messages based on the target replacement messages with a target difference of a certain number and the multiple target messages in any iteration to obtain multiple test messages updated in any iteration.

[0081] This embodiment describes the specific steps for updating multiple test packets based on multiple target packets in any iteration to obtain multiple test packets updated in any iteration.

[0082] This includes a message selection index, which is the probability or priority of each target message being selected in the current iteration.

[0083] This includes the total selection index, which is the sum of the message selection indices of all target messages.

[0084] This involves a target difference number, which represents the number of target packets that need to be added in the current iteration. This number is determined based on the difference between the total number of test packets and the number of target packets generated in the current iteration. Specifically, the target difference number is used to ensure that the number of test packets remains consistent after each iteration.

[0085] This involves target replacement messages, which are selected from target messages to supplement the test message set. The selection of these messages is based on a message selection index and a total selection index to ensure that the supplementary messages improve the test results.

[0086] By controlling the selection index of target messages and the total index, the selection of replacement messages is controlled. This ensures that the number of test messages remains stable after each iteration based on the number of target differences. By prioritizing the selection of high-value target messages as replacement messages, the overall quality and effectiveness of the test message set are improved while maintaining quantity consistency. This avoids the accumulation of invalid messages and continuously optimizes the coverage of test messages for charging pile communication scenarios and potential vulnerabilities.

[0087] Specifically, by quantitatively filtering and filling gaps, the number of target messages is matched to the initial size of the test messages, ensuring the stability of the population during iteration. This approach not only fills the quantity gaps with replacement messages but also ensures that the replacements are high-quality messages, preventing low-quality messages from contaminating the population and causing degradation. This achieves the dual goals of "meeting the quantity target and ensuring high quality" of test messages after iteration, providing stable and efficient foundational data for the next iteration and further guaranteeing the diversity and vulnerability triggering potential of charging pile communication test messages.

[0088] As an optional embodiment, based on the message selection index corresponding to each of the multiple target messages in any iteration, and the total selection index in any iteration, target replacement messages with a target difference number of times are selected from the multiple target messages in any iteration, including: selecting first replacement messages with a first difference number of times from the multiple target messages in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration, wherein the first difference number of times is less than or equal to the target difference number of times; selecting second replacement messages with a second difference number of times from the multiple target messages in any iteration based on the message selection index corresponding to each of the multiple target messages in any iteration, and the total selection index in any iteration, wherein the second difference number of times is determined based on the difference between the target difference number of times and the first difference number of times; and determining the target replacement messages with a target difference number of times based on the first replacement messages with the first difference number of times and the second replacement messages with the second difference number of times in any iteration.

[0089] This embodiment describes the specific steps for selecting target replacement messages with a target difference number from multiple target messages in any iteration, based on the message selection index corresponding to each of the multiple target messages in any iteration and the total selection index in any iteration.

[0090] This involves a first number of differences, which is the number of target padded messages initially selected in the current iteration. This number is a subset of the target number of differences and is less than or equal to the target number of differences.

[0091] This involves the first replacement message, which is the first batch of replacement messages selected from multiple target messages in the current iteration based on a message selection index. The selection of these messages is based on their message selection indices, typically choosing messages with higher indices to ensure that the replacement messages have a higher probability of triggering communication vulnerabilities. This first replacement message can be determined using an elite retention strategy.

[0092] This involves a second number of differences, which represents the number of remaining target padding messages that need to be added in the current iteration. This number is the difference between the target number of differences and the first number of differences. It is used to ensure that enough messages are added during the filtering process to meet the target number of differences.

[0093] This involves a second supplementary message, which is a second supplementary message selected from multiple target messages based on a message selection index and a total selection index. This second supplementary message can be determined using a proportional selection method.

[0094] By locking in high-probability vulnerability-triggered high-quality messages with the first padding message, the core quality of the padding message is ensured. At the same time, the remaining number of messages are supplemented by the second padding message. This balances the randomness of message selection with the overall quantity requirements, avoids the loss of high-quality messages, and balances the quality and diversity of test messages. This provides accurate and comprehensive padding support for subsequent updates to test messages and improving the effectiveness of charging pile communication testing.

[0095] In other words, the first replacement message selected in the first stage ensures that core high-quality messages are prioritized for replacement, while the second replacement message selected in the second stage balances the randomness and quality of replacement, avoiding the problem of high-quality messages being missed or uneven replacement quality caused by a single selection method.

[0096] As an optional embodiment, determining multiple reference messages from multiple test messages in any iteration includes: determining test parameters corresponding to the charging pile; determining the similarity index corresponding to each of the multiple test messages in any iteration; and determining multiple reference messages in any iteration based on the similarity index corresponding to each of the multiple test messages in any iteration. The corresponding similarity index represents the degree of similarity between the corresponding test message and a predetermined message. The predetermined message is determined based on the test parameters, and the multiple reference messages are test messages among the multiple test messages whose similarity index is greater than or equal to a similarity threshold.

[0097] This embodiment describes the specific steps for determining multiple reference messages in any given iteration from multiple test messages in any given iteration.

[0098] This involves test parameters, which are related to the communication testing of charging piles. These parameters define the scope, objectives, and conditions of the test. Test parameters may include the communication protocol of the charging pile, the test scenario, the expected response time, and the data format.

[0099] This includes a similarity index, which measures the degree of similarity between test messages and planned messages. The higher the similarity index, the more similar the test message and the planned message are.

[0100] This involves a similarity threshold, a preset value used to determine which test messages can be selected as reference messages. It represents the minimum level of similarity that a test message must achieve with a predetermined message. Only test messages with a similarity index greater than or equal to the similarity threshold will be selected as reference messages.

[0101] The test direction is defined based on test parameters. The matching degree between test messages and predetermined messages is quantified by similarity index. By using similarity threshold, messages that are more in line with the test objectives and have higher test value are accurately selected as reference messages. This avoids wasting resources on low-value messages in subsequent target operations, while ensuring that the reference messages meet the needs of the test scenario. This provides a data foundation for improving the diversity of test messages and covering potential vulnerabilities in the future.

[0102] Specifically, by defining the filtering direction through test parameters and quantifying message quality through similarity index, low-quality test messages are eliminated to avoid wasting resources on invalid messages in subsequent operations. At the same time, it ensures that the reference messages are highly consistent with the target test scenarios (such as potential vulnerability scenarios), laying a high-quality foundation for generating diverse and efficient target messages in the future, and further improving the accuracy and efficiency of charging pile communication testing.

[0103] Based on the above embodiments and optional embodiments, an optional implementation method is provided, which is described in detail below.

[0104] In related technologies, charging piles, as core equipment for replenishing the power supply of electric vehicles, need to frequently interact with external devices such as onboard systems (e.g., reporting charging status, receiving start / stop commands, and transmitting billing information). The stability and security of their communication directly affect the reliability of the charging process; therefore, communication testing of charging piles is necessary. However, a technical problem exists in communication testing of charging piles: insufficient diversity of generated test messages makes it difficult to cover potential security vulnerabilities.

[0105] There is currently no effective solution to the above problems.

[0106] In view of this, an optional embodiment of the present invention provides a charging pile communication testing method, which can effectively solve the above-mentioned technical problems.

[0107] Using a genetic algorithm to generate multiple test messages as an example.

[0108] Figure 2 This is a flowchart of a traditional genetic algorithm in an optional embodiment of the present invention, such as... Figure 2As shown, genetic algorithms, as an adaptive search technique, solve optimization problems by mimicking the process of biological evolution. The objects of genetic algorithms are chromosomes, which are strings of numbers. Each number in the string is called a gene, and a combination of chromosomes constitutes a population. Each chromosome has a fitness level that determines the probability of survival in the next generation. After the next generation is produced, some chromosomes crossover, while a small number of genes mutate.

[0109] The basic genetic algorithm is as follows:

[0110] 1) Generate a random initial population.

[0111] 2) Calculate the fitness of each member of the population.

[0112] 3) When the optimal chromosome (high fitness) is below a certain threshold or the number of generations is below a certain given value:

[0113] This leads to a new generation of population members with higher and more adapted survival probabilities.

[0114] Some population members perform crossover operations to produce two new members;

[0115] A small number of genes undergo mutation operations;

[0116] Recalculate the population fitness.

[0117] 4) The algorithm ends. A chromosome may have a low fitness, but it can generate a new population with high fitness through crossover with other chromosomes or self-mutation.

[0118] Traditional genetic algorithms tend to converge during iteration, leading to similar generated test cases and affecting fuzz testing performance. Therefore, appropriate improvements to the genetic algorithm are necessary. Compared to traditional genetic algorithms, this study improves the genetic algorithm in terms of fitness function design, selection of crossover and mutation operations, and initial test case construction to enhance the quality of test cases.

[0119] Figure 3 This is a schematic diagram of a system model generated based on test cases using a genetic algorithm in an optional embodiment of the present invention, such as... Figure 3 As shown, the model can be divided into two parts: the algorithm execution part and the algorithm evaluation part.

[0120] The algorithm execution part is the core of the system. It randomly generates the first generation population, then maps the individual bit strings in the population into actual parameter values ​​according to the encoding method of the input parameters, and passes them to the program under test to drive the program under test to run.

[0121] The algorithm evaluation part mainly uses program instrumentation technology to insert an evaluation function at the source code level of the program under test to evaluate the current input parameter values, and then returns the evaluation function value to the genetic algorithm.

[0122] The algorithm execution part evaluates the quality of each individual bit string in the population based on this, and changes the structure of the individual bit string through the operation of genetic operators (selection, crossover, mutation) to form a new generation of better population. This process is repeated until the target parameter value covering the selected path is found.

[0123] Genetic algorithms possess both global and local search capabilities because they achieve this through constructed fitness functions and genetic operations. However, while genetic algorithms can achieve equilibrium search and perform well in solving many complex problems, they often suffer from premature convergence or non-convergence. The reasons for premature convergence in genetic algorithms can be summarized in the following three aspects:

[0124] 1) The encoding is not standardized and the encoding is inaccurate.

[0125] If the encoding is not standardized, the optimal solution cannot be represented by the encoding, and no matter how much optimization is sought, the global optimal solution cannot be found.

[0126] 2) Fitness function.

[0127] The design of the fitness function cannot guide the evolutionary direction of an individual, or the fitness function cannot reflect the domain of the optimal individual.

[0128] 3) Probability of mutation.

[0129] When an individual's average fitness value is relatively high, a high mutation probability can easily lead to the destruction of effective genes and a decrease in fitness value. When an individual's average fitness value is relatively low, a low mutation probability can cause the fitness value to stagnate, resulting in premature convergence.

[0130] This, in turn, leads to insufficient diversity in the generated test messages, making it difficult to cover potential security vulnerabilities in communication tests of charging piles. The following section describes these technical issues in detail.

[0131] S1, obtain the communication parameters of the charging pile;

[0132] S2, based on communication parameters, determines multiple test messages corresponding to the charging pile;

[0133] Furthermore, based on communication parameters, multiple test messages corresponding to the charging pile are determined, including:

[0134] Based on communication parameters, multiple initial messages corresponding to the charging pile are determined. These initial messages include fixed fields and target fields. The fixed fields are those in the corresponding initial messages that do not undergo target operations, meaning they cannot be changed. The target fields include a first field and a second field, which are used to perform target operations on the initial messages. The fixed fields and target fields corresponding to the multiple initial messages are encoded accordingly to obtain multiple test messages corresponding to the charging pile. The encoding process is used to distinguish between the fixed fields and target fields in the corresponding initial messages to enhance their distinguishability.

[0135] This encoding process can employ a character encoding strategy based on a basic genetic algorithm, as follows:

[0136] By directly encoding the data, the various fields (including fixed and target fields) of the chromosome (same as the initial message above) become more intuitive. This facilitates genetic operations on the variable data segments of the data packet (same as the target field above), reduces the overall computational load, and does not damage the fixed fields. The final chromosome (same as the multiple test messages above) also requires no decoding and can be directly used as a message.

[0137] If the encoding is not standardized, the optimal solution cannot be represented by the encoding, and no matter how much optimization is sought, the global optimal solution cannot be found. By performing character encoding operations, the problems of non-standard encoding and inaccurate encoding representation can be effectively avoided. Furthermore, by performing character encoding operations on the data (similar to the multiple initial messages mentioned above), the final chromosome does not require decoding operations, thereby helping to reduce the computational workload of genetic operations.

[0138] S3, according to the execution order of multiple iterations of multiple test messages, perform any one of the multiple iterations of multiple test messages, and determine multiple reference messages in any one iteration from the multiple test messages in any one iteration;

[0139] Specifically, S3 includes:

[0140] The test parameters corresponding to the charging pile are determined; the similarity index corresponding to multiple test messages in any iteration is determined; based on the similarity index corresponding to multiple test messages in any iteration, multiple reference messages in any iteration are determined. The corresponding similarity index represents the degree of similarity between the corresponding test message and a predetermined message. The predetermined message is determined based on the test parameters, and the multiple reference messages are test messages whose similarity index is greater than or equal to a similarity threshold. This can be implemented using a fitness function, as follows:

[0141] Regarding fitness functions, the design of fitness functions in related technologies often fails to guide the evolutionary direction of individuals (i.e., test messages), or the fitness function does not reflect the optimal individual's domain. However, the fitness function influences the adaptive process in genetic algorithms. It can be used not only to evaluate the quality of the current test case and adjust the algorithm's adaptive direction, but also to link the genetic algorithm with the test case (i.e., test message) generation problem. Optimizing the fitness function can improve the algorithm's performance, thereby generating more effective test cases. Therefore, constructing an appropriate fitness function is crucial.

[0142] A fitness function is constructed based on the similarity between the current use case (i.e., the test message) and the abnormal message (i.e., the scheduled message). Specifically, the similarity between the current use case (i.e., the test message) and the abnormal message (i.e., the scheduled message) is evaluated based on the number of identical bits between the two use cases. If the value is greater than the population average similarity (i.e., the similarity threshold), then subsequent operations are performed on the current message (i.e., the test message).

[0143] Specifically, the abnormal message (i.e., the scheduled message) is recorded as... The message bit length is The generated first Example of a message: (That is, the first) (test message), variables express and The If the positions are equal, then... The value is 1 if it is 1, otherwise it is 0.

[0144] Each bit of the test message and the scheduled message needs to be compared; a total of [number] comparisons are required. Variables Record and The number of identical digits, Indicates comparison up to the th The number of identical bits at position 1. Let the number of identical bits at position 2 be denoted as _____. message With abnormal messages The similarity (i.e., the similarity index) is The formula is as follows:

[0145]

[0146] Let the total number of generated messages be (That is, the number of packets corresponding to multiple test packets), all packets and abnormal packets generated in one iteration. The average similarity is (That is, the similarity threshold), the formula is as follows:

[0147]

[0148] Selecting messages with a high degree of similarity to anomalous messages increases the likelihood of triggering anomalies. Therefore, the average similarity of all messages is calculated. Consider it as a reference fitness (same as the similarity threshold mentioned above), and compare it. and The similarity between the current message and the abnormal message determines whether to select a use case for the message. If the similarity between the current message and the abnormal message is greater than or equal to the average similarity, then... If the result is positive, the subsequent crossover and mutation operations will continue for that message; otherwise, the message will be discarded. Thus, based on the similarity indices corresponding to the multiple test messages in any given iteration, multiple reference messages in any given iteration will be obtained for subsequent crossover and mutation operations.

[0149] This fitness function based on message similarity has low time complexity. Compared to general methods The time complexity is in When the size is large, the computational efficiency will be greatly improved. Among them, This represents the algorithm's execution time relative to the input size. It has a linear proportional relationship, that is, linear time complexity. This represents the linear logarithmic time complexity of the algorithm.

[0150] Input size The number of test messages can be determined based on the number of messages corresponding to the test messages. It can be the total number of messages. .

[0151] S4, perform target operations on multiple reference messages in any iteration to obtain multiple target messages in any iteration. The target operations include target transformation operations, which are used to transform the target fields in the multiple reference messages respectively.

[0152] Specifically, S4 includes:

[0153] When the target transformation operation includes a first transformation operation and a second transformation operation, and the target field includes a first field and a second field, the first transformation operation is performed on the first field corresponding to the multiple reference messages respectively, resulting in multiple first transformation messages, wherein the length of the first field is greater than the length of the second field, and the multiple first transformation messages correspond one-to-one with the multiple reference messages; from the multiple first transformation messages, a predetermined number of messages to be transformed are determined; the second transformation operation is performed on the second field corresponding to the predetermined number of messages to be transformed respectively, resulting in a predetermined number of second transformation messages; based on the other first transformation messages in the multiple first transformation messages excluding the predetermined number of messages to be transformed, and the predetermined number of second transformation messages, multiple target messages in any iteration are determined.

[0154] Furthermore, a first transformation operation is performed on the first field corresponding to each of the multiple reference messages to obtain multiple first transformed messages, including:

[0155] Based on multiple reference messages, multiple message pairs are determined. For any target message pair among the multiple message pairs, the first fields corresponding to the two reference messages in the target message pair are swapped to obtain the first transformed messages corresponding to the two reference messages in the target message pair. Using the method of obtaining the first transformed messages corresponding to the two reference messages in the target message pair, the first transformed messages corresponding to the two reference messages of each of the other message pairs (excluding the target message pair) are determined. Specifically, this can be implemented in the following way:

[0156] The first transformation operation can be a crossover operation. Crossover strategies (i.e., crossover operations) include single-point crossover, two-point crossover, and uniform crossover. While single-point crossover is simple and easy to implement, it results in poor diversity of generated individuals. Two-point crossover is more random than single-point crossover, generating higher diversity of individuals, and can simultaneously preserve the superior genes of both the head and tail of the individual, passing them on to the next generation. Uniform crossover falls under the category of multi-point crossover; as the number of crossover points increases, the possibility of individual structure being disrupted increases, leading to a decrease in algorithm performance.

[0157] Figure 4 This is a schematic diagram of the intersection of two points in an optional embodiment of the present invention, such as... Figure 4As shown. In the case of a two-point crossover in the first transformation operation, two crossover points are randomly generated, and then a portion of the message segments are swapped. The randomization process uses the current time as a seed, which can also make the crossover point positions more random. Specifically, before the crossover, for any target message pair among multiple message pairs, there are message segment A and message segment B. Through crossover point 1 and crossover point 2, a crossover operation is performed on message segment A and message segment B. After the crossover, a portion of message segment A and message segment B are swapped, thus obtaining new message segments A and B.

[0158] Further, a second transformation operation is performed on the second field corresponding to a predetermined number of messages to be transformed, to obtain a predetermined number of second transformed messages, including:

[0159] Determine the transformation interval parameters of the second field corresponding to a predetermined number of messages to be transformed; based on the transformation interval parameters of the second field corresponding to the predetermined number of messages to be transformed, perform transformation processing on the second field corresponding to the predetermined number of messages to be transformed, to obtain the predetermined number of second transformed messages. This can be implemented in the following way:

[0160] The second transformation operation can be a mutation operation (i.e., a mutation strategy).

[0161] Mutation strategies include basic bit mutation, uniform mutation, and boundary mutation. Among these, the basic bit mutation strategy involves randomly selecting one bit from an individual data set and reversing it; this strategy is suitable for binary encoded data. If the original value is 0, the mutated value becomes 1; conversely, if the original value is 1, the mutated value becomes 0.

[0162] When an individual's average fitness value is relatively high, a high mutation probability can easily lead to the destruction of effective genes and a decrease in fitness value. When an individual's average fitness value is relatively low, a low mutation probability can cause the fitness value to stagnate, resulting in premature convergence.

[0163] Since CAN message data uses binary encoding, the second transformation operation can be a basic bit mutation strategy. The random process also uses the current time as a seed to increase the randomness of the mutation position.

[0164] Then, a two-point crossover and basic bit mutation strategy is performed on multiple reference messages in any iteration to obtain multiple target messages in any iteration.

[0165] When performing mutation operations, a malformed dataset is created (same as the transformation interval parameters mentioned above). That is, when mutating a test data, the original value is not replaced with a random value, but rather the data in the malformed dataset is used for mutation. The dataset collects some data combination types that can trigger common vulnerabilities during the vulnerability discovery process.

[0166] S5 updates multiple test messages based on multiple target messages in any iteration, obtaining multiple test messages updated in any iteration, until multiple iterations are completed, obtaining multiple test messages updated in the next target iteration, in order to perform communication tests on the charging pile.

[0167] Specifically, S5 includes:

[0168] Determine the message selection index corresponding to each of the multiple target messages in any given iteration; determine the total selection index for any given iteration based on the message selection index corresponding to each of the multiple target messages in any given iteration; based on the message selection index corresponding to each of the multiple target messages in any given iteration and the total selection index for any given iteration, select the target replacement messages with the target difference number from the multiple target messages in any given iteration, where the target difference number is determined by the difference between the number of messages corresponding to the multiple test messages and the number of messages corresponding to the multiple target messages in any given iteration; update the multiple test messages based on the target replacement messages with the target difference number and the multiple target messages in any given iteration, to obtain the updated multiple test messages for any given iteration. This can be achieved using a proportional selection method, as follows:

[0169] Let the sample size be... (That is, the number of messages corresponding to multiple target messages), the first The chromosome (i.e., the first chromosome) The target message is denoted as , The fitness of a chromosome (i.e., the message selection index) is denoted as... ,chromosome The cumulative function is:

[0170]

[0171] in:

[0172] for, ;

[0173] For the first Fitness of each chromosome;

[0174] For the first Fitness of each chromosome.

[0175] also, , By using formula It is confirmed that, among them, , The corresponding values ​​are equivalent to the left side of the formula. The corresponding value.

[0176] Specifically, when selecting new individuals using the proportional selection method, the steps are as follows:

[0177] Calculate the fitness of each chromosome in the population sequentially. The r-th chromosome can be obtained using the above formula. The cumulative fitness value .

[0178] remember Equal to 0, Equal to 1, chromosome The corresponding selection range is .

[0179] Each time a selection is made, a random number between 0 and 1 is generated. ,So The individual corresponding to the selected interval is selected as a member of the next generation, until the target difference number of target replacement messages are obtained.

[0180] Furthermore, based on the message selection index corresponding to each of the multiple target messages in any iteration, and the total selection index in any iteration, target replacement messages with the target difference number in any iteration are selected from the multiple target messages in any iteration, including:

[0181] Based on the message selection index corresponding to each of the multiple target messages in any iteration, the first replacement messages with a first number of differences are selected from the multiple target messages in any iteration, wherein the first number of differences is less than or equal to the target number of differences. Based on the message selection index corresponding to each of the multiple target messages in any iteration, and the total selection index in any iteration, the second replacement messages with a second number of differences are selected from the multiple target messages in any iteration, wherein the second number of differences is determined based on the difference between the target number of differences and the first number of differences. Based on the first replacement messages with the first number of differences in any iteration and the second replacement messages with the second number of differences in any iteration, the target replacement messages with the target number of differences are determined. Specifically, this can be achieved through an elite retention strategy.

[0182] By employing a combination of proportional selection and elite retention strategies to select from the population (multiple target messages), the algorithm aims to filter out target replacement messages with a target difference of a certain number in any given iteration, thereby enabling the algorithm to reach mature convergence.

[0183] The above optional implementation methods can achieve at least the following beneficial effects:

[0184] (1) Compared with related technologies, the present invention obtains the communication parameters of the charging pile and determines the initial test message accordingly, providing basic data that conforms to the protocol specifications for subsequent tests, avoiding invalid tests due to inconsistent message formats. Based on this, in any iteration, multiple reference messages are selected from multiple test messages in a multiple iteration order, which can focus on optimizing high-quality messages (such as messages with high vulnerability triggering potential), reducing invalid calculations, and performing target operations on the target fields of the reference messages to generate diverse target messages, breaking through the limitation of single message type. Then, the test messages are updated with target messages, and the above iterative cycle is repeated to finally obtain test messages that are both diverse and effective. This ensures that the test covers multiple scenarios of charging pile communication and can accurately reach potential security vulnerabilities, effectively solving the problem of insufficient diversity of test messages and difficulty in covering potential vulnerabilities in related technologies, improving the comprehensiveness and security of charging pile communication tests, and thus solving the technical problem in related technologies that when conducting communication tests on charging piles, the generated test messages are not diverse enough, making it difficult to cover potential security vulnerabilities in the communication tests of charging piles.

[0185] (2) Compared with related technologies, the present invention, in the case where the target transformation operation includes a first transformation operation (such as a cross operation) and a second transformation operation (such as a mutation operation), and the target field includes a first field (longer in length, without communication validity condition information) and a second field (shorter in length, without communication validity condition information), generates a one-to-one corresponding first transformation message by performing a first transformation operation on the first field of multiple reference messages, determines a predetermined number of messages to be transformed from them and performs a second transformation operation on their second field to obtain a second transformation message, and finally combines the remaining first transformation messages and second transformation messages to determine the target message. With a hierarchical and differentiated transformation strategy (first performing basic transformation on the long field, and then performing supplementary transformation on the short fields of some messages), under the premise of avoiding the destruction of communication validity conditions, it not only achieves the adjustment of the core features of the message through the first transformation operation, but also further refines the differences of the message within a controllable range (controlled by a predetermined number) by using the second transformation operation, thus doubly improving the diversity and coverage of the test message, while balancing transformation efficiency and test requirements, and providing a richer and more adaptable test foundation for subsequent iterative updates in the charging pile communication test scenario.

[0186] (3) Compared with related technologies, the present invention controls the screening of replacement messages by using the message selection index and total index of the target message. It ensures that the number of test messages is stable after each iteration based on the number of target differences, and improves the overall quality and effectiveness of the test message set while maintaining the consistency of the number of messages, avoiding the accumulation of invalid messages, and continuously optimizing the coverage of test messages for charging pile communication scenarios and potential vulnerabilities.

[0187] (4) Compared with related technologies, the present invention locks high-quality messages with high vulnerability trigger probability through the first padding message, ensuring the core quality of the padding message, while supplementing the remaining number of messages through the second padding message, taking into account the randomness of message selection and the overall quantity requirements, avoiding the loss of high-quality messages, balancing the quality and diversity of test messages, and providing accurate and comprehensive padding support for subsequent update of test messages and improving the effectiveness of charging pile communication testing.

[0188] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0189] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0190] Example 2

[0191] According to an embodiment of the present invention, an apparatus for implementing the above-described charging pile communication testing method is also provided. Figure 5 This is a structural block diagram of a charging pile communication testing device according to an embodiment of the present invention, such as... Figure 5 As shown, the device includes: an acquisition module 502, a first determination module 504, a second determination module 506, a third determination module 508, and a fourth determination module 510. The device will be described in detail below.

[0192] The acquisition module 502 is used to acquire the communication parameters of the charging pile; the first determination module 504, connected to the acquisition module 502, is used to determine multiple test messages corresponding to the charging pile based on the communication parameters; the second determination module 506, connected to the first determination module 504, is used to perform any one iteration of the multiple iterations on the multiple test messages according to the execution order of multiple iterations on the multiple test messages, and determine multiple reference messages from the multiple test messages in any one iteration; the third determination module 508, connected to the second determination module 506, is used to... The target operation is performed on multiple reference messages in any iteration to obtain multiple target messages in any iteration. The target operation includes a target transformation operation, which is used to transform the target fields in the multiple reference messages respectively. The fourth determining module 510, connected to the third determining module 508, is used to update multiple test messages based on the multiple target messages in any iteration to obtain multiple test messages updated in any iteration, until multiple iterations are completed to obtain multiple test messages updated in the next target iteration, so as to perform communication testing on the charging pile.

[0193] It should be noted here that the above-mentioned acquisition module 502, first determination module 504, second determination module 506, third determination module 508 and fourth determination module 510 correspond to steps S102 to S110 in the charging pile communication test method. The multiple modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiment 1.

[0194] Example 3

[0195] According to another aspect of the present invention, an electronic device is also provided, comprising: a processor; and a memory for storing processor-executable instructions, wherein the processor is configured to execute instructions to implement the charging pile communication test method of any of the above embodiments.

[0196] Example 4

[0197] According to another aspect of the present invention, a computer-readable storage medium is also provided, which, when the instructions in the computer-readable storage medium are executed by the processor of an electronic device, enables the electronic device to perform any of the above-described charging pile communication test methods.

[0198] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0199] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0200] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0201] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0202] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0203] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0204] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for testing communication in a charging pile, characterized in that, include: Obtain the communication parameters of the charging pile; Based on the communication parameters, multiple test messages corresponding to the charging pile are determined; According to the execution order of multiple iterations of the multiple test messages, for any one of the multiple iterations of the multiple test messages, determine multiple reference messages from the multiple test messages in the multiple iterations of the multiple iterations. Perform target operations on multiple reference messages in any iteration to obtain multiple target messages in any iteration, wherein the target operation includes a target transformation operation, which is used to transform the target fields in the multiple reference messages respectively; Based on the multiple target messages under any iteration, the multiple test messages are updated to obtain multiple test messages updated after the first iteration, until multiple iterations are completed to obtain multiple test messages updated after the next target iteration, so as to perform communication testing on the charging pile.

2. The method according to claim 1, characterized in that, The step of performing target operations on multiple reference messages in any given iteration to obtain multiple target messages in any given iteration includes: When the target transformation operation includes a first transformation operation and a second transformation operation, and the target field includes a first field and a second field, the first transformation operation is performed on the first field corresponding to the plurality of reference messages respectively to obtain a plurality of first transformed messages, wherein the length of the first field is greater than the length of the second field, and the plurality of first transformed messages correspond one-to-one with the plurality of reference messages; From the plurality of first transformed messages, a predetermined number of messages to be transformed are determined; A second transformation operation is performed on the second field corresponding to the predetermined number of messages to be transformed, to obtain the predetermined number of second transformed messages; Based on the other first transformation messages (excluding the predetermined number of messages to be transformed) among the plurality of first transformation messages, and the predetermined number of second transformation messages, a plurality of target messages under any given iteration are determined.

3. The method according to claim 2, characterized in that, The first transformation operation is performed on the first field corresponding to the plurality of reference messages respectively to obtain a plurality of first transformed messages, including: Based on the aforementioned multiple reference messages, multiple message pairs are determined; For any target message pair among multiple message pairs, the first fields corresponding to the two reference messages in the target message pair are swapped to obtain the first transformed message corresponding to the two reference messages in the target message pair. The method of obtaining the first transformed messages corresponding to the two reference messages in the target message pair is used to determine the first transformed messages corresponding to the two reference messages of each of the other message pairs besides the target message pair.

4. The method according to claim 2, characterized in that, The step of performing a second transformation operation on the second fields corresponding to the predetermined number of messages to be transformed, respectively, to obtain the predetermined number of second transformed messages, includes: Determine the transformation interval parameters of the second field corresponding to the predetermined number of messages to be transformed; Based on the transformation interval parameters of the second field corresponding to the predetermined number of messages to be transformed, the second field corresponding to the predetermined number of messages to be transformed is transformed to obtain the predetermined number of second transformed messages.

5. The method according to claim 1, characterized in that, The step of updating the multiple test packets based on the multiple target packets under any iteration to obtain the multiple test packets updated under any iteration includes: Determine the message selection index corresponding to the multiple target messages in any given iteration; Based on the message selection indices corresponding to the multiple target messages in any given iteration, the total selection index for any given iteration is determined. Based on the message selection index corresponding to the multiple target messages in any iteration, and the total selection index in any iteration, target replacement messages with the target difference number in any iteration are selected from the multiple target messages in any iteration. The target difference number in any iteration is determined based on the difference between the number of messages corresponding to the multiple test messages and the number of messages corresponding to the multiple target messages in any iteration. Based on the target padding message with the target difference number in any iteration, and the multiple target messages in any iteration, the multiple test messages are updated to obtain the multiple test messages updated in any iteration.

6. The method according to claim 5, characterized in that, The step of selecting target replacement messages with a target difference of a certain number from the multiple target messages in any given iteration, based on the message selection index corresponding to each of the multiple target messages in any given iteration and the total selection index in any given iteration, includes: Based on the message selection index corresponding to the multiple target messages in any iteration, the first replacement message with the first number of differences in any iteration is selected from the multiple target messages in any iteration, wherein the first number of differences is less than or equal to the number of target differences; Based on the message selection index corresponding to the multiple target messages in any iteration, and the total selection index in any iteration, the second replacement message with the second difference number is selected from the multiple target messages in any iteration, wherein the second difference number is determined based on the difference between the target difference number and the first difference number. Based on the first padded message of the first difference number in any iteration and the second padded message of the second difference number in any iteration, the target padded message of the target difference number in any iteration is determined.

7. The method according to any one of claims 1 to 6, characterized in that, The step of determining multiple reference messages from multiple test messages in any given iteration includes: Determine the test parameters corresponding to the charging pile; Determine the similarity index corresponding to the multiple test messages in any given iteration; Based on the similarity indices corresponding to the multiple test messages in any given iteration, multiple reference messages are determined in any given iteration. The corresponding similarity index represents the degree of similarity between the corresponding test message and the predetermined message. The predetermined message is determined based on the test parameters. The multiple reference messages are the test messages among the multiple test messages whose similarity index is greater than or equal to the similarity threshold.

8. A charging pile communication testing device, characterized in that, include: The acquisition module is used to acquire the communication parameters of the charging pile; The first determining module is used to determine multiple test messages corresponding to the charging pile based on the communication parameters. The second determining module is used to determine, in accordance with the execution order of multiple iterations of the multiple test messages, any one of the multiple iterations of the multiple test messages, and from the multiple test messages in the any one iteration, determine multiple reference messages in the any one iteration. The third determining module is used to perform target operations on multiple reference messages under any iteration to obtain multiple target messages under any iteration, wherein the target operation includes a target transformation operation, and the target transformation operation is used to transform the target fields in the multiple reference messages respectively. The fourth determining module is used to update the multiple test messages based on the multiple target messages under any iteration, to obtain the multiple test messages updated after the first iteration, until multiple iterations are completed, to obtain the multiple test messages updated after the next target iteration, so as to perform communication testing on the charging pile.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the charging pile communication test method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the charging pile communication test method as described in any one of claims 1 to 7.