Message detection method and device and related equipment

By automatically parsing and restoring message data, the problem of manual operation required for message detection in existing technologies is solved, achieving seamless, efficient message detection and secure transmission.

CN121357271APending Publication Date: 2026-01-16CHINA MOBILE GROUP ANHUI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511582065.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-01-16

Smart Images

  • Figure CN121357271A_ABST
    Figure CN121357271A_ABST
Patent Text Reader

Abstract

The invention provides a message detection method and device and related equipment, and the method comprises the steps: carrying out the analysis of received target data, and obtaining target message data; and when the target message data is the message data of a real-time communication mechanism and the target message data is preset message data, restoring a target file corresponding to a target message data set based on the received target message data set, the target message data set comprises the target message data and at least one message data received before the target message data; and detecting the target file.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a message detection method and device and related equipment. BACKGROUND

[0002] With the development of Internet technology, electronic devices can realize mutual communication through message transmission. In order to ensure the security of transmission, electronic devices need to detect message data. However, in the related art, message data can only be detected by manual detection, which is not good for user experience. SUMMARY

[0003] Embodiments of the present application provide a message detection method, device and related equipment, which can automatically detect message data without user awareness, and improve user experience.

[0004] In a first aspect, the embodiments of the present application provide a message detection method, and the method comprises the following steps:

[0005] analyzing received target data to obtain target message data;

[0006] in a case where the target message data is message data of a real-time communication mechanism and the target message data is preset message data, restoring a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data;

[0007] detecting the target file.

[0008] Optionally, the method further comprises the following steps:

[0009] in a case where the detection fails, replacing the target message data with message data of the same format and invalidity; or in a case where the detection passes, sending the target file to a client.

[0010] Optionally, after the target message data is replaced with message data of the same format and invalidity, the method further comprises the following steps:

[0011] updating the target message data set based on the message data of the same format and invalidity;

[0012] generating a first file based on the updated target message data set;

[0013] sending the first file to the client.

[0014] Optionally, the preset message data is the last message data of the current message transmission.

[0015] Optionally, the parsing of the received target data comprises:

[0016] The target data is parsed, target content is extracted from the parsed target data, and the target content is taken as the target message data.

[0017] Optionally, the detection of the target file comprises:

[0018] The target file is detected by a virus detection module.

[0019] In a second aspect, an embodiment of the present application provides a message detection device, comprising:

[0020] a parsing module, configured to parse received target data to obtain target message data;

[0021] a restoring module, configured to, in a case where the target message data is message data of a real-time communication mechanism and the target message data is preset message data, restore a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data;

[0022] a detection module, configured to detect the target file.

[0023] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a program stored in the memory and executable on the processor, and when the program is executed by the processor, the steps of the message detection method according to the first aspect are implemented.

[0024] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the message detection method according to the first aspect are implemented.

[0025] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, and when the computer instructions are executed by a processor, the steps of the message detection method according to the first aspect are implemented.

[0026] In the embodiments of the present application, the electronic device can parse the target data to obtain target message data after receiving the target data. In the case that the target message data is message data of a real-time communication mechanism and the target message data is preset message data, the electronic device can restore a corresponding target file based on the target message data and at least one message data received before the target message data, and detect the target file. In this process, the electronic device can automatically perform parsing, restoring, detecting and the like after receiving the target data without user awareness, which reduces manual operation of the user and greatly improves user experience. BRIEF DESCRIPTION OF DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0028] Figure 1 is one of the flowcharts of the message detection method provided by the embodiments of the present application;

[0029] Figure 2 is the second flowchart of the message detection method provided by the embodiments of the present application;

[0030] Figure 3 is the interaction schematic diagram between the server, the client and the electronic device provided by the embodiments of the present application;

[0031] Figure 4 is the structural schematic diagram of the message detection device provided by the embodiments of the present application;

[0032] Figure 5 is the structural schematic diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.

[0034] Embodiments of the present application can be applied on an electronic device. If the application scenario is a real-time communication mechanism scenario, the electronic device can be a gateway device, which is configured to receive target data sent by a server of a real-time communication mechanism, detect a file corresponding to message data in the target data, and send the detected data to a client of the real-time communication mechanism. Embodiments of the present application can also be applied in other scenarios, which are not limited herein.

[0035] Referring to Figure 1 , Figure 1 is one of flowcharts of a message detection method provided by embodiments of the present application, as shown in Figure 1 , the method comprises the following steps:

[0036] Step 101: Analyzing received target data to obtain target message data.

[0037] In this embodiment, the target data is composed of a header file, target message data, etc. The electronic device can obtain the target message data by analysis.

[0038] Optionally, the analysis of the received target data to obtain the target message data comprises:

[0039] Analyzing the target data, extracting target content from the analyzed target data, and taking the target content as the target message data.

[0040] In this embodiment, the target content is a protocol of the message data and a data segment of the message data, and the message data comprises a protocol, a data segment, etc. The electronic device can receive target data sent by a server of a real-time communication mechanism, analyze the target data to obtain a header file and target content, extract the target content to obtain target message data in the case that the protocol of the message data is a message protocol of the real-time communication mechanism. The electronic device can also analyze details in the message data to determine whether the message data is part of a file, and continue the subsequent file restoration operation in the case that the message data is part of a file.

[0041] It can be understood that, in this embodiment, the electronic device can obtain the target message data by extracting the target content from the analyzed target data, which facilitates the subsequent restoration of the message data and the detection of the restored file.

[0042] Step 102: In the case that the target message data is a message data of a real-time communication mechanism, and the target message data is preset message data, restoring a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data.

[0043] In this embodiment, the electronic device can restore the target message data set into a target file in an integrated manner. For example, the electronic device can integrate the data segments in each message data in the target message data set according to the order of the message data in the target message data set, to obtain the target file.

[0044] In some embodiments, the preset message data is the last message data in the current message transmission.

[0045] It can be understood that, in this embodiment, the electronic device only restores the target message data when the target message data is the preset message data, which can ensure the integrity of the restored file and is more conducive to subsequent detection of the file.

[0046] Step 103: detecting the target file.

[0047] In some embodiments, the detection of the target file includes:

[0048] detecting the target file for viruses by a virus detection module.

[0049] It can be understood that, in this embodiment, the electronic device detects the target file for viruses by the virus detection module to determine whether the target file carries viruses, thereby verifying the security of the target file and ensuring the security of the message transmission process.

[0050] It can be understood that, in the above steps 101-103, the electronic device can analyze the target data to obtain the target message data after receiving the target data. When the target message data is message data of a real-time communication mechanism and the target message data is the preset message data, the electronic device can restore the corresponding target file based on the target message data and at least one message data received before the target message data, and detect the target file. In this process, the electronic device can automatically analyze, restore, detect, and the like after receiving the target data without user awareness, which reduces manual operation of the user and greatly improves user experience.

[0051] In some embodiments, in the case of detection failure, the target message data is replaced with message data of the same format and invalid; or, in the case of detection success, the target file is sent to the client.

[0052] It can be understood that in this embodiment, the electronic device replaces the target message data with message data of the same format and invalidity in the case of detection failure, which can prevent the unsafe message data that fails to pass the detection from continuing transmission, thereby ensuring the safety of the message transmission process. In the case of detection passing, the electronic device can directly send the target file to the client, and the client does not need to restore the file, thereby reducing the computing power of the client.

[0053] In some embodiments, after the target message data is replaced with message data of the same format and invalidity, the method further includes:

[0054] updating the target message data set based on the message data of the same format and invalidity;

[0055] generating a first file based on the updated target message data set;

[0056] sending the first file to the client.

[0057] In this embodiment, the electronic device replaces the target message data with message data of the same format and invalidity, that is, replaces the target message data in the target message data set, updates the target message data set, and then integrates the data segments in each message data according to the order of each message data in the target message data set to obtain a first file, and sends the first file to the client.

[0058] It can be understood that in this embodiment, the electronic device replaces the target message data with message data of the same format and invalidity, which can prevent the unsafe message data that fails to pass the detection from continuing transmission, thereby ensuring the safety of the message transmission process. The electronic device sends the first file to the client, which can make the client not need to restore the file, thereby reducing the computing power of the client, and also preventing the unsafe message data from spreading and propagating, thereby facilitating the improvement of network security and the protection of network information security.

[0059] In an embodiment, in the case of detection failure, the electronic device can also send response data to the server, the response data being used to inform the server that the client has received the message data.

[0060] The message detection method will be described in more detail below. Figure 2

[0061] Step 201: Start the electronic device.

[0062] ​In some embodiments, the electronic device can be a gateway device. In the case that the electronic device starts normally and the network access is normal, the electronic device starts to work. Among them, one network port 1 of the electronic device is connected with the client, and the other network port 2 is connected with the server, the network port 1 is used to realize the communication between the electronic device and the client, and the network port 2 is used to realize the communication between the electronic device and the server, and is used to receive target data.

