CN107612780B - Modbus protocol analysis system test method and device - Google Patents

Modbus protocol analysis system test method and device Download PDF

Info

Publication number
CN107612780B
CN107612780B CN201710944502.3A CN201710944502A CN107612780B CN 107612780 B CN107612780 B CN 107612780B CN 201710944502 A CN201710944502 A CN 201710944502A CN 107612780 B CN107612780 B CN 107612780B
Authority
CN
China
Prior art keywords
modbus
tested
modbus protocol
analysis system
sending
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710944502.3A
Other languages
Chinese (zh)
Other versions
CN107612780A (en
Inventor
程学
范渊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Dbappsecurity Technology Co Ltd
Original Assignee
Hangzhou Dbappsecurity Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Dbappsecurity Technology Co Ltd filed Critical Hangzhou Dbappsecurity Technology Co Ltd
Priority to CN201710944502.3A priority Critical patent/CN107612780B/en
Publication of CN107612780A publication Critical patent/CN107612780A/en
Application granted granted Critical
Publication of CN107612780B publication Critical patent/CN107612780B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a test method and a test device for a modbus protocol analysis system, which comprises the steps of obtaining modbus protocol data to be tested; generating a data packet to be tested based on the acquired data; sending a plurality of data packets to be tested to a system to be tested according to a service flow to be tested, wherein the service flow to be tested comprises a sending sequence, a sending rate and a sending network port for sending each data packet to be tested; and judging whether the test of the system to be tested passes or fails according to the analysis result of the system to be tested. The test method of the modbus protocol analysis system provided by the invention can be used for custom constructing the data packet of the modbus protocol, so that the content of the data packet is controllable; the sending sequence, sending rate and sending network port of the protocol data packet are customized, various data exchange flows can be simulated, protocol equipment is not needed, networking is simple, the testing flow is greatly simplified, and testing cost is reduced.

Description

Modbus protocol analysis system test method and device
Technical Field
The invention relates to the technical field of modbus protocol testing, in particular to a method and a device for testing a modbus protocol analysis system.
Background
The Modbus communication protocol was invented by Modicon in 1979 and is the first bus protocol to be truly used in industrial fields worldwide. With this protocol, controllers can communicate with each other, controllers via a network (e.g., ethernet), and other devices. Currently, the Modbus TCP protocol has become a general industrial communication standard, and has the following characteristics: standard, open, the user can use free, with confidence. Currently, more than 400 manufacturers support Modbus and more than 600 products support Modbus. May be transmitted over various media such as twisted pair, fiber optics, wireless, etc. The frame format of the Modbus is simple and compact, and popular and easy to understand. The user is easy to use, and the manufacturer is easy to develop.
Due to the characteristics of openness, standability, universality and understandability of the Modbus protocol, any equipment connected to the Modbus controller through the network can change the value of an I/O point or a register of the controller, and even can reset, prohibit operation or download a new logic or firmware version to the controller, thereby bringing great communication safety hidden trouble.
With the gradual emphasis of the state on the industrial network security, a plurality of systems aiming at modbus protocol network flow analysis appear in the market, and how to effectively test the systems becomes a difficulty. In an actual field use scene, the flow received by the modbus protocol analysis system may include various function codes, normal and abnormal modbus data packets, and in a laboratory test, if the test is performed by using a networking mode in an actual scene, the test cost is high, and meanwhile, the networking environment is complex.
The existing testing method has complex networking testing environment and relates to modbus protocol equipment, and the content of flow is uncontrollable; or the data packet captured by the current network is used for playback, the content in the data packet is uncontrollable, the data can only be accessed according to the inherent flow of the data packet, and the sequence of the data packet cannot be changed
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a method and an apparatus for testing a modbus protocol analysis system, so as to improve the above problem.
The technical scheme adopted by the embodiment of the invention is as follows:
a modbus protocol analysis system testing method, the method for testing a modbus protocol analysis system, the method comprising:
acquiring modbus protocol data to be tested, wherein the modbus protocol data to be tested is input according to the processing logic of the modbus protocol analysis system to be tested;
generating a modbus protocol data packet to be tested based on the acquired data;
sending a plurality of modbus protocol data packets to be tested to a modbus protocol analysis system to be tested according to a service process to be tested, wherein the service process to be tested comprises the sequence, the speed and a sending port for sending each modbus protocol data packet to be tested;
the modbus protocol analysis system analyzes the received modbus protocol data packets to be tested and outputs analysis results;
and when the analysis result is an expected result, judging that the modbus protocol analysis system passes the test, and when the analysis result is not the expected result, judging that the test of the modbus protocol analysis system fails.
Further, before the step of sending the plurality of modbus protocol data packets to be tested to the modbus protocol analysis system according to the service flows to be tested, a service flow is configured, and the step of configuring the service flow includes: configuring the sending sequence of a plurality of modbus protocol data packets; configuring the sending rate of a plurality of modbus protocol data packets; and configuring a plurality of transmission network ports of the modbus protocol data packets.
Further, the modbus protocol data to be tested includes: source and destination IP addresses, source and destination ports, and modbus data information.
Further, the step of generating a modbus protocol data packet to be tested based on the input data comprises: generating an IP header structure according to the source IP address and the destination IP address: generating a TCP header structure according to the source port and the destination port; a modbus data structure is generated from the modbus data information.
Further, the step of generating the modbus protocol data packet to be tested further comprises: generating a complete modbus structure based on the generated IP head structure, TCP head structure and modbus data structure; and (4) unloading the complete modbus structure into a pcap format.
A modbus protocol analysis system testing apparatus, the apparatus comprising: the obtaining module is used for obtaining modbus protocol data to be tested, wherein the modbus protocol data to be tested is input according to the processing logic of the modbus protocol analysis system to be tested; the constructing module is used for constructing and generating a modbus protocol data packet to be tested based on the acquired data; the sending module is used for sending the plurality of modbus protocol data packets to be tested to the modbus protocol analysis system to be tested according to the business process to be tested; the analysis module is used for judging whether the system to be tested meets preset requirements or not according to the analysis result of the modbus protocol analysis system to be tested, wherein when the analysis result is an expected result, the modbus protocol analysis system is judged to pass the test, and when the analysis result is not the expected result, the modbus protocol analysis system is judged to fail the test.
Further, the apparatus further comprises a process configuration module, and the process configuration module comprises: the device comprises a sequence configuration unit, a data transmission unit and a data transmission unit, wherein the sequence configuration unit is used for configuring the transmission sequence of a plurality of modbus protocol data packets; the speed configuration unit is used for configuring the sending speed of a plurality of modbus protocol data packets; and the network port configuration unit is used for configuring a plurality of sending network ports of the modbus protocol data packets.
Further, the obtaining module comprises: an address acquisition unit for acquiring a source IP address and a destination IP address; a port acquisition unit, configured to acquire a source port and a destination port; and the Modbus data information acquisition unit is used for acquiring the Modbus data information.
Further, the construction module includes:
an IP header construction unit, configured to generate an IP header structure according to the source IP address and a destination IP address; a TCP header construction unit, configured to generate a TCP header structure according to the source port and the destination port; and the Modbus structure construction unit is used for generating a Modbus data structure according to the Modbus data information.
Further, the construction module further includes: the integration unit is used for generating a complete modbus structure based on the generated IP head structure, the TCP head structure and the modbus data structure; and the format conversion unit is used for converting the complete modbus structure into a pcap format.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a test method and a test device for a modbus protocol analysis system, wherein the method comprises the steps of obtaining modbus protocol data to be tested; generating a modbus protocol data packet to be tested based on the acquired data; sending a plurality of modbus protocol data packets to be tested to a modbus protocol analysis system to be tested according to a service process to be tested, wherein the service process to be tested comprises a sending sequence, a sending rate and a sending network port for sending each modbus protocol data packet to be tested; and judging whether the test of the modbus protocol analysis system to be tested passes or fails according to the analysis result of the modbus protocol analysis system to be tested. The test method of the modbus protocol analysis system provided by the invention can be used for custom constructing the data packet of the modbus protocol, so that the content of the data packet is controllable; the sending sequence, sending rate and sending network port of the protocol data packet are customized, various data exchange flows can be simulated, protocol equipment is not needed, networking is simple, the testing flow is greatly simplified, and testing cost is reduced.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
FIG. 1 shows a schematic diagram of a modbus protocol analysis system test system provided by the invention.
Fig. 2 shows a flow chart of a modbus protocol analysis system testing method.
Fig. 3 shows a flow chart of sub-steps of step S10.
Fig. 4 shows a flowchart of the substeps of step S20.
Fig. 5 shows a flowchart of the substeps of step S30.
Fig. 6 shows a functional block schematic diagram of a modbus protocol analysis system testing device.
Fig. 7 shows a schematic block diagram of the acquisition module 210.
Fig. 8 shows a functional block diagram of the construction block 220.
Fig. 9 shows a functional block diagram of the flow configuration module 230.
Fig. 10 shows a schematic block diagram of the analysis module 250.
Icon: a 100-modbus protocol analysis system test system; 121-a memory; 122 — a memory controller; 123-a processor; 124-peripheral interface; 125-a display unit; 126-an input unit; 200-modbus protocol analysis system testing device; 210-an obtaining module; 211-address fetch unit; 212-port acquisition unit; 213-modbus data information acquisition unit; 220-a construction module; 221-IP header construction unit; 222-a TCP header construction unit; 223-Modbus structure construction units; 224-an integration unit; 225-format conversion unit; 230-a flow configuration module; 231-a sequential configuration unit; 232-rate configuration unit; 233-network port configuration unit; 240-a sending module; 250-an analysis module; 251-a receiving unit; 252-analysis unit.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
The modbus protocol analysis system test method and apparatus provided by the preferred embodiment of the present invention can be applied to the modbus protocol analysis system test system 100 shown in fig. 1. Fig. 1 is a block diagram of a modbus protocol analysis system test system 100 according to a preferred embodiment of the present invention. The modbus protocol analysis system test system 100 comprises a modbus protocol analysis system test device 200, a memory 121, a memory controller 122, a processor 123, a peripheral interface 124, a display unit 125, and an input unit 126.
The memory 121, the memory controller 122, the processor 123, the peripheral interface 124, the display unit 125 and the input unit 126 are electrically connected to each other directly or indirectly, so as to implement data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The modbus protocol analysis system test apparatus 200 includes at least one software function module that may be stored in the memory 121 in the form of software or firmware (firmware) or may be embedded in an Operating System (OS) of the modbus protocol analysis system test system 100. The processor 123 is configured to execute an executable module stored in the memory 121, such as a software functional module or a computer program included in the modbus protocol analysis system testing device 200.
The Memory 121 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 121 is used for storing a program, and the processor 123 executes the program after receiving an execution instruction, and the method executed by the server defined by the flow process disclosed in any embodiment of the present invention may be applied to the processor 123, or implemented by the processor 123.
The processor 123 may be an integrated circuit chip having signal processing capabilities. The Processor 123 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor 123 may be any conventional processor 123 or the like.
The peripheral interface 124 couples various input/output devices to the processor 123 as well as to the memory 121. In some embodiments, the peripheral interface 124, the processor 123, and the memory controller 122 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
The display unit 125 provides an interactive interface (e.g., a user interface) between the modbus protocol analysis system test system 100 and a user or for displaying image data to a user reference. In this embodiment, the display unit 125 may be a liquid crystal display or a touch display. In the case of a touch display, the display can be a capacitive touch screen or a resistive touch screen, which supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations from one or more locations on the touch display at the same time, and the sensed touch operations are sent to the processor 123 for calculation and processing.
The input unit 126 is used to provide the user with input image information. The input unit 126 may be, but is not limited to, a camera, an electronic drawing board, a data interface, a keyboard, and the like, and the keyboard may be a virtual keyboard.
First embodiment
The present embodiment provides a modbus protocol analysis system testing method, which includes steps S10 to S50, please refer to fig. 2. Fig. 2 shows a flowchart of a modbus protocol analysis system testing method provided in this embodiment.
Step S10: and acquiring modbus protocol data to be tested.
In this embodiment, the modbus protocol data to be tested is used to send to the system to be tested, and the system to be tested receives and analyzes the packed modbus protocol data packet. The type of the acquired protocol data can be set according to the processing logic of the system to be tested. In the present embodiment, step S10 includes sub-step S101 to sub-step S103. Referring to fig. 3, fig. 3 shows a flowchart of the sub-steps of step S10.
Step S101: a source IP address and a destination IP address are obtained.
The IP header includes version information, service type, packet length, packet identification fragmentation usage, time to live, protocol type salt and pepper, and source IP and destination IP. The IP protocol header allows custom entry of the source and destination IP addresses, with the uninputed portion automatically populated with default values by the system.
Step S102: a source port and a destination port are obtained.
The TCP header includes a source port number, a destination port number, a sequence number, an acknowledgment number, a TCP header length, a flag bit, a window size, a checksum emergency data offset. In this embodiment, the source port number and the destination port number can be input by user definition, and the rest of the input is to fill default values by the system.
Step S103: and acquiring modbus data information.
The Modbus data information allows a user to input contents related to the Modbus protocol in a 16-system mode, and specifically, the user can input the Modbus data information according to the processing logic of the system to be tested.
Step S20: and generating a modbus protocol data packet to be tested based on the acquired data.
And generating a complete modbus protocol data packet based on the obtained source IP address, destination IP address, source port, destination port and modbus data information. And converts the complete modbus protocol data packet to a format suitable for transmission over a network. In the present embodiment, step S20 includes sub-steps S201 to S205. Referring to fig. 4, fig. 4 shows a flowchart of sub-steps S201 to S205.
Step S201: and generating an IP header structure according to the source IP address and the destination IP address.
And generating an IP header according to the obtained source IP address, the obtained target IP address and other fields of the IP header filled by the system.
Step S202: and generating a TCP header structure according to the source port and the destination port.
And generating a TCP header according to the obtained source TCP source port and destination port number and other fields of the TCP header filled by the system.
Step S203: a modbus data structure is generated from the modbus data information.
And adding the Modbus data information content to the PDU part of the TCP to form a Modbus data structure.
Step S204: and generating a complete modbus structure based on the generated IP header structure, the TCP header structure and the modbus data structure.
And combining the generated IP head structure, TCP head structure and modbus data structure to synthesize a complete modbus protocol data packet.
Step S205: and (4) unloading the complete modbus structure into a pcap format.
The modbus protocol data packet generated in the previous step is not suitable for storage or transmission over ethernet, and after the complete modbus protocol data packet is generated, it must be converted to a format suitable for transmission or storage over ethernet. In this embodiment, the complete modbus protocol packet is converted to pcap format.
Step S30: and configuring a service process of the modbus protocol data packet to be tested.
In the test process of the existing test method, the sending flow of the modbus protocol data packet is fixed and cannot be set according to different test requirements. In this embodiment, the service flow applicable to different testing methods can be configured through this step. The method comprises the steps of sending sequence, sending rate, sending network ports and the like of the modbus protocol data packets.
In the present embodiment, step S30 includes sub-steps S301 to S303. Referring to fig. 5, fig. 5 shows a flowchart of the sub-steps of step S30.
Step S301: the transmission sequence of a plurality of modbus protocol data packets is configured.
For different modbus protocol analysis systems, the sequence of sending the data packets is different, and the step can define the sending sequence of different data packets for different systems to be tested.
Step S302: the transmission rates of a plurality of modbus protocol packets are configured.
Different data packets need to have different transmission rates, e.g. 10 times/sec, 20 times/sec.
Step S303: and configuring a plurality of transmission network ports of the modbus protocol data packets.
In this embodiment, the system includes a plurality of network cards or transmitting network ports, and different transmitting network ports or network cards are required to be used for different service flows.
Step S40: and sending the plurality of modbus protocol data packets to be tested to a system to be tested.
And sending a plurality of modbus protocol data packets in the pcap format to a to-be-tested modbus protocol analysis system according to the configured service flow, wherein the to-be-tested service flow comprises the sequence, the speed and the sending network port for sending each modbus protocol data packet to be tested. In this embodiment, data transmission is mainly connected to a system to be tested in a manner of direct connection of the ethernet, and a data packet is transmitted to the system to be tested according to a configured service flow, so that a networking manner through a switch is omitted, a network topology structure is greatly simplified, and a test environment is built more simply and quickly.
Step S50: acquiring an analysis result which is obtained by analyzing and outputting each received data packet to be tested by a system to be tested; and acquiring an analysis result which is obtained by analyzing and outputting each received modbus protocol data packet to be tested by the modbus protocol analysis system.
After receiving the modbus protocol data packet to be tested sent through the network, the modbus protocol analysis system to be tested decompresses and analyzes the modbus protocol data packet to generate an analysis result. The method comprises the following steps of obtaining an analysis result of the modbus protocol analysis system to be tested, and analyzing the test result.
S60: and when the analysis result is an expected result, judging that the modbus protocol analysis system passes the test, and when the analysis result is not the expected result, judging that the test of the modbus protocol analysis system fails.
Second embodiment
The embodiment provides a modbus protocol analysis system testing device 200. Referring to fig. 6, fig. 6 shows a functional block diagram of the modbus protocol analysis system testing apparatus 200.
modbus protocol analysis system testing apparatus 200 includes an acquisition module 210, a construction module 220, a flow configuration module 230, a transmission module 240, and an analysis module 250.
The obtaining module 210 is configured to obtain modbus protocol data to be tested, where the modbus protocol data to be tested is input according to processing logic of the modbus protocol analysis system to be tested. It is understood that step S10 may be performed by the obtaining module 210.
The obtaining module 210 includes the following functional sub-units, please refer to fig. 7.
An address obtaining unit 211, configured to obtain a source IP address and a destination IP address. It is understood that step S101 may be performed by the address acquisition unit 211.
A port obtaining unit 212, configured to obtain a source port and a destination port of the packet. It is understood that step S102 may be performed by the port acquiring unit 212.
And a Modbus data information obtaining unit 213, configured to obtain Modbus data information. It is understood that the step S103 may be performed by the Modbus data information acquiring unit 213.
The constructing module 220 is used for generating a modbus protocol data packet to be tested based on the acquired data construction. For example, a modbus protocol packet is constructed based on the obtained source and destination IP addresses, source and destination ports, and the obtained modbus data information. And converts modbus protocol packets to a format that is readily stored or transmitted over ethernet. It is understood that step S20 may be performed by the construction module 220.
The construction module 220 comprises the following functional sub-units:
an IP header constructing unit 221, configured to generate an IP header structure with a destination IP address according to the source IP address; it is to be understood that step S201 may be performed by the IP header constructing unit 221.
A TCP header constructing unit 222, configured to generate a TCP header structure according to the source port and the destination port; it is to be understood that step S202 may be performed by the TCP header constructing unit 222.
And a Modbus structure constructing unit 223, configured to generate a Modbus data structure according to the Modbus data information. It is understood that step S203 may be performed by the Modbus structure construction unit 223.
An integration unit 224, configured to generate a complete modbus structure based on the generated IP header structure, TCP header structure, and modbus data structure; it is to be understood that step S204 may be performed by the integrating unit 224.
And a format conversion unit 225, configured to convert the complete modbus structure into a pcap format. After the complete modbus protocol packet is generated, it must be converted to a format suitable for transmission or storage over ethernet. In this embodiment, the complete modbus protocol packet is converted to pcap format. It is to be understood that step S205 may be performed by the format conversion unit 225.
The process configuration module 230 is configured to configure a sending process of the modbus protocol data packet according to different test requirements. For example, the sending sequence, sending rate or sending network port of the modbus protocol data packets are configured according to different testing requirements of the system to be tested. It is understood that step S30 may be performed by the flow configuration module 230. The flow configuration module 230 includes the following functional sub-units:
a sequence configuration unit 231, configured to configure a transmission sequence of the plurality of modbus protocol data packets; it is to be understood that step S301 may be performed by the sequence configuration unit 231.
A rate configuration unit 232, configured to configure sending rates of a plurality of modbus protocol data packets; it is to be understood that step S302 may be performed by the rate configuration unit 232.
And a port configuration unit 233, configured to configure a plurality of transmission ports of modbus protocol data packets. It is to be understood that step S303 may be performed by the portal configuration unit 233.
And the sending module 240 is configured to send the multiple modbus protocol data packets to be tested to the modbus protocol analysis system to be tested according to the service flow to be tested. And sending a plurality of modbus protocol data packets in the pcap format to a to-be-tested modbus protocol analysis system according to the configured service flow, wherein the to-be-tested service flow comprises the sequence, the speed and the sending network port for sending each modbus protocol data packet to be tested. In this embodiment, data transmission is mainly connected to a system to be tested in a manner of direct connection of the ethernet, and a data packet is transmitted to the system to be tested according to a configured service flow, so that a networking manner through a switch is omitted, a network topology structure is greatly simplified, and a test environment is built more simply and quickly.
It is understood that step S40 may be performed by the sending module 240.
The analysis module 250 is configured to determine whether the to-be-tested system meets preset requirements according to an analysis result of the to-be-tested modbus protocol analysis system, where the analysis module 250 includes a receiving unit 251 and an analysis unit 252, and the receiving unit 251 is configured to obtain an analysis result that the modbus protocol analysis system analyzes and outputs each received to-be-tested modbus protocol data packet. It is understood that step S50 may be performed by the receiving unit 251.
The analysis unit 252 is used for judging that the modbus protocol analysis system passes the test when the analysis result is an expected result, and judging that the modbus protocol analysis system fails to test when the analysis result is not the expected result. It is to be understood that step S60 may be performed by the analysis unit 252.
In summary, the invention provides a modbus protocol analysis system test method and device, including obtaining modbus protocol data to be tested; generating a data packet to be tested based on the acquired data; sending a plurality of data packets to be tested to a system to be tested according to a service flow to be tested, wherein the service flow to be tested comprises a sending sequence, a sending rate and a sending network port for sending each data packet to be tested; and judging whether the test of the system to be tested passes or fails according to the analysis result of the system to be tested. The test method of the modbus protocol analysis system provided by the invention can be used for custom constructing the data packet of the modbus protocol, so that the content of the data packet is controllable; the sending sequence, sending rate and sending network port of the protocol data packet are customized, various data exchange flows can be simulated, protocol equipment is not needed, networking is simple, the testing flow is greatly simplified, and testing cost is reduced.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof, which essentially contributes to the prior art, can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a high-speed computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A modbus protocol analysis system testing method is characterized in that the method comprises the following steps:
acquiring modbus protocol data to be tested, wherein the modbus protocol data to be tested is input according to the processing logic of the modbus protocol analysis system to be tested;
generating a modbus protocol data packet to be tested based on the acquired data;
sending a plurality of modbus protocol data packets to be tested to a modbus protocol analysis system to be tested according to a service process to be tested, wherein the service process to be tested comprises the sequence, the speed and a sending port for sending each modbus protocol data packet to be tested;
obtaining an analysis result which is obtained by analyzing and outputting each received modbus protocol data packet to be tested by the modbus protocol analysis system;
when the analysis result is an expected result, judging that the modbus protocol analysis system passes the test, and when the analysis result is not the expected result, judging that the modbus protocol analysis system fails to test;
before the step of sending the plurality of modbus protocol data packets to be tested to the modbus protocol analysis system according to the service flows to be tested, the method further comprises a step of configuring the service flows, wherein the step of configuring the service flows comprises the following steps:
configuring the sending sequence of a plurality of modbus protocol data packets;
configuring the sending rate of a plurality of modbus protocol data packets;
and configuring a plurality of transmission network ports of the modbus protocol data packets.
2. The modbus protocol analysis system testing method of claim 1, wherein the modbus protocol data to be tested comprises: source and destination IP addresses, source and destination ports, and modbus data information.
3. The modbus protocol analysis system testing method of claim 1, wherein the step of generating a modbus protocol data packet to be tested based on the input data comprises:
generating an IP header structure according to the source IP address and the destination IP address:
generating a TCP header structure according to the source port and the destination port;
a modbus data structure is generated from the modbus data information.
4. A modbus protocol analysis system testing method of claim 3, wherein the step of generating a modbus protocol data packet to be tested further comprises:
generating a complete modbus structure based on the generated IP head structure, TCP head structure and modbus data structure;
and (4) unloading the complete modbus structure into a pcap format.
5. A modbus protocol analysis system testing apparatus, the apparatus comprising:
the obtaining module is used for obtaining modbus protocol data to be tested, wherein the modbus protocol data to be tested is input according to the processing logic of the modbus protocol analysis system to be tested;
the constructing module is used for constructing and generating a modbus protocol data packet to be tested based on the acquired data;
the sending module is used for sending the plurality of modbus protocol data packets to be tested to the modbus protocol analysis system to be tested according to the business process to be tested;
the analysis module is used for judging whether the system to be tested meets preset requirements or not according to the analysis result of the modbus protocol analysis system to be tested, wherein when the analysis result is an expected result, the modbus protocol analysis system is judged to pass the test, and when the analysis result is not the expected result, the modbus protocol analysis system is judged to fail the test;
the apparatus further comprises a process configuration module, the process configuration module comprising:
the device comprises a sequence configuration unit, a data transmission unit and a data transmission unit, wherein the sequence configuration unit is used for configuring the transmission sequence of a plurality of modbus protocol data packets;
the speed configuration unit is used for configuring the sending speed of a plurality of modbus protocol data packets;
and the network port configuration unit is used for configuring a plurality of sending network ports of the modbus protocol data packets.
6. The modbus protocol analysis system testing apparatus of claim 5, wherein the obtaining module comprises:
an address acquisition unit for acquiring a source IP address and a destination IP address;
a port acquisition unit, configured to acquire a source port and a destination port;
and the Modbus data information acquisition unit is used for acquiring the Modbus data information.
7. The modbus protocol analysis system testing apparatus of claim 6, wherein the construction module comprises:
an IP header construction unit, configured to generate an IP header structure according to the source IP address and a destination IP address;
a TCP header construction unit, configured to generate a TCP header structure according to the source port and the destination port;
and the Modbus structure construction unit is used for generating a Modbus data structure according to the Modbus data information.
8. The modbus protocol analysis system testing apparatus of claim 7, wherein the build module further comprises:
the integration unit is used for generating a complete modbus structure based on the generated IP head structure, the TCP head structure and the modbus data structure;
and the format conversion unit is used for converting the complete modbus structure into a pcap format.
CN201710944502.3A 2017-10-11 2017-10-11 Modbus protocol analysis system test method and device Active CN107612780B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710944502.3A CN107612780B (en) 2017-10-11 2017-10-11 Modbus protocol analysis system test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710944502.3A CN107612780B (en) 2017-10-11 2017-10-11 Modbus protocol analysis system test method and device

Publications (2)

Publication Number Publication Date
CN107612780A CN107612780A (en) 2018-01-19
CN107612780B true CN107612780B (en) 2020-11-24

Family

ID=61068137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710944502.3A Active CN107612780B (en) 2017-10-11 2017-10-11 Modbus protocol analysis system test method and device

Country Status (1)

Country Link
CN (1) CN107612780B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115442172B (en) * 2021-08-23 2024-04-12 北京车和家信息技术有限公司 Test message sending method, device, medium, equipment and test system
CN114222009A (en) * 2021-12-15 2022-03-22 北京工业大学 Industrial communication multi-protocol conversion system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1848777A (en) * 2006-01-19 2006-10-18 华为技术有限公司 Protocol simulation testing device
CN102413018A (en) * 2011-12-21 2012-04-11 武汉烽火网络有限责任公司 FPGA (field programmable gate array) based software-hardware coordinated network test system and method
CN104104488A (en) * 2014-07-15 2014-10-15 中国电子科技集团公司第四十一研究所 Wireless sensor network protocol conformance testing system and method
CN104820637A (en) * 2015-04-17 2015-08-05 中国电子科技集团公司第四十一研究所 Handheld type USB3.0 protocol analyzer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9229627B2 (en) * 2013-06-05 2016-01-05 General Electric Company System and method for graphical rights indication

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1848777A (en) * 2006-01-19 2006-10-18 华为技术有限公司 Protocol simulation testing device
CN102413018A (en) * 2011-12-21 2012-04-11 武汉烽火网络有限责任公司 FPGA (field programmable gate array) based software-hardware coordinated network test system and method
CN104104488A (en) * 2014-07-15 2014-10-15 中国电子科技集团公司第四十一研究所 Wireless sensor network protocol conformance testing system and method
CN104820637A (en) * 2015-04-17 2015-08-05 中国电子科技集团公司第四十一研究所 Handheld type USB3.0 protocol analyzer

Also Published As

Publication number Publication date
CN107612780A (en) 2018-01-19

Similar Documents

Publication Publication Date Title
EP3073381B1 (en) Virtual intelligent platform management interface (ipmi) satellite controller and method
US9176649B2 (en) Method and apparatus of remote management of computer system using voice and gesture based input
KR102030012B1 (en) Communication Interface Apparatus and Interface Method Using the Same
KR20060054026A (en) Method to chain events in a system event log
WO2017032112A1 (en) Method for communicating with board having no central processing unit and communication device
CN107612780B (en) Modbus protocol analysis system test method and device
US10667103B2 (en) Method and apparatus for software defined sensing
CN112653600A (en) Network card performance testing method and device based on USB network card and electronic equipment
US20140280469A1 (en) Method and apparatus for remote management of computer system using handheld device
CN110989487A (en) PLC initialization method and device for industrial server and readable storage medium
CN113498495A (en) Control system, support device, and program for support device
CN112910910B (en) Method, device, equipment and storage medium for processing OPCDA protocol message
CN109068170B (en) Storage method, device, terminal and storage medium for barrage message
US8510477B2 (en) Protocol resolution device and method employing the same
US20240061964A1 (en) Bmc platform offload to a remote application
CN111125759A (en) Database login account shielding method and device and electronic equipment
CN117130318B (en) Industrial data acquisition method, device, system and readable storage medium
JP5956515B2 (en) Test apparatus and test method
CN115834726B (en) Protocol conversion method, data transmission method, device, gateway and storage medium
Gaitan MCIP Client Application for SCADA in Iiot Environment
KR102103822B1 (en) Method for testing of modbus communication
JP3139257U (en) Wireless remote monitoring device
CN106789399B (en) Test method, device and system
US10841186B2 (en) Method for accessing data related to at least one operation implented by a node device of a network
CN106713478B (en) Communication processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 310000 No. 188 Lianhui Street, Xixing Street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Hangzhou Anheng Information Technology Co.,Ltd.

Address before: Zhejiang Zhongcai Building No. 68 Binjiang District road Hangzhou City, Zhejiang Province, the 310051 and 15 layer

Applicant before: DBAPPSECURITY Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant