Method for capturing data packet and electronic equipment

By receiving data packet collection tasks in network equipment, capturing and marking time-stamped data packet files, the problem of insufficient packet capture capabilities of installation and maintenance personnel is solved, and more efficient data packet acquisition and fault location are achieved.

CN118802496APending Publication Date: 2024-10-18CHINA MOBILE GROUP ZHEJIANG +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410165373.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-05
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Installation and maintenance personnel have limited packet capture capabilities, which results in the data packets to be analyzed often not being targeted enough, affecting fault location efficiency.

Method used

Receive data packet collection tasks through network devices, capture data packets and save them in packet capture files. Each file is marked with a target timestamp, including start timestamp, end timestamp and intermediate timestamp, and send packet capture files to the target device. , so that it can obtain the data packets to be analyzed based on the timestamp.

Benefits of technology

It improves the pertinence of data package acquisition, reduces dependence on the skills of installation and maintenance personnel, simplifies the fault location process, and improves fault handling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118802496A_ABST
    Figure CN118802496A_ABST
Patent Text Reader

Abstract

The invention discloses a method for capturing a data packet and electronic equipment, and belongs to the field of communication. The method comprises the following steps: network equipment receives a data packet acquisition task; the network device captures a data packet based on the data packet acquisition task, and stores the captured data packet in a packet capture file; wherein each packet capture file comprises a plurality of data packets, the time span of the plurality of data packets is a preset target duration, each packet capture file is marked with a target timestamp, and the target timestamp comprises a start timestamp, an end timestamp and an intermediate timestamp; and the network device sends the packet capture file to a target device, so that the target device obtains a to-be-analyzed data packet from the packet capture file based on the target timestamp.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of communications, and specifically relates to a method and electronic device for capturing data packets. Background Art

[0002] In recent years, the number of broadband users has been increasing, and network complaints and failure incidents have occurred frequently. The current quality analysis and problem troubleshooting of Internet services mainly rely on installation and maintenance personnel to visit the site, reproduce the failure, capture packets and send them to the back-end optimization personnel to locate the failure.

[0003] In the process of locating faults, capturing data packets to be analyzed is an important step. However, due to the high mobility and limited technical level of installation and maintenance personnel, some installation and maintenance personnel often have weak business packet capture capabilities, and the data packets to be analyzed are often not targeted enough.

[0004] Therefore, a new data packet capture method is needed that does not need to overly rely on the packet capture capabilities of installation and maintenance personnel. Summary of the invention

[0005] The embodiments of the present application provide a method and electronic device for capturing data packets, which can obtain data packets to be analyzed in a targeted manner, thereby solving the problem in related technologies that the limited packet capturing capabilities of installation and maintenance personnel result in the acquired data packets to be analyzed being often not targeted enough.

[0006] In a first aspect, a method for capturing a data packet is provided, comprising:

[0007] The network device receives the data packet collection task;

[0008] The network device captures data packets based on the data packet collection task, and saves the captured data packets in a captured packet file; wherein each captured packet file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each captured packet file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0009] The network device sends the packet capture file to the target device, so that the target device obtains the data packet to be analyzed from the packet capture file based on the target timestamp.

[0010] In a second aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0011] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed, the steps of the method described in the first aspect are implemented.

[0012] According to a fourth aspect, a computer program product is provided, characterized in that it comprises a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0013] At least one of the above technical solutions provided in the embodiments of the present application can achieve the following technical effects:

[0014] In an embodiment of the present application, a data packet is captured; a network device receives a data packet collection task; the network device captures a data packet based on the data packet collection task, and saves the captured data packet in a capture file; wherein each capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; the network device sends the capture file to the target device, so that the target device obtains the data packet to be analyzed from the capture file based on the target timestamp. In this way, by saving the captured data packet in the capture file, and since each capture file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp, in this way, compared with the related art that relies on manual determination of the data packet to be analyzed, the method of determining the data packet to be analyzed by the target timestamp in the embodiment of the present application is more targeted, and the target device can determine the data packet to be analyzed from the capture file in a targeted manner according to the target timestamp, thereby solving the problem that the limited capture ability of the installation and maintenance personnel in the related art leads to the data packet to be analyzed being often not targeted enough. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0016] Figure 1 is a schematic diagram of an example deployment environment of a method for capturing data packets provided in an embodiment of the present application;

[0017] Figure 2 is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0018] Figure 3is a schematic diagram of a target timestamp in a packet capture file provided in an embodiment of the present application;

[0019] Figure 4 is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0020] Figure 5 is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0021] Figure 6 It is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0022] Figure 7 is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0023] Figure 8 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application;

[0024] Fig. 9 is a flow chart of a method for capturing data packets provided in an embodiment of the present application;

[0025] Fig.10 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application;

[0026] Fig.11 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application;

[0027] Fig.12 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application;

[0028] Fig.13 It is a structural block diagram of a device for capturing data packets provided in an embodiment of the present application;

[0029] Fig.14 It is a structural block diagram of a device for capturing data packets provided in an embodiment of the present application;

[0030] Fig.15 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0033] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] The method for capturing data packets provided in the embodiments of the present application is applied to the communication field, such as broadband service scenarios, and in particular, can be applied to home broadband service fault handling scenarios. In the scenario of a user's home broadband connection, a network device (such as a router) can be connected to a target device (such as a control center or a server). Taking the network device as a router and the target device as a control center as an example, the router can capture the user's Internet data packets and send them to the control center for storage. When the user's broadband service fails, the control center can find the corresponding historical data of the failure based on the stored data packets and the time point of the failure and analyze and process them.

[0035] The method for capturing data packets provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0036] See also Figure 1 , Figure 1 is a schematic diagram of an example deployment environment of a method for capturing data packets provided in an embodiment of the present application, such as Figure 1As shown, the network device can be connected to the target device via the Internet, wherein the target device may include a storage device, or the storage device may be located outside the target device. The target device can be connected to the network device via a virtual private network (VPN), and the network device is used to receive the data packet collection task sent by the target device, wherein the network device can be a router, or other devices with a function of capturing data packets, and the network device will send the data packet to the target device after capturing the data packet, wherein the target device can be an electronic device or multiple electronic devices. The method for capturing data packets provided in the embodiment of the present application can be performed by an electronic device, wherein the electronic device can be, for example, a control center, or a server, such as an independent physical server, a server cluster composed of multiple servers, and a cloud server capable of cloud storage. In the case where the method for capturing data packets provided in the embodiment of the present application is performed by multiple electronic devices, these multiple electronic devices can form a service cluster, and they cooperate with each other to complete each step.

[0037] See also Figure 2 , Figure 2 A flowchart of a method for capturing data packets provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method comprises the following steps:

[0038] Step 210: The network device receives a data packet collection task;

[0039] In an embodiment of the present application, a network device receives a data packet collection task sent from a target device, and the network device may be a packet capture router equipped with Merlin firmware, wherein Merlin firmware is a router software system, and a general router software system cannot realize the data packet collection function, while a router developed based on the Merlin system has the function of capturing data packets. The target device may be a server, and the network device is connected to the target device through a network such as a VPN, and the network device receives the data packet collection task sent by the target device and starts to capture data packets.

[0040] Step 220: The network device captures data packets based on the data packet collection task;

[0041] In an embodiment of the present application, the data packet may be the data of a user's Internet access, such as browsing web pages, reading documents, reading novels, watching live broadcasts, watching short videos, watching movies, and other functions that require Internet access to be used. When a user performs these services, Internet access data will be generated to form a data packet.

[0042] Step 230: The network device saves the captured data packets in a captured packet file; wherein each captured packet file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each captured packet file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0043] In the embodiment of the present application, the packet capture file is a collection of all data packets captured by the network device within a preset target duration. For example, the preset target duration can be set to 10 minutes. When the network device receives a data packet collection task sent by the target device, the network device starts to capture data packets and saves the captured data packets as a packet capture file in the local memory of the network device every 10 minutes. A packet capture file includes multiple data packets.

[0044] In an embodiment of the present application, the preset target duration can be set according to the type of data packet and the size of the data packet. Figure 3 The figure is a schematic diagram of a packet capture file provided by an embodiment of the present application. The preset target duration can be set to 10 minutes, and the data packets captured by the network device within 10 minutes are collected as a packet capture file. Figure 3 As shown, each packet capture file corresponds to a start timestamp T1 and an end timestamp T2 ten minutes later. In addition, within the 10-minute period, intermediate timestamps can be inserted into the packet capture file at regular intervals. For example, the first intermediate timestamp t1 can be inserted at an interval of 2.5 minutes, the second intermediate timestamp t2 can be inserted at an interval of 2.5 minutes from the first intermediate timestamp, and the third intermediate timestamp t3 can be inserted at an interval of 2.5 minutes from the second intermediate timestamp. Figure 3 In the example, a packet capture file includes several data packets, 1 start timestamp, 1 end timestamp, and 3 intermediate timestamps.

[0045] Step 240: The network device sends the packet capture file to the target device, so that the target device obtains the data packet to be analyzed from the packet capture file based on the target timestamp.

[0046] In an embodiment of the present application, the network device may send the packet capture file to the target device at intervals of the preset target time length. After sending the packet capture file to the target device, the network device may delete the local packet capture file to save memory space of the network device.

[0047] In an embodiment of the present application, the network device is, for example, a router, the target device is, for example, a control center, and the data packets contained in the packet capture file are, for example, data packets of a user's home broadband Internet access, and the target timestamp may be marked on the packet capture file. When a user's Internet access is stuck, the user can transmit the stuck time point to the target device via the network device with the help of the terminal used by the user, and then the target device can obtain the stuck time point. Among them, the stuck time point is the time point when the user perceives a network failure while surfing the Internet. Of course, in an embodiment of the present application, the user can also inform the relevant operation and maintenance personnel by phone or network complaint platform, and the relevant operation and maintenance personnel upload the time point to the target device. The target device finds the target packet capture file corresponding to the stuck time point according to the start timestamp and end timestamp of each packet capture file saved (hereinafter referred to as the current packet capture file), and counts the total data volume of the data packets in the current packet capture file, and obtains the data packets to be analyzed according to different acquisition methods according to the total data volume of the data packets in the current packet capture file.

[0048] In an embodiment of the present application, a data packet is captured; a network device receives a data packet collection task; the network device captures a data packet based on the data packet collection task, and saves the captured data packet in a capture file; wherein each capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; the network device sends the capture file to the target device, so that the target device obtains the data packet to be analyzed from the capture file based on the target timestamp. In this way, by saving the captured data packet in the capture file, and since each capture file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp, in this way, compared with the related art that relies on manual determination of the data packet to be analyzed, the method of determining the data packet to be analyzed by the target timestamp in the embodiment of the present application is more targeted, and the target device can determine the data packet to be analyzed from the capture file in a targeted manner according to the target timestamp, thereby solving the problem that the limited capture ability of the installation and maintenance personnel in the related art leads to the data packet to be analyzed being often not targeted enough.

[0049] See also Figure 4 , Figure 4 A flowchart of a method for capturing data packets provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the method comprises the following steps:

[0050] Step 410: The network device receives a data packet collection task;

[0051] Step 420: The network device captures data packets based on the data packet collection task;

[0052] Step 430: The network device saves multiple data packets within a preset target time length in a packet capture file;

[0053] In the embodiment of the present application, the multiple data packets are, for example, data packets of a user's home broadband service, including data packets of different services. Depending on the services used by the user when surfing the Internet, different services use different protocols, such as User Datagram Protocol (UDP), Address Resolution Protocol (ARP), Internet Control Message Protocol (ICMP), Hypertext Transfer Protocol (HTTP), Domain Name System (DNS), File Transfer Protocol (FTP), Internet Protocol (IP), Hot Standby Router Protocol (HSRP), Transmission Control Protocol (TCP), Open Shortest Path First (OSPF), Stream Control Transmission Protocol (TCP), etc. The length of the data packets containing different protocols is also different; the ports used by users to surf the Internet for different services are different, for example, port 443 is the web browsing port, port 8080 is the network proxy service port, and port 80 is used by the Hypertext Transfer Protocol. The data packets captured by the network device can be classified according to the protocol and port.

[0054] Step 440: The network device records the start timestamp and the end timestamp in the packet capture file;

[0055] In the embodiments of the present application, Figure 3 As shown, the start timestamp T1 is the current start time point of capture that is synchronously recorded by the network device when it starts to capture data packets. The timestamp format is XXXX.XX.XX.XX.XX.XX, which respectively represent year, month, day, hour, minute, and second, for example, 2023.06.21.14.15.06. The end timestamp T2 is the time point when the network device will synchronously record the end of capture at the end of the preset target duration. The end timestamp format is consistent with the start timestamp format, and the time interval is the preset target duration.

[0056] Step 450: The network device records the intermediate timestamp between the start timestamp and the end timestamp in the packet capture file at every preset time interval;

[0057] In the embodiment of the present application, the format of the intermediate timestamp is consistent with the format of the start timestamp. The number of intermediate timestamps can be one or more, depending on the length of the preset target duration. When the preset target duration is set to be relatively long, multiple intermediate timestamps can be recorded between the start timestamp and the end timestamp, and the time interval between each intermediate timestamp is the preset time interval. Wherein, if the preset target duration is greater than the preset time interval, the preset target duration can be an integer multiple of the preset time interval. For example, Figure 3 As shown, the preset target duration is set to 10 minutes, for example, and the time interval is set to 2.5 minutes, for example. The target device will synchronously record the first intermediate timestamp t1 2.5 minutes after the recording start timestamp T1, synchronously record the second intermediate timestamp t2 2.5 minutes after the first intermediate timestamp t1, and synchronously record the third intermediate timestamp t3 2.5 minutes after the second intermediate timestamp t2. Since the time interval between the time point 2.5 minutes after the third intermediate timestamp t3 and the start timestamp T1 is the preset target duration of 10 minutes, the target device will synchronously record the end timestamp T2 at this time, and save the captured data packets within the preset target duration as a captured packet file, and save it locally.

[0058] Step 460: The network device sends the packet capture file to the target device, so that the target device obtains the data packet to be analyzed from the packet capture file based on the target timestamp.

[0059] In an embodiment of the present application, the network device may include a router installed with Merlin firmware, wherein Merlin firmware is an independent firmware developed based on a router. Compared with general router firmware, Merlin firmware is small in size, provides richer system settings and network functions, and can realize the function of capturing data packets; in addition, Merlin firmware provides a powerful firewall function, which can help users better protect the home network environment, and supports various security protocols and encryption algorithms, making users more assured and secure in the network environment, and is very suitable for users' home broadband network scenarios.

[0060] In an embodiment of the present application, the target device is a server or a control center. The target device can send a packet capture instruction to the network device to implement functions such as task management, data acquisition, and massive storage of data in the cloud; the target device, such as the control center, finds the data packet to be analyzed, such as the data when the user's Internet access is stuck, based on the packet capture file obtained in real time, and analyzes the cause of the user's stuck. Finally, the preliminary analysis results are fed back to the optimization personnel, and the optimization personnel are reminded to conduct further analysis.

[0061] In an embodiment of the present application, multiple data packets within the preset target duration are saved in a packet capture file, a start timestamp and an end timestamp are recorded in the packet capture file, and the intermediate timestamp between the start timestamp and the end timestamp is recorded at every preset time interval in the packet capture file, wherein the preset target duration is greater than the preset time interval, and the preset target duration is an integer multiple of the preset time interval. In this way, by using the form of marking timestamps, it is convenient to find data packets when the number of data packets is large; setting the preset target duration to an integer multiple of the preset time interval can ensure that the time interval between every two adjacent timestamps is the preset time interval. The network device includes a router with Merlin firmware installed, the target device is a server or a control center; the multiple data packets are data packets of home broadband services. In this way, the router can use the packet capture function in the Merlin firmware to capture data packet services, and the router equipped with Merlin firmware sends data packets of home broadband services to the server. The server can analyze the user's Internet data, which can be applied to the user's home broadband service failure scenario.

[0062] See also Figure 5 , Figure 5 A flowchart of a method for capturing data packets provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the method comprises the following steps:

[0063] Step 510: The target device sends a data packet collection task to the network device;

[0064] In an embodiment of the present application, the network device includes a router installed with Merlin firmware, which is connected in series in a user network that requires data packet collection. The target device includes a control center. The router penetrates the user network through a VPN. The user network is interconnected with the cloud storage center of the control platform. The control platform automatically sends the collection task to the router and starts the task of capturing data packets.

[0065] Step 520: The target device receives a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0066] Step 530: The target device determines the data packet to be analyzed from the captured packet file based on the target timestamp.

[0067] In the embodiment of the present application, the data packet to be analyzed is, for example, a user's Internet access data packet, each of which contains different protocols and port data, and is marked with a source IP address and a target IP address. The target device can analyze the user's Internet access service usage according to the source IP address and the target IP address screening rules (including the source IP or the target IP being equal to a certain IP, such as ip.src== or ip.dst==) for the data packet to be analyzed. The target device can classify the data packet by protocol or port according to the different protocols and ports in the data packet formed by the user's Internet access using different services. On this basis, the data packet can also be classified according to the different lengths of the data packets of different protocols. For a set of data packets in the same category, the target device can customize the screening rules to classify each data packet in the category by color. For example, the following table can illustrate the screening rules defined according to the protocol and port. When the target device detects that the corresponding protocol meets the rules in the following table, the corresponding data packet is marked with a corresponding color, wherein "black" indicates that there is a retransmission, "red" indicates that it is disconnected from the server, and "no color" indicates that the data packet interaction is normal. The target device forms a preliminary analysis result based on the preliminary screening of different colors assigned to each data packet.

[0068]

[0069]

[0070] In an embodiment of the present application, a data packet is captured; the target device sends a data packet collection task to the network device; the target device receives a packet capture file sent by the network device based on the data packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; the target device determines the data packet to be analyzed from the packet capture file based on the target timestamp. In this way, by saving the captured data packet in the packet capture file, and since each packet capture file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp, in this way, compared with the related art that relies on manual determination of the data packet to be analyzed, the method of determining the data packet to be analyzed by the target timestamp in the embodiment of the present application is more targeted, and the target device can determine the data packet to be analyzed from the packet capture file in a targeted manner according to the target timestamp, thereby solving the problem that the data packet to be analyzed obtained is often not targeted enough due to the limited packet capture ability of the installation and maintenance personnel in the related art.

[0071] See also Figure 6 , Figure 6 A flowchart of a method for capturing data packets provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the method comprises the following steps:

[0072] Step 610: The target device sends a data packet collection task to the network device;

[0073] Step 620: The target device receives a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0074] Step 630: The target device obtains the time point of service freeze;

[0075] In an embodiment of the present application, the time point of the service freeze is, for example, the time point corresponding to the failure of the network used by the user device connected to the network device (such as a router), and the network includes a home broadband network. For example, when a user browses the web at home using the home broadband network, the web page cannot be loaded or an error is reported. At this time, the user will record the time point when the current failure occurs, and inform the relevant operation and maintenance personnel of the freeze time point by phone or through the network complaint platform, and the operation and maintenance personnel will upload the freeze time point to the target device. Of course, in an embodiment of the present application, the user can also directly use the user device to transmit the freeze time point to the target device.

[0076] Step 640: The target device determines the target packet capture file corresponding to the freeze time point based on the start timestamp and end timestamp of each packet capture file.

[0077] In an embodiment of the present application, the target device finds a packet capture file containing the freeze time point according to the freeze time point, and records it as the target packet capture file, wherein the start timestamp of the current packet capture file is less than or equal to the freeze time point, and the end timestamp of the current packet capture file is greater than or equal to the freeze time point.

[0078] Step 650: The target device determines the data packet to be analyzed based on the target packet capture file.

[0079] In the embodiment of the present application, the target device obtains the time point of the service freeze, and determines the target packet capture file corresponding to the freeze time point based on the start timestamp and end timestamp of each packet capture file; the target device determines the data packet to be analyzed based on the target packet capture file. In this way, when the data volume of the service data packet is large, the target device can obtain the target packet capture file through the freeze time point and timestamp, and determine the data packet to be analyzed based on the packet capture file, which can narrow the search range of the target device.

[0080] See also Figure 7 , Figure 7 A flowchart of a method for capturing data packets provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the method comprises the following steps:

[0081] Step 710: The target device sends a data packet collection task to the network device;

[0082] Step 720: The target device receives a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0083] In the example of the present application, the intermediate timestamp between the start timestamp and the end timestamp is recorded in the packet capture file at every preset time interval; wherein the preset target duration is greater than the preset time interval, and the preset target duration is an integer multiple of the preset time interval.

[0084] Step 730: The target device obtains the time point of service freeze;

[0085] Step 740: The target device determines the target packet capture file corresponding to the freeze time point based on the start timestamp and the end timestamp of each packet capture file;

[0086] Step 750: The target device obtains the total data volume of all data packets in the target packet capture file;

[0087] In an embodiment of the present application, since the total data volume of all data packets in each target packet capture file obtained by the target device varies greatly, it depends on the data volume of different services. For example, the total data volume of all data packets is the data when the user is surfing the Internet. When the service used by the user is a small data volume service, such as browsing web pages, reading documents, reading novels, etc., the total data volume of all data packets in the packet capture file obtained by the target device is relatively small, generally within 10M. When the service used by the user is a large data volume service, such as watching live broadcasts, brushing short videos, watching movies, etc., the total data volume of all data packets in the packet capture file obtained by the target device is relatively large, generally outside 10M. Therefore, before analyzing the data packet, the target device will first calculate the total data volume of all data packets in the target file, and analyze the data packet in different ways according to the total data volume.

[0088] Step 760: The target device determines whether the total data volume is greater than or equal to a threshold;

[0089] In an embodiment of the present application, since the target devices obtain a large difference in the total amount of data, the method of obtaining the data packet to be analyzed in the same manner may make the final analysis result inaccurate. For example, the target packet capture file is used as the data packet to be analyzed to analyze the user's Internet access data. If the total data volume of the target packet capture file does not exceed the threshold, it means that when the user's Internet access is stuck, the service used by the user at this time is a small data volume service. For this type of service, once a network failure occurs, it is difficult for the user to perceive it immediately. Therefore, the stuck time point reported by the user is usually a relatively vague (not precise enough) time point; further considering that if the stuck time point reported by the user is in the first half of the target packet capture file, the data packet that is actually sent and stuck may be in the previous packet capture file of the target packet capture file. Therefore, the target packet capture file is used as the data packet to be analyzed. The target packet capture file may not be able to obtain the cause of the jamming when used as the data packet to be analyzed; if the total data volume of the target packet capture file exceeds the threshold, it means that when the user's Internet access is jammed, the service used by the user at this time is a large data volume service. For this type of service, once a network failure occurs, the user can immediately perceive it, so the jamming time point reported by the user is usually a relatively accurate time point; further considering that the analysis volume of using the target packet capture file as the data packet to be analyzed is large at this time, the size of the data packet to be analyzed can be appropriately reduced. Therefore, before the target device obtains the data packet to be analyzed, a threshold value can be set for the total data volume, such as 10M. The target device first determines the size relationship between the total data volume and the threshold, and adopts different methods to obtain the data packet to be analyzed according to the different data volumes, thereby achieving the effect of improving accuracy and reducing the analysis volume.

[0090] Step 770: If the total data volume is greater than or equal to the threshold, the target device finds two timestamps located on both sides of the freeze time point according to each timestamp in the target packet capture file, and uses the data packet between the two timestamps as the data packet to be analyzed.

[0091] In an embodiment of the present application, the total data volume is greater than or equal to a threshold value. If the total data volume is large, using the entire target packet capture file as the packet to be analyzed may cause the target device to analyze too much, take a long time, waste resources, etc. Therefore, the target device can find the two timestamps on both sides of the freeze time point based on the timestamps in the packet capture file, and use the data packet between the two timestamps as the data packet to be analyzed. Figure 8 FIG. 1 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application. Figure 8 In the example, the total data volume is, for example, user Internet data, the threshold setting is, for example, 10M, the preset target duration setting is, for example, 10 minutes, the preset time interval setting is, for example, 2.5 minutes, and the target packet capture file includes several data packets, 1 start timestamp T1, 1 end timestamp T2, and 3 intermediate timestamps t1, t2, and t3; when the user encounters a freeze while watching the live broadcast, the freeze time point t is recorded and informed to the relevant operation and maintenance personnel, and the relevant operation and maintenance personnel upload the freeze time point t to the target device, and the target device finds the corresponding packet capture file according to the freeze time point t and determines it as the target packet capture file F, wherein the start timestamp T1 of the target packet capture file F is less than or equal to the freeze time point t, and the end timestamp T2 of the target packet capture file is greater than or equal to the freeze time point t, and the target device finds that the freeze time point is between the third intermediate timestamp t3 and the end timestamp T2 according to each timestamp in the target packet capture file, and the target device saves the data packet between the third intermediate timestamp t3 and the end timestamp T2 (i.e. Figure 8 The data packet enclosed by the dotted box in the figure is taken as the data packet D to be analyzed.

[0092] In the embodiment of the present application, if the total data volume is less than the threshold, for example, the total data volume is the user's Internet data, if the total data volume is less than the threshold, it means that the user data at this time is small business data. For small data volume business, when a freeze occurs, it is difficult for the user to immediately perceive it, so the freeze time point obtained by the target device is usually a relatively vague time point. In this case, the target device can determine whether the freeze time point is in the first half or the second half of the target capture file; if the freeze time point is in the second half of the target capture file, the actual freeze point may be in the first half of the target capture file, and all data packets in the target capture file can be used as data packets to be analyzed.

[0093] In an embodiment of the present application, the target device obtains the total data volume of all data packets in the target packet capture file; the target device determines whether the total data volume is greater than or equal to a threshold; if the total data volume is greater than or equal to the threshold, the target device finds two timestamps located on both sides of the stuck time point according to each timestamp in the target packet capture file, and uses the data packets between the two timestamps as the data packets to be analyzed; in this way, the target device analysis volume can be reduced for large data volume services. If the total data volume is less than the threshold, it is determined whether the stuck time point is in the first half or the second half of the target packet capture file; if the stuck time point is in the second half of the target packet capture file, all data packets in the target packet capture file are used as data packets to be analyzed. In this way, for small data volume services, the stuck time point obtained by the target device may not be accurate enough. When the stuck time point is in the second half of the target packet capture file, all data packets are used as data packets to be analyzed, which can avoid the situation where the actual stuck point is in the first half of the target packet capture file and causes analysis errors.

[0094] See also Fig. 9 , Fig. 9 A flowchart of a method for obtaining a data packet provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the method comprises the following steps:

[0095] Step 910: The target device sends a data packet collection task to the network device;

[0096] Step 915: The target device receives a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0097] Step 920: The target device obtains the service freeze time point;

[0098] Step 925: The target device determines the target packet capture file corresponding to the freeze time point based on the start timestamp and the end timestamp of each packet capture file;

[0099] Step 930: the target device obtains the total data volume of all data packets in the target packet capture file;

[0100] Step 935: The target device determines whether the total data volume is greater than or equal to a threshold;

[0101] Step 940: If the total data volume is greater than or equal to the threshold, the target device finds two timestamps located on both sides of the freeze time point according to each timestamp in the target packet capture file, and uses the data packet between the two timestamps as the data packet to be analyzed;

[0102] Step 945: If the total data volume is less than the threshold, the target device determines whether the freeze time point is in the first half or the second half of the target packet capture file;

[0103] In an embodiment of the present application, the total data volume is less than a threshold value. For example, the total data volume is the user's Internet data. If the total data volume is relatively small, it means that when the user's Internet access is stuck, the user may be performing small data volume services, including browsing web pages, reading documents, and viewing pictures. For small data volume services, when a freeze occurs, it is difficult for the user to perceive it immediately. Therefore, the freeze time point obtained by the target device is usually a relatively vague time point; further considering that if the freeze time point reported by the user is in the first half of the target capture file, the data packet that actually freezes may be in the second half of the previous capture file of the target capture file. If the freeze time point reported by the user is in the second half of the target capture file, the data packet that actually freezes may be in the first half of the target capture file; therefore, when performing subsequent operations, the target file first determines whether the freeze time point is in the first half or the second half of the target capture file.

[0104] Step 950: If the freezing time point is in the second half of the target packet capture file, the target device uses all data packets in the target packet capture file as data packets to be analyzed;

[0105] In an embodiment of the present application, the freezing time point is, for example, a time point corresponding to a failure occurring when a user is surfing the Internet, and the target packet capture file is, for example, a data packet corresponding to the time point when a failure occurring when a user is surfing the Internet. Fig.10 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application. Fig.10 , T1, T2 represent the start timestamp and the end timestamp, t1, t2, t3 represent the intermediate timestamps, t represents the freeze time point, the threshold is set to 10M, if the freeze time point t is in the second half of the target packet capture file F, since the number of data packets in the entire packet capture file is small, it means that the freeze occurred when the user was performing a small data volume business, and the user's perception is not obvious. At this time, the freeze time point obtained by the target device is not accurate enough, and the actual freeze time point may be in the first half of the target packet capture file. Therefore, all data packets in the target packet capture file can be used as the data packet D to be analyzed.

[0106] Step 955: If the freeze time point is in the first half of the target packet capture file, the target device obtains a previous packet capture file of the target packet capture file;

[0107] In an embodiment of the present application, the stuck time point is, for example, the time point corresponding to the failure of the user to access the Internet, and the target packet capture file is, for example, the data packet corresponding to the time point when the failure occurred when the user accessed the Internet. If the stuck time point is in the first half of the target packet capture file, the data packet that actually got stuck may be in the second half of the previous packet capture file of the target packet capture file. Therefore, the target device obtains the previous packet capture file of the target packet capture file, and determines the data packet to be analyzed according to the amount of data in the second half of the previous packet capture file and the first half of the target packet capture file.

[0108] Step 960: The target device determines whether the sum of the data volume of all data packets in the first half of the target packet capture file and the data volume of all data packets in the second half of the previous packet capture file exceeds a threshold;

[0109] In an embodiment of the present application, the freezing time point is, for example, the time point corresponding to the failure when the user is surfing the Internet, and the target packet capture file is, for example, a data packet corresponding to the time point when the failure occurs when the user is surfing the Internet. Since the total data volume of the target packet capture file is less than the threshold value, it means that the service used by the user when the freezing occurs may be a small data volume service, but the data volume of the previous packet capture file cannot be determined. If the total data volume of all data packets in the first half of the target packet capture file and the total data volume of all data packets in the second half of the previous packet capture file exceed the threshold value, it means that the user is freezing when performing a large data volume service; if the total data volume of all data packets in the first half of the target packet capture file exceeds the threshold value, it means that the user is freezing when performing a large data volume service. If the data volume and the sum of the data volumes of all data packets in the second half of the previous packet capture file do not exceed the threshold, it means that the data packet of the previous packet capture file is the Internet access data when the user performs small data volume services. If a freeze occurs in the second half of the previous packet capture file, the user may not perceive it in time, resulting in the freeze point obtained by the target device being in the first half of the target packet capture file. At this time, the second half of the previous packet capture file should be used together with the first half of the target packet capture file as the data packet to be analyzed. By searching for the data packet to be analyzed according to the above method, whether for large data packet services or small data packet services, it can accurately lock the data packet to be analyzed, avoid missing suspicious data packets, and control the analysis volume of the data packet.

[0110] Step 965: if the sum exceeds the threshold, find two timestamps located on both sides of the freeze time point in the target packet capture file, and use the data packet between the two timestamps as the data packet to be analyzed;

[0111] In an embodiment of the present application, the sum is the sum of the data volume of all data packets in the first half of the target packet capture file and the data volume of all data packets in the second half of the previous packet capture file. The freezing time point is, for example, the time point corresponding to the failure when the user is surfing the Internet. The target packet capture file includes, for example, the data packet corresponding to the time point when the failure occurs when the user is surfing the Internet. The timestamp includes a start timestamp, an intermediate timestamp, and an end timestamp. Fig.11 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application. Fig.11 , T01, T02 represent the start timestamp and end timestamp of the target packet capture file F, t01, t02, t03 represent the intermediate timestamp of the target packet capture file F, T11, T12 represent the start timestamp and end timestamp of the previous packet capture file F1, t11, t12, t13 represent the intermediate timestamp of the previous packet capture file F1, t represents the freeze time point, the threshold is set to 10M, if the sum of the data volume of all data packets in the first half of the target packet capture file and the data volume of all data packets in the second half of the previous packet capture file exceeds 10M, it means that the user is freezed when performing large data volume services, so the freeze time point t obtained by the target device is usually a more accurate time point, so the data packets between the two timestamps (i.e., t01 and t02) on both sides of the freeze time point t in the target packet capture file F can be used as the data packet D to be analyzed.

[0112] Step 970: if the sum does not exceed the threshold, all data packets in the first half of the target packet capture file and all data packets in the second half of the previous packet capture file are taken as data packets to be analyzed;