[0063] Step 202: parsing target data to obtain message data.

[0064] Step 203: whether the target message data is message data of a real-time communication mechanism.

[0065] In the case that the target message data is message data of a real-time communication mechanism, step 204 is executed, and in the case that the target message data is not message data of a real-time communication mechanism, the process ends.

[0066] Step 204: whether the target message data is the last message data of this message transmission.

[0067] In the case that the target message data is the last message data of this message transmission, step 205 is executed, and in the case that the target message data is not the last message data of this message transmission, step 202 is executed to continue receiving data and parsing until the last message data of this message transmission is received.

[0068] Step 205: restoring the target file corresponding to the target message data set based on the received target message data set.

[0069] Step 206: detecting the target file.

[0070] In the case that the detection fails, step 207 is executed, and in the case that the detection passes, step 210 is executed.

[0071] Step 207: in the case that the detection fails, replacing the target message data with message data of the same format and invalid.

[0072] Step 208: updating the target message data set based on the message data of the same format and invalid, and generating a first file based on the updated target message data set.

[0073] Step 209: sending the first file to the client.

[0074] Step 210: in the case that the detection passes, sending the target file to the client.

[0075] Figure 3The figure is an interaction flowchart between an electronic device, a server and a client. One end of the electronic device can be connected to a server, and the other end of the electronic device can be connected to one or more clients. The electronic device comprises a target data receiving module, a data analysis module, a message analysis module, a file restoration module, a virus detection module and a data sending module. The target data receiving module is configured to receive target data sent by the server. The data analysis module is configured to analyze the target data to obtain target message data. The message analysis module is configured to determine whether the target message data is message data of a real-time communication mechanism, whether the target message data is the last message data of this message transmission, and whether the target message data can be restored into a file. The file restoration module is configured to restore a target message data set into a file. The virus detection module is configured to detect the file for viruses. The data sending module is configured to send the file to the client and send response data to the server.

[0076] It can be understood that, in the above embodiment of the present application, the electronic device can analyze, detect and the like the message without the user's awareness, so as to determine whether the file corresponding to the message data has viruses, ensure the safety of message transmission, and facilitate the user to identify unsafe message data. The electronic device restores the file by the restoration manner without knowing the user's password, key, private key, public key and the like, so as to improve the detection efficiency.

[0077] The other electronic device can be determined to use the embodiment of the present application by analyzing the source code on the other electronic device, software running results (including software interface, running input parameter, prompt information and the like), and the like. The other electronic device can also be determined to use the embodiment of the present application by constructing a simulation scene, simulating the user's use, and testing technical means such as packet capture analysis of input and output data.

[0078] Referring to Figure 4 , Figure 4 is a structural schematic diagram of a message detection device provided by the embodiment of the present application, as Figure 4 shown, the message detection device 400 comprises:

[0079] The analysis module 401 is configured to analyze the received target data to obtain target message data.

[0080] The restoration module 402 is configured to, in a case where the target message data is message data of a real-time communication mechanism and the target message data is preset message data, restore a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data.

[0081] The detection module 403 is configured to detect the target file.

[0082] Optionally, the packet detection apparatus 400 further comprises:

[0083] The replacement module is configured to replace the target packet data with packet data of the same format and invalidity in case of detection failure; or

[0084] The first sending module is configured to send the target file to the client in case of detection success.

[0085] Optionally, the packet detection apparatus 400 further comprises:

[0086] The update module is configured to update the target packet data set based on the packet data of the same format and invalidity.

[0087] The generation module is configured to generate a first file based on the updated target packet data set.

[0088] The second sending module is configured to send the first file to the client.

[0089] Optionally, the preset packet data is the last packet data of the current packet transmission.

[0090] Optionally, the analysis module 401 further comprises:

[0091] The extraction sub-module is configured to analyze the target data, extract target content from the analyzed target data, and take the target content as the target packet data.

[0092] The packet detection apparatus 400 corresponds to each process of each embodiment of the packet detection method in a one-to-one manner, and can achieve the same technical effects. To avoid repetition, details are not described here.

[0093] The electronic device provided in the embodiment of the present application also has the similar problem solving principle as the packet detection method in the embodiment of the present application. Therefore, the implementation of the electronic device can refer to the implementation of the method shown in Figure 1 , and details are not described here. As shown in Figure 5 , the electronic device of the embodiment of the present application comprises: a processor 510 configured to read a program in a memory 520 and execute the following processes:

[0094] analyzing the received target data to obtain target packet data;

[0095] In a case where the target message data is message data of a real-time communication mechanism and the target message data is preset message data, the target file corresponding to the target message data set is restored based on the received target message data set, the target message data set including the target message data and at least one message data received before the target message data.

[0096] The target file is detected.

[0097] Optionally, the processor 510 is further configured to read a program in the memory 520 and perform the following steps:

[0098] In a case where the detection fails, the target message data is replaced by message data of the same format and invalid; or in a case where the detection succeeds, the target file is sent to the client.

[0099] Optionally, the processor 510 is further configured to read a program in the memory 520 and perform the following steps:

[0100] The replacing of the target message data by message data of the same format and invalid further includes:

[0101] The target message data set is updated based on the message data of the same format and invalid;

[0102] A first file is generated based on the updated target message data set.

[0103] The first file is sent to the client.

[0104] Optionally, the processor 510 is further configured to read a program in the memory 520 and perform the following steps:

[0105] The preset message data is the last message data of the current message transmission.

[0106] Optionally, the processor 510 is further configured to read a program in the memory 520 and perform the following steps:

[0107] The target message data is obtained by analyzing the received target data.

[0108] The target data is analyzed, target content is extracted from the analyzed target data, and the target content is taken as the target message data.

[0109] Optionally, the processor 510 is further configured to read a program in the memory 520 and perform the following steps:

[0110] The detection of the target file includes:

[0111] The target file is subjected to virus detection by a virus detection module.

[0112] The application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement each process of the packet detection method and achieve the same technical effects. To avoid repetition, details are not described herein. The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk, and the like.

[0113] The application further provides a computer program product, which includes computer instructions. The computer instructions are executed by a processor to implement each process of the packet detection method and achieve the same technical effects. To avoid repetition, details are not described herein.

[0114] It should be noted that in this document, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, so that processes, methods, articles, or devices that include a series of elements not only include those elements, but also include other elements not explicitly listed, or include elements inherent to such processes, methods, articles, or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article, or device that includes the element. In addition, it should be pointed out that the scope of the methods and devices in the present application is not limited to performing functions in the order discussed, but can also include performing functions in a substantially simultaneous manner or in reverse order, for example, the described method can be performed in an order different from that described, and various steps can be added, omitted, or combined. In addition, features described with reference to certain examples can be combined in other examples.

[0115] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and a necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, an optical disk), and includes a plurality of instructions for causing a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0116] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the specific embodiments described above, and the specific embodiments described above are merely illustrative, but not restrictive, and a person of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims.

Claims

1. A method of packet inspection, the method comprising: The method comprises: parsing the received target data to obtain target message data; in the case that the target message data is message data of a real-time communication mechanism and the target message data is preset message data, restoring a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data; detecting the target file.

2. The method of claim 1, wherein, The method further comprises: in the case of detection failure, replacing the target message data with message data of the same format and invalidity; or in the case of detection success, sending the target file to a client.

3. The method of claim 2, wherein, After the target message data is replaced with message data of the same format and invalidity, the method further comprises: updating the target message data set based on the message data of the same format and invalidity; generating a first file based on the updated target message data set; sending the first file to a client.

4. The method of claim 1, wherein, The preset message data is the last message data of the current message transmission.

5. The method of claim 1, wherein, The parsing of the received target data to obtain target message data comprises: parsing the target data, extracting target content from the parsed target data, and taking the target content as the target message data.

6. The method of claim 1, wherein, The detection of the target file comprises: detecting the target file for viruses by a virus detection module.

7. A packet inspection apparatus, characterized by comprising: It comprises: a parsing module configured to parse received target data to obtain target message data; a restoring module configured to, in the case that the target message data is message data of a real-time communication mechanism and the target message data is preset message data, restore a target file corresponding to a target message data set based on the received target message data set, the target message data set comprising the target message data and at least one message data received before the target message data; a detection module configured to detect the target file.

8. An electronic device, comprising: It comprises: a processor, a memory, and a program stored on the memory and executable on the processor, the program being executed by the processor to implement the steps in the message detection method according to any one of claims 1 to 6.

9. A computer readable storage medium for storing a computer program, characterized in that, The computer program is executed by the processor to implement the steps in the message detection method according to any one of claims 1 to 6.

10. A computer program product, characterised in that, It comprises computer instructions that, when executed by a processor, implement the steps in the message detection method according to any one of claims 1 to 6.