Message Processing Method, Apparatus, Electronic Device, and Storage Medium

By performing address translation on the response messages of the OCDA protocol messages, the problem of the client and server being unable to connect in the existing technology is solved, and normal communication connection is achieved.

CN116016431BActive Publication Date: 2025-08-01BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211689920.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2025-08-01
Estimated Expiration
2042-12-27

AI Technical Summary

Technical Problem

Existing ALG technology cannot analyze application layer data in OPCDA protocol messages, resulting in the inability of the client and server to connect normally.

Method used

After determining whether the data packet is an OPCDA protocol packet and identifying it as a response packet, the address information in the application layer data is modified, and the source address is replaced with the destination address in the request packet.

Benefits of technology

Address translation of OCDA protocol messages is implemented, enabling the client and server to establish a normal connection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016431B_ABST
    Figure CN116016431B_ABST
Patent Text Reader

Abstract

The present application provides a message processing method, apparatus, electronic device, and storage medium. The message processing method includes: when receiving a data message, determining whether the data message is an OPCDA protocol message; when the data message is an OPCDA protocol message, determining whether the data message is a response message returned by the server; when the data message is a response message, determining whether the data message is a message carrying address information in the application layer data; when the data message is a message carrying address information in the application layer data, modifying the address information carried in the application layer data to replace the address information carried in the application layer data with second address information. The present application can modify the address information of the response message using the OPCDA protocol, so that the source address in the response message is the same as the destination address carried in the request message using the OPCDA protocol, thereby enabling the client and the server to establish a connection normally.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular, to a message processing method, apparatus, electronic device, and storage medium. Background Art

[0002] Currently, for the efficient utilization and security of network resources, the NAT technology is often used to shield the internal network providing services. For example, the ordinary NAT technology usually only converts the IP address and port information in the message header, and does not analyze the fields in the application layer data. For some special protocols, the application layer data in their messages may contain IP address and port information, and the IP address and port information in these application layer data cannot be converted by the NAT technology, which may lead to problems such as the inability to establish a normal connection between the client and the server.

[0003] In response to the above problems, the prior art provides the ALG technology. Among them, the ALG technology makes improvements on the basis of the ordinary NAT technology, and can thus analyze the fields in the application layer data, and then convert the IP address and port information in the application layer data.

[0004] However, the ALG technology in the prior art cannot process messages using the OPCDA protocol, that is, the ALG technology cannot analyze the application layer data in the OPCDA protocol messages, and thus cannot convert the IP address in the application layer data. In this way, if the client communicates with the server using the OPCDA protocol message, it may occur that the source address of the application layer data carried in the response message returned by the server is inconsistent with the destination address carried in the request message sent by the client, resulting in the inability to establish a normal connection between the client and the server. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide a message processing method, apparatus, electronic device, and storage medium for modifying the address information of the response message using the OPCDA protocol, so that the source address in the response message is the same as the destination address carried in the request message using the OPCDA protocol, thereby enabling the client and the server to establish a normal connection.

[0006] In a first aspect, the present invention provides a message processing method, the method comprising:

[0007] When receiving a data message, determining whether the data message is an OPCDA protocol message;

[0008] When the data message is the OPCDA protocol message, determining whether the data message is a response message returned by the server;

[0009] When the data packet is the response packet, it is determined whether the data packet is a packet with address information carried in the application layer data;

[0010] When the data packet is a packet with address information carried in the application layer data, modify the address information carried in the application layer data to replace the address information carried in the application layer data with second address information, where the second address information is the destination address in the request packet, and the address information carried in the application layer data is the source address carried in the application layer data.

[0011] This application can perform address conversion on the response packet that uses the OPC DA protocol and carries address information, that is, replace the source address of the response packet with the destination address in the request packet, so that the client and the server can establish a connection normally. Compared with the prior art, this application can perform address conversion on the response packet that uses the OPC DA protocol and carries address information.

[0012] In an alternative embodiment, before replacing the first address information with the second address information based on the position of the first address information in the application layer data, the method further includes:

[0013] Obtain the request packet sent by the client to the server;

[0014] Extract the five-tuple information in the request packet;

[0015] Determine the second address information based on the five-tuple information in the request packet.

[0016] In the above alternative embodiment, by obtaining the request packet sent by the client to the server, the five-tuple information in the request packet can be further extracted, and based on the five-tuple information in the request packet, the second address information can be determined.

[0017] In an alternative embodiment, the determining whether the data packet is a packet with address information carried in the application layer data includes:

[0018] Identify the interface field and opnum field in the data packet;

[0019] Based on the field value of the interface field and the field value of the opnum field, determine whether the data packet is a packet with address information carried in the application layer data.

[0020] In the above optional implementation, by identifying the interface field and the opnum field in the data packet, it is then possible to determine whether the data packet is a packet carrying address information in the application layer based on the field value of the interface field and the field value of the opnum field.

[0021] In the optional implementation, the determining whether the data packet is a packet carrying address information in the application layer based on the field value of the interface field and the field value of the opnum field includes:

[0022] Determining whether the field value of the interface field is a value in the first numerical table and determining whether the field value of the opnum field is a value in the second numerical table;

[0023] When the field value of the interface field is a value in the first numerical table and the field value of the opnum field is a value in the second numerical table, it is determined that the data packet is a packet carrying address information in the application layer.

[0024] In the above optional implementation, by determining whether the field value of the interface field is a value in the first numerical table and determining whether the field value of the opnum field is a number in the second numerical table, and then when the field value of the interface field is a value in the first numerical table and the field value of the opnum field is a value in the second numerical table, it is possible to determine that the data packet is a packet carrying address information in the application layer.

[0025] In the optional implementation, the modifying the address information carried in the application layer to replace the address information carried in the application layer with second address information includes:

[0026] Taking the address information carried in the application layer as the first address information;

[0027] Determining the fixed offset position of the first address information in the application layer data;

[0028] Based on the fixed offset position, replacing the first address information with the second address information.

[0029] In the above optional implementation, by taking the address information carried in the application layer as the first address information, it is then possible to determine the fixed offset position of the first address information in the application layer data, and then based on the fixed offset position, replacing the first address information with the second address information.

[0030] In an optional implementation manner, the modifying the address information carried by the application layer data to replace the address information carried by the application layer data with the second address information includes:

[0031] converting the second address information into first binary data;

[0032] Converting the address information carried by the application layer data into second binary data;

[0033] Based on the sliding window, matching is started from the head of the application layer data to determine whether there is a data segment identical to the second binary data in the application layer data; if so, the identical data segment is replaced with the first binary data.

[0034] In the above optional embodiment, by converting the second address information into first binary data and converting the address information carried by the application layer data into second binary data, it is possible to match based on a sliding window starting from the head of the application layer data to determine whether there is a data segment identical to the second binary data in the application layer data. If so, the identical data end is replaced with the data segment identical to the first binary data. If so, the identical data segment is replaced with the binary data.

[0035] In an optional implementation, after converting the address information carried by the application layer data into second binary data and before starting matching from the head of the application layer data based on the sliding window, the method further includes:

[0036] The sliding window is set based on the second binary data, wherein a length of the sliding window is equal to a length of the second binary data.

[0037] In the above optional implementation manner, the sliding window can be set based on the second binary data.

[0038] In a second aspect, the present invention provides a message processing device, the device comprising:

[0039] A receiving module, used for receiving data messages;

[0040] The first judgment module is used to judge whether the data message is an OPCDA protocol message when receiving the data message;

[0041] A second judgment module is used to judge whether the data message is a response message returned by the server when the data message is the OPCDA protocol message;

[0042] A third judgment module, configured to determine whether the data packet is a packet carrying address information at the application layer when the data packet is the response packet;

[0043] A modification module, configured to modify the address information carried in the application layer data to replace the address information carried in the application layer data with second address information when the data packet is a packet carrying address information at the application layer, where the second address information is the destination address in the request packet, and the address information carried in the application layer data is the source address carried in the application layer data.

[0044] The device according to the second aspect of the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information by executing the packet processing method, that is, replacing the source address of the response packet with the destination address in the request packet, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information.

[0045] In a third aspect, the present invention provides an electronic device, including:

[0046] A processor; and

[0047] A memory configured to store machine-readable instructions that, when executed by the processor, execute the packet processing method according to any one of the foregoing embodiments.

[0048] The electronic device according to the third aspect of the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information by executing the packet processing method, that is, replacing the source address of the response packet with the destination address in the request packet, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information.

[0049] In a fourth aspect, the present invention provides a storage medium storing a computer program, and the computer program is executed by a processor to perform the packet processing method according to any one of the foregoing embodiments.

[0050] The storage medium according to the fourth aspect of the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information by executing the packet processing method, that is, replacing the source address of the response packet with the destination address in the request packet, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on a response packet that uses the OPC DA protocol and carries address information. Description of the Drawings

[0051] To more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following accompanying drawings only show certain embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related accompanying drawings can be obtained based on these drawings without creative efforts.

[0052] Figure 1 It is a schematic flowchart of a message processing method disclosed in an embodiment of the present application;

[0053] Figure 2 It is a schematic structural diagram of a message processing device disclosed in an embodiment of the present application;

[0054] Figure 3 It is a schematic structural diagram of an electronic device disclosed in an embodiment of the present application. Detailed implementation manners

[0055] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application.

[0056] Embodiment 1

[0057] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a message processing method disclosed in an embodiment of the present application. As Figure 1 shown, the method of the embodiment of the present application includes the following steps:

[0058] 101. When a data message is received, determine whether the data message is an OPCDA protocol message;

[0059] 102. When the data message is an OPCDA protocol message, determine whether the data message is a response message returned by the server;

[0060] 103. When the data message is a response message, determine whether the data message is a message with address information carried in the application layer data;

[0061] 104. When the data message is a message with address information carried in the application layer data, modify the address information carried in the application layer data to replace the address information carried in the application layer data with a second address information, where the second address information is the destination address in the request message, and the address information carried in the application layer data is the source address carried in the application layer data.

[0062] The embodiments of the present application can perform address conversion on the response message that adopts the OPCDA protocol and carries address information, that is, replace the source address of the response message with the destination address in the request message, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on the response message that adopts the OPCDA protocol and carries address information.

[0063] In the embodiments of the present application, the method of the embodiments of the present application can be applied to a gateway device. The gateway device is communicatively connected to the client and the server, and is configured to receive the request message sent by the client and the response message sent by the server.

[0064] In the embodiments of the present application, in order to avoid the leakage of the server IP address, when the gateway device receives the response message returned by the server, it will convert the source IP address of the response message into a virtual IP address, so as to achieve the purpose of hiding the server IP address. At the same time, in some scenarios, the OPCDA protocol will establish a sub-connection through negotiated ports. In this way, the response message carries the application layer data for establishing the sub-connection, and the application layer data carries the source IP address that can be used to create the sub-sub connection. However, the source IP address of these application layer data is the same as the destination IP address in the request message. The destination IP address in the request message is the address that can correctly establish a connection after negotiation with the gateway device. In this way, the source IP address of the application layer data is not the address that can correctly establish a connection after negotiation with the gateway device. Therefore, when the client receives the address information of the application layer data, since the source IP address is inconsistent with the destination IP address carried in the request message, it cannot connect to the server.

[0065] Correspondingly, based on the scenario where the client cannot connect to the server, as an example, the embodiments of the present application convert the source address carried in the application layer data into the destination IP address in the request message, so that the source IP address in the response message is the same as the destination IP address carried in the request message, and finally the client and the server establish a sub-connection.

[0066] In the embodiments of the present application, for step 101, the data message includes a message line, a message header, and a message body. The message line includes multiple fields for declaring communication parameters. Among them, such fields include fields for declaring the communication protocol. Correspondingly, it can be determined whether the data message is a message that adopts the OPCDA protocol by the field value of the field for declaring the communication protocol.

[0067] In an embodiment of the present application, for step 102, the message header may further include a field for declaring the message type. Through this field, it can be determined whether the data message is a request message or a response message. For example, if the field value is "request", it is a request message.

[0068] In an alternative embodiment, before replacing the first address information with the second address information based on the position of the first address information in the application layer data in step 101, the method of the embodiment of the present application further includes the following steps:

[0069] Obtain the request message sent by the client to the server;

[0070] Extract the five-tuple information in the request message;

[0071] Determine the second address information based on the five-tuple information in the request message.

[0072] In the above alternative embodiment, since the gateway device can obtain the request message sent by the client to the server, by obtaining the request message sent by the client to the server, the five-tuple information in the request message can be further extracted, and the second address information can be determined based on the five-tuple information in the request message.

[0073] In the above alternative embodiment, the five-tuple information refers to the source IP address, source port, destination IP address, destination port, and transport layer protocol.

[0074] In an alternative embodiment, the step of determining whether the data message is a message carrying address information in the application layer data includes the following sub-steps:

[0075] Identify the interface field and opnum field in the data message;

[0076] Determine whether the data message is a message carrying address information in the application layer data based on the field value of the interface field and the field value of the opnum field.

[0077] In the above alternative embodiment, since the opcda protocol message specifies the interface through the interface field and the method through the opnum field, where when using a specific method and interface, the application layer data in the response message will carry address information, by identifying the interface field and opnum field in the data message, it can be further determined whether the data message is a message carrying address information in the application layer data based on the field value of the interface field and the field value of the opnum field.

[0078] In an alternative embodiment, the step of determining whether a data packet is a packet carrying address information in the application layer based on the field value of the interface field and the field value of the opnum field includes the following sub-steps:

[0079] Determine whether the field value of the interface field is a value in the first numerical table, and determine whether the field value of the opnum field is a value in the second numerical table;

[0080] When the field value of the interface field is a value in the first numerical table and the field value of the opnum field is a value in the second numerical table, it is determined that the data packet is a packet carrying address information in the application layer.

[0081] In the above alternative embodiment, by determining whether the field value of the interface field is a value in the first numerical table and determining whether the field value of the opnum field is a value in the second numerical table, and then when the field value of the interface field is a value in the first numerical table and the field value of the opnum field is a value in the second numerical table, it is possible to determine that the data packet is a packet carrying address information in the application layer.

[0082] In the above alternative embodiment, the first data table is shown in Table 1, where Table 1 is:

[0083] Interface Name Method Name IOXIDResolver SERVERALIVE2 ISystemActivator REMOTECREATEINSTANCE IConnectionPointContainer FINDCONNECTIONPOINT IOPCServer ADDGROUP IOPCBrowseServerAddressSpace BROWSEOPCITEMIDS IOPCServerList ENUMCLASSESOFCATEGORIES

[0084] Table 1

[0085] In an alternative embodiment, the step of modifying the address information carried in the application layer to replace the address information carried in the application layer with second address information includes the following sub-steps:

[0086] Take the address information carried in the application layer as the first address information;

[0087] Determine the fixed offset position of the first address information in the application layer data;

[0088] Based on the fixed offset position, replace the first address information with the second address information.

[0089] In the above alternative embodiment, by taking the address information carried in the application layer as the first address information, it is possible to determine the fixed offset position of the first address information in the application layer data, and then it is possible to replace the first address information with the second address information based on the fixed offset position.

[0090] In the above optional embodiment, the response message is a binary file. Among them, in the binary file, if the response message has only a single address, the second address offset position is also fixed. In this way, based on the fixed offset position, the first address information is replaced with the second address information. For example, in the binary file, the data from the 32nd bit to the 53rd bit points to the address information carried in the application layer data, that is, it points to the source IP address in the application layer data. At this time, only the data from the 32nd bit to the 53rd bit needs to be replaced with the binary data corresponding to the second address information.

[0091] In an optional embodiment, the address information carried in the application layer data is modified to replace the address information carried in the application layer data with the second address information, including the following sub-steps:

[0092] Convert the second address information into first binary data;

[0093] Convert the address information carried in the application layer data into second binary data;