[0113] In an embodiment of the present application, the sum is the sum of the data volume of all data packets in the first half of the target packet capture file and the data volume of all data packets in the second half of the previous packet capture file. The target packet capture file, for example, includes the data packet corresponding to the time point when a failure occurs when the user is surfing the Internet. Fig.12 is an example diagram of a method for obtaining a data packet to be analyzed provided in an embodiment of the present application. Fig.12, T01, T02 represent the start timestamp and end timestamp of the target packet capture file F, t01, t02, t03 represent the intermediate timestamp of the target packet capture file F, T11, T12 represent the start timestamp and end timestamp of the previous packet capture file F1, t11, t12, t13 represent the intermediate timestamp of the previous packet capture file F1, t represents the freeze time point, the threshold is set to 10M, if the sum of the data volume of all data packets in the first half of the target packet capture file F and the data volume of all data packets in the second half of the previous packet capture file F1 exceeds 10M, it means that the user is freezed when performing a small data volume business, so the freeze time point t obtained by the target device is usually a relatively vague time point, and the actual freeze point may be in the second half of the previous packet capture file, so all data packets in the first half of the target packet capture file F and all data packets in the second half of the previous packet capture file F1 (i.e. Fig.12 The data packet enclosed by the dashed box in the middle is used as the data packet D to be analyzed. Since it is a small data volume service, the analysis amount is not large.

[0114] In an embodiment of the present application, a data packet is captured; a network device receives a data packet collection task; the network device captures a data packet based on the data packet collection task, and saves the captured data packet in a capture file; wherein each capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; the network device sends the capture file to the target device, so that the target device obtains the data packet to be analyzed from the capture file based on the target timestamp. In this way, by saving the captured data packet in the capture file, and since each capture file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp, in this way, compared with the related art that relies on manual determination of the data packet to be analyzed, the method of determining the data packet to be analyzed by the target timestamp in the embodiment of the present application is more targeted, and the target device can determine the data packet to be analyzed from the capture file in a targeted manner according to the target timestamp, thereby solving the problem that the limited capture ability of the installation and maintenance personnel in the related art leads to the data packet to be analyzed being often not targeted enough.

[0115] It is important to understand that Figures 1 to 12 The explanations of the same or corresponding steps in the following can be referred to each other. Figure 2 The explanation of step 210 and step 220 in Figure 4 Step 410 and step 420 in .

[0116] At the same time, it should be understood that a method for capturing data packets provided in an embodiment of the present application can have the following beneficial effects: First, it can be applied to the field of home broadband service fault handling, replacing the installation and maintenance personnel who go to the site to capture the user's Internet data to locate the fault. The installation and maintenance personnel do not need to install the packet capture environment and tools on site, reducing the workload of the installation and maintenance personnel, and can effectively avoid the intermittent faults, requiring the installation and maintenance personnel to repeatedly arrive at the site to reproduce the fault and other scenarios, simplifying the user complaint process and improving user satisfaction. Second, the method provided by the present application uses the target timestamp to mark the packet capture file, which can quickly find the data packet to be analyzed through the stuck time point and the marked target timestamp, reducing the target device search time. Third, the method provided by the present application uses different methods to find the data packet to be analyzed according to the large data packet service and the small data packet service, avoiding the omission of suspicious data packets, and controlling the analysis amount of the data packet, and can achieve accurate locking of the data packet to be analyzed.

[0117] Fig.13 is a structural block diagram of a device for capturing data packets provided in an embodiment of the present application. Fig.13 The device 1300 for capturing data packets provided in the embodiment of the present application includes: a receiving module 1310, a collecting module 1320, a saving module 1330 and a sending module 1340. Among them:

[0118] The receiving module 1310 is used to receive a data packet collection task;

[0119] A collection module 1320, configured to capture data packets based on the data packet collection task;

[0120] A saving module 1330 is used to save the captured data packets in a captured packet file; wherein each captured packet file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each captured packet file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0121] The sending module 1340 is configured to send the packet capture file to a target device, so that the target device obtains the data packet to be analyzed from the packet capture file based on the target timestamp.