[0094] Based on a sliding window, start matching from the head of the application layer data to determine whether there is a data segment in the application layer data that is the same as the second binary data. If it exists, replace the same data segment with the first binary data.

[0095] In the above optional embodiment, by converting the second address information into first binary data and converting the address information carried in the application layer data into second binary data, it is then possible to start matching from the head of the application layer data based on a sliding window to determine whether there is a data segment in the application layer data that is the same as the second binary data. If it exists, replace the same data segment with the first binary data. If it exists, replace the same data segment with the binary data.

[0096] Furthermore, the above optional embodiment can be applied to the situation where the application layer data in the response message carries multiple source IP addresses. For example, when the server has multiple network cards, the application layer data carries multiple source IP addresses. Correspondingly, when the application layer data carries multiple source IP addresses, the fixed offset position only points to the start of multiple IP data in the binary file at this time, and cannot point to the complete IP position. For this situation, it is possible to start matching from the head of the application layer data based on a sliding window to determine whether there is a data segment in the application layer data that is the same as the second binary data. If it exists, replace the same data segment with the first binary data.

[0097] After converting the address information carried in the application layer data into the second binary data and before matching from the head of the application layer data based on the sliding window, the method of the embodiment of the present application further includes the following steps:

[0098] Set the sliding window based on the second binary data, where the length of the sliding window is equal to the length of the second binary data.

[0099] In the above optional implementation manner, the sliding window can be set based on the second binary data.

[0100] It should be noted that for the relevant description of the sliding window used for matching, please refer to the prior art, and the embodiments of the present application will not elaborate on this.

[0101] Embodiment 2

[0102] Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of a message processing device disclosed in the embodiment of the present application. As Figure 2 shown, the device of the embodiment of the present application includes the following functional modules:

[0103] A receiving module 201, configured to receive data messages;

[0104] A first judgment module 202, configured to judge whether the data message is an opcda protocol message when receiving the data message;

[0105] A second judgment module 203, configured to judge whether the data message is a response message returned by the server when the data message is an opcda protocol message;

[0106] A third judgment module 204, configured to judge whether the data message is a message carrying address information in the application layer when the data message is a response message;

[0107] A modification module 205, configured to modify the address information carried in the application layer data to replace the address information carried in the application layer data with a second address information when the data message is a message carrying address information in the application layer, where the second address information is the destination address in the request message, and the address information carried in the application layer data is the source address carried in the application layer data.

[0108] The device of the embodiment of the present application can perform address conversion on the response message that adopts the opcda protocol and carries address information by executing the message processing method, that is, replace the source address of the response message with the destination address in the request message, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on the response message that adopts the opcda protocol and carries address information.

[0109] It should be noted that for other detailed descriptions of the device in the embodiments of the present application, please refer to the relevant descriptions in Embodiment 1 of the present application, and the embodiments of the present application will not elaborate on this.

[0110] Embodiment 3

[0111] Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of an electronic device disclosed in the embodiments of the present application. As Figure 3 shown, the electronic device in the embodiments of the present application includes:

[0112] a processor 301; and

[0113] a memory 302 configured to store machine-readable instructions, which, when executed by the processor, execute the message processing method according to any one of the foregoing embodiments.

[0114] By executing the message processing method, the electronic device in the embodiments of the present application can further perform address conversion on the response message that adopts the OPCDA protocol and carries address information, that is, replace the source address of the response message with the destination address in the request message, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on the response message that adopts the OPCDA protocol and carries address information.

[0115] Embodiment 4

[0116] The embodiments of the present application provide a storage medium storing a computer program, and the computer program is executed by a processor to perform the message processing method according to any one of the foregoing embodiments.

[0117] By executing the message processing method, the storage medium in the embodiments of the present application can further perform address conversion on the response message that adopts the OPCDA protocol and carries address information, that is, replace the source address of the response message with the destination address in the request message, so that the client and the server can establish a connection normally. Compared with the prior art, the present application can perform address conversion on the response message that adopts the OPCDA protocol and carries address information.