[0122] The specific functions implemented by each module in the receiving module 1310, the collecting module 1320, the saving module 1330 and the sending module 1340 can refer to the method embodiment (for example, Figure 2 and Figure 4 The corresponding steps in the method embodiment shown in the figure are not repeated here.

[0123] In this way, an apparatus for capturing data packets provided in an embodiment of the present application saves the captured data packets in a captured packet file, and since each captured packet file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp. In this way, compared with the related art that relies on manual determination of the data packets to be analyzed, the method of determining the data packets to be analyzed by target timestamps in the embodiment of the present application is more targeted, and the data packets to be analyzed can be determined in a targeted manner from the captured packet file according to the target timestamp, thereby solving the problem in the related art that the installation and maintenance personnel have limited packet capturing capabilities, resulting in the acquired data packets to be analyzed being often not targeted enough.

[0124] Fig.14 is a structural block diagram of a device for capturing data packets provided in an embodiment of the present application. Fig.14 , a device 1400 for capturing a data packet provided in an embodiment of the present application includes: a sending module 1410, a receiving module 1420 and a processing module 1430. Among them:

[0125] The sending module 1410 is used to send a data packet collection task to a network device;

[0126] The receiving module 1420 is used to receive a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp;

[0127] The processing module 1430 is used to determine the data packet to be analyzed from the captured packet file based on the target timestamp.

[0128] The specific functions implemented by each module in the sending module 1410, the receiving module 1420 and the processing module 1430 can refer to the method embodiment (for example, Figures 5 to 7 ,as well as Fig. 9 The corresponding steps in the method embodiment shown in the figure are not repeated here.

[0129] In this way, an apparatus for capturing data packets provided in an embodiment of the present application saves the captured data packets in a captured packet file, and since each captured packet file is marked with a target timestamp, the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp. In this way, compared with the related art that relies on manual determination of the data packets to be analyzed, the method of determining the data packets to be analyzed by target timestamps in the embodiment of the present application is more targeted, and the data packets to be analyzed can be determined in a targeted manner from the captured packet file according to the target timestamp, thereby solving the problem in the related art that the installation and maintenance personnel have limited packet capturing capabilities, resulting in the acquired data packets to be analyzed being often not targeted enough.

[0130] like Fig.15 As shown, the embodiment of the present application also provides an electronic device 1500, which can be various types of computers, etc. The electronic device 1500 includes: a processor 1510 and a memory 1520, and the memory 1520 stores a program or instruction, and the program or instruction is executed by the processor 1510 to implement the steps of any method described above. For example, when the program is executed by the processor 1510, the following process is implemented: capture data packets; the network device receives a data packet collection task; the network device captures data packets based on the data packet collection task, and saves the captured data packets in a capture file; wherein each capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; the network device sends the capture file to the target device, so that the target device obtains the data packet to be analyzed from the capture file based on the target timestamp. In the user's home broadband network scenario, network devices connected to the broadband network, such as routers, are connected to target devices, such as servers. The router receives the data packet collection task sent by the server to capture the user's Internet data, and saves the captured user Internet data in a packet capture file, wherein each packet capture file includes all the user's Internet data for a period of time, and each packet capture file is marked with a target timestamp, including a start timestamp, an end timestamp, and an intermediate stamp, to facilitate data retrieval. The router sends the packet capture file to the server. When the user encounters a fault when surfing the Internet, the server finds the corresponding packet capture file as the data packet to be analyzed through the fault time point and the target timestamp. In this way, the server can quickly locate the fault and handle it in time through the data packet to be analyzed, which solves the problem that difficult faults in the prior art are difficult to reproduce and the user's Internet data cannot be obtained in real time.

[0131] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of each embodiment of the method for capturing a data packet are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0132] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory, a random access memory, a magnetic disk or an optical disk.

[0133] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0134] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0135] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0137] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for capturing data packets, It is characterized in that include: The network device receives the data packet collection task; The network device captures data packets based on the data packet collection task, and saves the captured data packets in a captured packet file; wherein each captured packet file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each captured packet file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; The network device sends the packet capture file to the target device, so that the target device obtains the data packet to be analyzed from the packet capture file based on the target timestamp.

2. The method according to claim 1, It is characterized in that The captured data packets are saved in a captured packet file, including: Saving multiple data packets within the preset target time length in a packet capture file; Record the start timestamp and the end timestamp in the packet capture file; Recording the intermediate timestamp between the start timestamp and the end timestamp at preset time intervals in the packet capture file; Wherein, the preset target duration is greater than the preset time interval.

3. The method according to claim 2, It is characterized in that The preset target duration is an integer multiple of the preset time interval; the network device includes a router installed with Merlin firmware, the target device is a server or a control center; the multiple data packets are data packets of home broadband services.

4. A method for capturing data packets, It is characterized in that include: The target device sends a data packet collection task to the network device; The target device receives a packet capture file sent by the network device based on the packet collection task; wherein each packet capture file includes multiple data packets, the time span of the multiple data packets is a preset target duration, and each packet capture file is marked with a target timestamp, and the target timestamp includes a start timestamp, an end timestamp, and an intermediate timestamp; The target device determines a data packet to be analyzed from the captured packet file based on the target timestamp.

5. The method according to claim 4, It is characterized in that The target device determines the data packet to be analyzed from the captured packet file based on the target timestamp, including: The target device obtains the time point of service freeze; The target device determines the target packet capture file corresponding to the freeze time point based on the start timestamp and the end timestamp of each packet capture file; The target device determines a data packet to be analyzed based on the target packet capture file.

6. The method according to claim 5, It is characterized in that The target device determines the data packet to be analyzed based on the target packet capture file, including: The target device obtains the total data volume of all data packets in the target packet capture file; The target device determines whether the total data volume is greater than or equal to a threshold; If the total data volume is greater than or equal to a threshold, the target device finds two timestamps located on both sides of the freeze time point according to each timestamp in the target packet capture file, and uses the data packet between the two timestamps as the data packet to be analyzed.

7. The method according to claim 6, It is characterized in that The target device determines the data packet to be analyzed based on the target packet capture file, further comprising: If the total data volume is less than a threshold, determine whether the freeze time point is in the first half or the second half of the target packet capture file; If the freezing time point is in the second half of the target packet capture file, all data packets in the target packet capture file are used as data packets to be analyzed.

8. The method according to claim 7, It is characterized in that The target device determines the data packet to be analyzed based on the target packet capture file, further comprising: If the freeze time point is in the first half of the target packet capture file, obtain the previous packet capture file of the target packet capture file; Determine whether the sum of the data volume of all data packets in the first half of the target packet capture file and the data volume of all data packets in the second half of the previous packet capture file exceeds a threshold; If the sum exceeds the threshold, two timestamps located on both sides of the freeze time point in the target packet capture file are found, and the data packet between the two timestamps is used as the data packet to be analyzed; If the sum does not exceed the threshold, all data packets in the first half of the target packet capture file and all data packets in the second half of the previous packet capture file are taken as data packets to be analyzed.

9. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores a program or instruction running on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.

10. A computer-readable storage medium, It is characterized in that The medium stores a program or an instruction, and when the program or the instruction is executed, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.