[0118] In the embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed coupling or direct coupling or communication connection between each other can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0119] In addition, the units described as separate components may or may not be physically separated, and 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 network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0120] Furthermore, in each embodiment of the present application, the various functional modules may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.

[0121] It should be noted that if a function is implemented in the form of a software functional module 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 application, in essence, or the part that contributes to the prior art, or a part of this 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 for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0122] In this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0123] The above are only embodiments of the present application and are not used to limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A message processing method, characterized in that, The method includes: When receiving a data packet, determining whether the data packet is an OPCDA protocol packet; When the data packet is the OPCDA protocol packet, determining whether the data packet is a response packet returned by the server; When the data packet is the response packet, determining whether the data packet is a packet with address information carried in the application layer data; When the data packet is a packet with address information carried in the application layer data, modifying the address information carried in the application layer data to replace the address information carried in the application layer data with second address information, where the second address information is the destination address in the request packet, and the address information carried in the application layer data is the source address carried in the application layer data; And, determining whether the data packet is a packet with address information carried in the application layer data includes: Identifying the interface field and the opnum field in the data packet; Based on the field value of the interface field and the field value of the opnum field, determining whether the data packet is a packet with address information carried in the application layer data.

2. The method according to claim 1, characterized in that, The determining whether the data packet is a packet with address information carried in the application layer data based on the field value of the interface field and the field value of the opnum field includes: Determining whether the field value of the interface field is a value in a first numerical table and determining whether the field value of the opnum field is a value in a second numerical table; When the field value of the interface field is a value in the first numerical table and the field value of the opnum field is a value in the second numerical table, determining that the data packet is a packet with address information carried in the application layer data.

3. The method according to claim 1, characterized in that The modifying the address information carried in the application layer data to replace the address information carried in the application layer data with second address information includes: Regarding the address information carried in the application layer data as first address information; Determining a fixed offset position of the first address information in the application layer data; Based on the fixed offset position, replacing the first address information with the second address information.

4. The method according to claim 3, wherein Before the replacing the first address information with the second address information based on the fixed offset position, the method further includes: Obtaining the request packet sent by the client to the server; Extracting the five-tuple information in the request packet; Based on the five-tuple information in the request packet, determining the second address information.

5. The method according to claim 1, characterized in that, The modifying the address information carried in the application layer data to replace the address information carried in the application layer data with second address information includes: Converting the second address information into first binary data; Converting the address information carried in the application layer data into second binary data; Based on a sliding window, starting from the head of the application layer data for matching to determine whether there is a data segment in the application layer data that is the same as the second binary data. If so, replacing the same data segment with the first binary data.

6. The method according to claim 5, wherein After converting the address information carried by the application layer data into second binary data and before matching from the head of the application layer data based on a sliding window, the method further includes: Setting the sliding window based on the second binary data, where the length of the sliding window is equal to the length of the second binary data.

7. A message processing device, characterized in that, The apparatus includes: A receiving module, configured to receive a data packet; A first determination module, configured to determine whether the data packet is an OPCDA protocol packet when the data packet is received; A second determination module, configured to determine whether the data packet is a response packet returned by the server when the data packet is the OPCDA protocol packet; A third determination module, configured to determine whether the data packet is a packet carrying address information of the application layer data when the data packet is the response packet; A modification module, configured to modify the address information carried by the application layer data to replace the address information carried by the application layer data with second address information when the data packet is a packet carrying address information of the application layer data, where the second address information is the destination address in the request packet and the address information carried by the application layer data is the source address carried by the application layer data; Moreover, determining whether the data packet is a packet carrying address information of the application layer data includes: Identifying the interface field and the opnum field in the data packet; Determining whether the data packet is a packet carrying address information of the application layer data based on the field value of the interface field and the field value of the opnum field.

8. An electronic device, characterized in that, Includes: A processor; And A memory, configured to store machine-readable instructions that, when executed by the processor, execute the packet processing method according to any one of claims 1-6.

9. A storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, executes the packet processing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • DNS (Domain Name System) transparent proxy method, device and equipment and storage medium

    CN109561172A