Remote packet capturing method and device, electronic equipment and storage medium
By establishing remote connections between devices, the problem of high labor costs in scenarios such as cloud operation and maintenance is solved, local remote packet capture is realized, costs are reduced, and operation and maintenance efficiency is improved.
Patent Information
- Application Number
- CN202311448016.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-01
- Publication Date
- 2024-08-27
AI Technical Summary
In cloud operation and maintenance, cloud messaging, push and other scenarios, equipment manufacturers have high labor costs when solving problems at customers, and existing remote diagnosis is difficult to achieve, resulting in low operation and maintenance efficiency.
By establishing a remote connection between the first device and the second device, and sending a remote packet capture request to the second device to obtain its operating data, local analysis is achieved, labor costs are reduced, and efficiency is improved.
It realizes remote packet capture locally, reduces labor and hardware costs, improves operation and maintenance efficiency, and avoids the risk of illegal packet capture.
Smart Images

Figure CN118555283A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a remote packet capture method, device, electronic device and storage medium. Background Art
[0002] As more and more devices are deployed around the world, the network environment is very complex and more and more problems are emerging. For example, in scenarios such as cloud operation and maintenance, cloud messaging, push, and cloud storage that interact with servers, problems occur more and more frequently.
[0003] Currently, when the equipment provided by equipment manufacturers is deployed to the customer's site, any problems that occur can be easily reproduced at the customer's site. For example, there is no cloud recording in the application, or cloud messages are missed. However, these problems will not occur in the local testing of the equipment manufacturer. Therefore, in this case, the equipment manufacturer's operation and maintenance personnel need to go to the customer's site to solve the problem, but this method will result in high labor costs. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a remote packet capture method, device, electronic device and storage medium to improve the problem of high labor costs caused by existing methods.
[0005] In a first aspect, an embodiment of the present application provides a remote packet capture method, which is applied to a first device, wherein the first device establishes a remote connection with a second device, and the method includes:
[0006] Sending a remote packet capture request to the second device, where the remote packet capture request is used to instruct the second device to capture relevant operation data of itself;
[0007] The relevant operation data is obtained from the second device.
[0008] In the above implementation process, by establishing a remote connection between the first device and the second device, the first device can send a remote packet capture request to the second device through the remote connection, so that the second device can capture its own relevant operation data according to the remote packet capture request, and the first device can obtain the relevant operation data of the second device through the remote connection. In this way, the analysis of the relevant operation data can be realized locally, the labor cost is lower, and there is no need to use other hardware to realize remote packet capture. The hardware cost is also lower, and the first device can realize remote packet capture locally, which is more efficient.
[0009] Optionally, the sending a remote packet capture request to the second device includes:
[0010] Acquire device information and verification information of the second device;
[0011] Performing validity verification on the device information according to the verification information;
[0012] After the verification is passed, a remote packet capture request is sent to the second device.
[0013] In the above implementation process, by verifying the identity information of the device, it can be verified whether the second device that needs to capture packets is a valid and legal device, so as to ensure that the subsequent packet capture can be successfully implemented.
[0014] Optionally, before sending the remote packet capture request to the second device, the method further includes:
[0015] Send a packet capture tool file to the second device, wherein the packet capture tool file is used to capture the relevant operation data of the second device itself. In this way, the packet capture tool file can be uploaded locally to the second device, thereby realizing remote packet capture.
[0016] Optionally, before sending the remote packet capture request to the second device, the method further includes:
[0017] The corresponding packet capture parameters are sent to the second device, and the packet capture parameters are used to instruct the second device to capture its own related operation data according to the packet capture parameters. In this way, the packet capture parameters can be customized according to needs to flexibly adapt to various packet capture scenarios.
[0018] Optionally, the packet capture parameters include at least one of a packet capture data storage path, a packet capture duration, a packet capture quantity, and a packet capture filtering rule.
[0019] Optionally, before sending the remote packet capture instruction to the second device, the method further includes:
[0020] Establishing a P2P connection with the second device;
[0021] Establishing a remote connection with the second device based on the P2P connection;
[0022] The acquiring the relevant operation data from the second device includes:
[0023] The relevant operation data is obtained from the second device through the remote connection.
[0024] In the above implementation process, a remote connection is established by establishing a P2P connection, so that the first device and the second device can achieve remote communication even if they are not in the same local area network, thereby facilitating remote packet capture by the staff.
[0025] In a second aspect, an embodiment of the present application provides a packet capture method, which is applied to a second device, where the second device establishes a remote connection with a first device, and the method includes:
[0026] Receiving a remote packet capture request sent by the first device;
[0027] In response to the remote packet capture request, relevant operation data of the system is captured.
[0028] Optionally, in response to the remote packet capture request, capturing relevant operation data of the device itself includes:
[0029] Verifying the identity information of the first device;
[0030] After the verification is passed, the remote packet capture request is responded to to capture the relevant operation data of the self.
[0031] In the above implementation process, the identity information of the first device is verified, so that the legitimacy of the first device can be ensured, so as to ensure the security of the packet capture process and avoid illegal packet capture.
[0032] In a third aspect, an embodiment of the present application provides a remote packet capture device, which runs on a first device, and the first device establishes a remote connection with a second device, and the device includes:
[0033] A request sending module, used for sending a remote packet capture request to the second device, wherein the remote packet capture request is used for instructing the second device to capture relevant operation data of itself;
[0034] A data acquisition module is used to acquire the relevant operation data from the second device.
[0035] In a fourth aspect, an embodiment of the present application provides a packet capture device, which runs on a second device, and the second device establishes a remote connection with a first device, and the device includes:
[0036] A request receiving module, used to receive a remote packet capture request sent by the first device;
[0037] The request response module is used to respond to the remote packet capture request and capture its own related operation data.
[0038] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method provided in the first aspect are executed.
[0039] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method provided in the first aspect are performed.
[0040] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the embodiments of the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application 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 paying creative work.
[0042] Figure 1 A flowchart of a remote packet capture method provided in an embodiment of the present application;
[0043] Figure 2 A schematic diagram of an interface for inputting relevant information provided in an embodiment of the present application;
[0044] Figure 3 A schematic diagram of an interface for setting packet capture parameters provided in an embodiment of the present application;
[0045] Figure 4 A schematic diagram of a packet capture data download interface provided in an embodiment of the present application;
[0046] Figure 5 A flowchart of establishing a P2P connection between a first device and a second device provided in an embodiment of the present application;
[0047] Figure 6 A flowchart of establishing a telnet connection between a first device and a second device provided in an embodiment of the present application;
[0048] Figure 7 An interactive flow chart of a remote packet capture method provided in an embodiment of the present application;
[0049] Figure 8 A flowchart of a packet capture method provided in an embodiment of the present application;
[0050] Fig. 9 A structural block diagram of a remote packet capture device provided in an embodiment of the present application;
[0051] Fig.10 A structural block diagram of a packet capture device provided in an embodiment of the present application;
[0052] Fig.11A schematic diagram of the structure of an electronic device for executing a remote packet capture method or a packet capture method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application.
[0054] It should be noted that the terms "system" and "network" in the embodiments of the present invention can be used interchangeably. "Multiple" means two or more. In view of this, in the embodiments of the present invention, "multiple" can also be understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the previously associated objects are in an "or" relationship.
[0055] An embodiment of the present application provides a remote packet capture method, which establishes a remote connection between a first device and a second device, so that the first device can send a remote packet capture request to the second device through the remote connection, so that the second device can capture its own relevant operating data according to the remote packet capture request, and the first device can obtain the relevant operating data of the second device through the remote connection, so that the relevant operating data can be analyzed locally, the labor cost is lower, and there is no need to use other hardware to achieve remote packet capture, the hardware cost is also lower, and the first device can achieve remote packet capture locally, which is more efficient.
[0056] Please refer to Figure 1 , Figure 1 A flowchart of a remote packet capture method provided in an embodiment of the present application, the method comprising the following steps:
[0057] Step S110: Send a remote packet capture request to the second device, where the remote packet capture request is used to instruct the second device to capture relevant operation data of itself.
[0058] The execution subject of the method is a first device, and the first device establishes a remote connection with the second device in advance. In some scenarios, even if the first device and the second device are not in a local area network, they can communicate through the remote connection. The first device can refer to the local device of the device manufacturer, and the second device can refer to the customer's device, that is, the device that needs to capture packets.
[0059] When the first device needs to obtain data from the second device, it may send a remote packet capture request to the second device. The remote packet capture request may be used to instruct the second device to capture relevant operating data of itself.
[0060] Step S120: Acquire relevant operation data from the second device.
[0061] It can be understood that after receiving the remote packet capture request, the second device can determine that the first device has a packet capture requirement, and can first obtain its own relevant operating data and store it. The first device can obtain the stored relevant operating data from the second device when needed, that is, the second device can send the relevant operating data to the first device via a remote connection.
[0062] Among them, the relevant operation data may refer to print information. In the program version, print information usually refers to the information displayed on the console or output device when the program is running. This information may be diagnostic information, debugging information, status information or other program-related text data during the program execution process. In this way, after the first device obtains the relevant operation data of the second device, it can help the staff to understand the operation status of the program on the second device locally, diagnose problems, etc., thereby helping the staff to analyze problems encountered during the operation of the second device and the causes of the problems.
[0063] In the above implementation process, by establishing a remote connection between the first device and the second device, the first device can send a remote packet capture request to the second device through the remote connection, so that the second device can capture its own relevant operation data according to the remote packet capture request, and the first device can obtain the relevant operation data of the second device through the remote connection, so that the analysis of the relevant operation data can be realized locally, the labor cost is lower, and there is no need to use other hardware to realize remote packet capture, the hardware cost is also lower, and the first device can realize remote packet capture locally, which is more efficient.
[0064] On the basis of the above embodiments, in order to ensure the security and effectiveness of packet capture, the first device can first obtain the device information and verification information of the second device when sending a remote packet capture request to the second device, and then verify the validity of the device information based on the verification information. After the verification is passed, a remote packet capture request is sent to the second device.
[0065] Among them, the device information of the second device may refer to the identity information of the second device, and the identity information may uniquely identify a second device. The identity information of each second device may be pre-configured in the first device, so that when the first device needs to capture a packet of a second device, it can obtain the pre-stored device information of the second device.
[0066] The verification information may refer to user name and password information, which may be entered by a staff member.
[0067] For example, the embodiment of the present application provides a remote packet capture application. When packet capture is required, the staff opens the remote packet capture application, and then selects the device information of the second device in the corresponding display interface, and enters the corresponding user name and password and other information. The display interface is as follows: Figure 2 shown. Figure 2 The device DID in the display interface shown in can be understood as device information. The device information here can be input by the staff themselves or selected in the display interface. For example, when the staff clicks the input box of the device DID, a drop-down box will be displayed, which contains the device information of each second device. The staff can select the device information of the device that needs to be captured according to the needs. The user name and password refer to the verification information, which can be used by the first device to verify the validity of the identity information of the second device. The verification information of each second device can be different. The staff needs to obtain the verification information of the second device that needs to be captured in advance. In the remote packet capture tool, the verification information and the device information can be bound in advance. In this way, the verification information and the device information entered by the staff can be used to determine whether the two information are pre-bound. If so, the verification passes, otherwise the verification fails.
[0068] It is understandable that in some other implementations, the verification information can also verify the identity of the staff member, for example, the username and password can refer to the username and password of the administrator, so that the legitimacy of the identity of the staff member currently capturing packets can be verified. For example, the remote packet capture application has built-in default verification information, and then the currently obtained verification information is compared with the default verification information. If they are consistent, the verification is passed and the subsequent packet capture process can continue. If they are inconsistent, the verification fails, indicating that the identity of the current staff member is illegal, and it may be that an illegal person wants to illegally capture packets.
[0069] In some implementations, if the verification fails, the remote packet capture application can output a corresponding warning message, or terminate the current remote packet capture and directly exit the application. If the verification passes, the first device can send a remote packet capture request to the second device.
[0070] After the staff has selected the device information and entered the verification information, they can click on the start service on the display interface. After the remote packet capture application detects the click operation to start the service, the above-mentioned verification process can be performed.
[0071] In the above implementation process, by verifying the identity information of the device, it can be verified whether the second device that needs to capture packets is a valid and legal device, so as to ensure that the subsequent packet capture can be successfully implemented.
[0072] On the basis of the above embodiment, in order to quickly complete the packet capture process, before sending a remote packet capture request to the second device, a packet capture tool file can also be sent to the second device, and the packet capture tool file can enable the second device to capture its own related operation data. In this way, the packet capture tool file can be uploaded locally to the second device, thereby realizing remote packet capture.
[0073] Among them, the packet capture tool file is such as the ngrep packet capture tool file, which is a binary file and can be pre-stored in the first device. When the remote packet capture application needs to capture packets, it can read the packet capture tool file stored in the first device and then send it to the second device through a remote connection. In this way, the first device can send a series of instructions to the second device to control the operation of the remote packet capture tool file in the second device, thereby achieving the effect of capturing relevant operation data of the second device.
[0074] For example, after uploading the packet capture tool file to the second device, the first device can execute corresponding commands on the packet capture tool file on the first device, including adding executable permissions to the ngrep file and using the parameters set on the tool to execute the ngrep command on the second device to capture packets.
[0075] Of course, after receiving the packet capture tool file, the second device can also automatically run the packet capture tool file to achieve packet capture. It can be understood that the packet capture tool file can also be other packet capture files that can achieve the packet capture function.
[0076] In some implementations, the staff can also choose what kind of file to send to the second device in the remote packet capture application. Before uploading the file, the connection status between the remote packet capture application and the second device can be confirmed. Under normal circumstances, after the remote packet capture application is started, the file upload status can be checked through the xshell terminal synchronous login. After the file is successfully uploaded, the progress bar displayed on the corresponding display interface turns green, indicating that the file has been successfully uploaded, and the synchronous xshell terminal can see the ngrep file just uploaded.
[0077] exist Figure 2 On the interface shown, there is a file upload button. The staff can click the file upload button and then select the local file they want to transfer to the second device. After clicking the file upload, the program has a default path for the packet capture tool file stored. Then you can click automatic identification to automatically identify the path of the local storage packet capture tool file, and then you can obtain the corresponding packet capture tool file.
[0078] On the basis of the above embodiment, before sending a remote packet capture request to the second device, the first device may also send a corresponding packet capture parameter to the second device, and the packet capture parameter is used to instruct the second device to capture its own related operation data according to the packet capture parameter. In this way, the packet capture parameter can be customized according to the demand to flexibly adapt to various packet capture scenarios.
[0079] The packet capture parameters may include at least one of the packet capture data storage path, packet capture duration, packet capture quantity, and packet capture rules. Figure 3 As shown, Figure 3 It is a display interface of a remote packet capture application, in which the capture time (i.e., packet capture time), number of data packets (i.e., number of captured packets), captured data storage path, packet capture filtering rules, etc. can be set on the first device. It can be understood that in actual applications, various packet capture parameters can also be flexibly defined according to needs.
[0080] The packet capture data storage path refers to the path where the second device saves its own related operating data. The packet capture filtering rules may include basic filtering rules, BPF syntax filtering rules, and custom rules, etc. The staff can flexibly set these packet capture parameters according to the packet capture requirements. After setting the packet capture parameters, the packet capture parameters can be sent to the second device, and then the start packet capture button on the display interface can be clicked to trigger the remote packet capture request and then realize packet capture.
[0081] After the packet capture is completed, the remote packet capture application can prompt the staff that the packet capture is completed, and the staff can enter the main interface of the remote packet capture application, such as Figure 4 As shown, by clicking on file download in the main interface, the packet capture data can be obtained from the path where the second device stores the running data, and then saved on the first device, thereby completing the entire remote packet capture process.
[0082] In some embodiments, the remote packet capture application can also provide a one-click packet capture function. For example, when the staff clicks the one-click packet capture button in the relevant display interface of the remote packet capture application, the remote packet capture application can automatically realize packet capture. The packet capture process is also as shown above, except that uploading the packet capture tool file is an imperceptible operation for the staff, and the packet capture parameters are also set by default. Under this function, the staff does not need to manually enter relevant information, and can complete the packet capture process internally through the default information.
[0083] On the basis of the above embodiments, in order to realize the remote packet capture function, the first device and the second device need to establish a remote connection in advance. The process of establishing the remote connection may include: the first device and the second device first establish a P2P (Peer to Peer) connection, and then establish a remote connection with the second device based on the P2P connection, so that the first device can obtain relevant operation data from the second device through the remote connection.
[0084] After the first device and the second device establish a P2P connection, the first device and the second device establish a point-to-point data transmission channel, and then on the P2P connection, the first device and the second device can establish a remote connection, such as a telnet connection, an SSH (Secure Shell) connection, etc.
[0085] Among them, the telnet connection can be understood as a communication connection established using the telnet protocol, and the SSH connection refers to a communication connection established using the SSH protocol.
[0086] The timing diagram of establishing a P2P connection between the first device and the second device is as follows Figure 5 As shown, the first device includes a P2P client, and the second device includes a P2P device end, specifically including the following process:
[0087] Step 1: The P2P device can periodically send heartbeat information to the P2P server;
[0088] Step 2: The P2P client initiates a P2P connection to the P2P device, and the connection request is sent to the P2P server;
[0089] Step 3: The P2P server notifies the P2P device.
[0090] Step 4: The P2P server returns information such as the public IP and port, local IP and port of the P2P device to the P2P client.
[0091] Step 5: The P2P device sends a connection request to the P2P client, and the P2P client also sends a connection request to the P2P device.
[0092] Step six: The P2P client and the P2P device establish a P2P connection based on the connection request, so that the P2P connection between the first device and the second device can be established.
[0093] The schematic diagram of establishing a telnet connection between the first device and the second device is as follows Figure 6 As shown, Figure 6 The PC shown in the figure can be represented as the first device, and the device can be represented as the second device. In the first device, it can include a telnet client, a 23-port data forwarding service (the 23-port can be understood as the service port of the telnet protocol) and a P2P client. In the second device, it can include a P2P device end, a telnet client and a telnet server.
[0094] The specific implementation process of establishing a telnet connection is as follows:
[0095] The telnet client of the first device sends a telnet connection to the port 23 data forwarding service of the first device;
[0096] The port 23 data forwarding service of the first device calls the P2P connection interface to the P2P client of the first device;
[0097] The P2P client of the first device sends a P2P connection command to the P2P client of the second device;
[0098] The P2P client of the second device calls the telnet connection interface to the telnet client of the second device;
[0099] The telnet client of the second device sends a telnet connection request to the telnet server of the second device;
[0100] The telnet server of the second device may directly return the telnet data of the second device to the telnet client of the first device;
[0101] The telnet client of the first device may send a telnet command to the telnet server of the second device;
[0102] The telnet server of the second device returns corresponding telnet response information to the telnet client of the first device.
[0103] After the first device completes remote packet capture, it can also disconnect the remote connection with the second device. In the specific implementation method, the staff can initiate a connection destruction command in the telnet client of the first device, and the telnet client of the first device transmits the telnet connection port command to the 23-port data forwarding service, and then calls the P2P port interface through the 23-port data forwarding service. The P2P client can send a P2P destruction command to the P2P device end of the second device, and the P2P device end of the second device calls the telnet disconnect interface. The telnet client of the second device can send a telnet disconnect request to the telnet server, so that the telnet connection between the first device and the second device can be disconnected, and the resource consumption caused by the connection can be reduced in time.
[0104] In the above implementation process, a remote connection is established by establishing a P2P connection, so that the first device and the second device can achieve remote communication even if they are not in the same local area network, thereby facilitating remote packet capture by the staff.
[0105] like Figure 7 As shown, Figure 7As the entire implementation flow chart of remote packet capture in the embodiment of the present application, the first device first establishes a P2P telnet connection with the second device, and then performs the subsequent packet capture process. In this way, remote packet capture can be implemented locally. This method can increase the learning cost of after-sales or testing personnel a little, reduce the work of developers, and provide great help for later equipment operation and maintenance, reducing the problem of adding too much printing information in the library to temporarily use too many storage resources.
[0106] Please refer to Figure 8 , Figure 8 A flowchart of a packet capture method provided in an embodiment of the present application, the method is applied to a second device, and includes the following steps:
[0107] Step S210: receiving a remote packet capture request sent by the first device.
[0108] Step S220: Responding to the remote packet capture request, capturing its own related operation data.
[0109] The second device has established a remote connection with the first device in advance. When the first device needs to capture relevant data of the second device, it can send a remote packet capture request to the second device. After receiving the remote packet capture request, the second device can capture its own relevant operating data.
[0110] In some embodiments, after capturing its own relevant operating data, the second device can store the relevant operating data in a corresponding data storage path. The data storage path can be a storage path set by the second device itself, or it can be a storage path sent by the first device to the second device, that is, the staff sets the data storage path on the first device and sends it to the second device, so that the second device can know where to store the relevant operating data. After the packet capture is completed, the first device can remotely download the captured data in the corresponding data storage path.
[0111] Based on the above embodiments, before the second device captures its own relevant operating data, or before the first device obtains its own relevant operating data, it can also verify the identity information of the first device. After the verification is passed, it can respond to the remote packet capture request and capture its own relevant operating data.
[0112] After receiving the remote packet capture request, the second device can apply for the identity information of the first device, and the first device can send its own identity information to the second device, so that the second device can verify the identity information to verify whether the first device has the authority to perform remote packet capture. If the verification fails, the remote packet capture request of the first device can be rejected, such as returning a rejection prompt message to the first device.
[0113] In some embodiments, in order to ensure the security of data transmission, the second device may also encrypt the data before transmitting it when sending the relevant operating data to the first device. After obtaining the data, the first device may decrypt the data and perform subsequent processing.
[0114] Please refer to Fig. 9 , Fig. 9 This is a structural block diagram of a remote packet capture device 300 provided in an embodiment of the present application. The device 300 runs on a first device. The device can be a module, program segment or code on an electronic device. It should be understood that the device 300 is similar to the above-mentioned Figure 1 The method embodiment corresponds to and can be executed Figure 1 The various steps involved in the method embodiment and the specific functions of the device 300 can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here.
[0115] Optionally, the device 300 includes:
[0116] A request sending module 310, configured to send a remote packet capture request to the second device, wherein the remote packet capture request is used to instruct the second device to capture relevant operation data of itself;
[0117] The data acquisition module 320 is used to acquire the relevant operation data from the second device.
[0118] Optionally, the request sending module 310 is used to obtain device information and verification information of the second device; verify the validity of the device information according to the verification information; and send a remote packet capture request to the second device after the verification is passed.
[0119] Optionally, the device 300 further includes:
[0120] The data sending module is used to send a packet capture tool file to the second device, where the packet capture tool file is used to capture relevant operation data of the second device itself.
[0121] Optionally, the device 300 further includes:
[0122] The data sending module is used to send corresponding packet capture parameters to the second device, and the packet capture parameters are used to instruct the second device to capture its own related operation data according to the packet capture parameters.
[0123] Optionally, the packet capture parameters include at least one of a packet capture data storage path, a packet capture duration, a packet capture quantity, and a packet capture filtering rule.
[0124] Optionally, the device 300 further includes:
[0125] A connection establishing module, configured to establish a P2P connection with the second device; and to establish a remote connection with the second device based on the P2P connection;
[0126] The data acquisition module 320 is used to acquire the relevant operation data from the second device through the remote connection.
[0127] Please refer to Fig.10 , Fig.10 This is a structural block diagram of a packet capture device 400 provided in an embodiment of the present application. The device 400 runs on a second device. The device may be a module, program segment or code on an electronic device. Figure 8 The method embodiment corresponds to and can be executed Figure 8 The various steps involved in the method embodiment and the specific functions of the device 400 can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here.
[0128] Optionally, the device 400 includes:
[0129] A request receiving module 410, configured to receive a remote packet capture request sent by the first device;
[0130] The request response module 420 is used to respond to the remote packet capture request and capture its own related operation data.
[0131] Optionally, the request response module 420 is used to verify the identity information of the first device; after the verification is passed, it responds to the remote packet capture request to capture its own related operation data.
[0132] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0133] Please refer to Fig.11 , Fig.11A structural diagram of an electronic device for executing a remote packet capture method or a packet capture method provided in an embodiment of the present application, the electronic device may include: at least one processor 510, such as a CPU, at least one communication interface 520, at least one memory 530 and at least one communication bus 540. Among them, the communication bus 540 is used to realize direct connection and communication between these components. Among them, the communication interface 520 of the device in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 530 can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 530 can optionally also be at least one storage device located away from the aforementioned processor. Computer-readable instructions are stored in the memory 530. When the computer-readable instructions are executed by the processor 510, the electronic device executes the above-mentioned Figure 1 or Figure 8 The method process is shown.
[0134] Understandably, Fig.11 The structure shown is for illustration only, and the electronic device may also include Fig.11 More or fewer components as shown, or with Fig.11 Different configurations shown. Fig.11 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0135] The present application embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the following is performed: Figure 1 or Figure 8 The method process in the method embodiment shown is executed by the electronic device.
[0136] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can perform the methods provided by the above method embodiments, for example, including:
[0137] Sending a remote packet capture request to the second device, where the remote packet capture request is used to instruct the second device to capture relevant operation data of itself;
[0138] The relevant operation data is obtained from the second device.
[0139] In summary, the embodiments of the present application provide a remote packet capture method, apparatus, electronic device and storage medium. The method establishes a remote connection between a first device and a second device, so that the first device can send a remote packet capture request to the second device through the remote connection, so that the second device can capture its own relevant operating data according to the remote packet capture request. The first device can obtain the relevant operating data of the second device through the remote connection, so that the relevant operating data can be analyzed locally, the labor cost is lower, and there is no need to use other hardware to achieve remote packet capture. The hardware cost is also lower, and the first device can achieve remote packet capture locally, which is more efficient.
[0140] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0141] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0142] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0143] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0144] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A remote packet capture method, It is characterized in that Applied to a first device, the first device establishes a remote connection with a second device, the method comprising: Sending a remote packet capture request to the second device, where the remote packet capture request is used to instruct the second device to capture relevant operation data of itself; The relevant operation data is obtained from the second device.
2. The method according to claim 1, It is characterized in that The sending a remote packet capture request to the second device includes: Acquire device information and verification information of the second device; Performing validity verification on the device information according to the verification information; After the verification is passed, a remote packet capture request is sent to the second device.
3. The method according to claim 1, It is characterized in that Before sending the remote packet capture request to the second device, the method further includes: A packet capture tool file is sent to the second device, where the packet capture tool file is used to capture relevant operation data of the second device itself.
4. The method according to claim 1, It is characterized in that Before sending the remote packet capture request to the second device, the method further includes: The corresponding packet capture parameters are sent to the second device, where the packet capture parameters are used to instruct the second device to capture relevant operation data of itself according to the packet capture parameters.
5. The method according to claim 4, It is characterized in that The packet capture parameters include at least one of a packet capture data storage path, a packet capture duration, a packet capture quantity, and a packet capture filtering rule.
6. The method according to claim 1, It is characterized in that Before sending the remote packet capture instruction to the second device, the method further includes: Establishing a P2P connection with the second device; Establishing a remote connection with the second device based on the P2P connection; The acquiring the relevant operation data from the second device includes: The relevant operation data is obtained from the second device through the remote connection.
7. A packet capture method, It is characterized in that Applied to a second device, the second device establishes a remote connection with a first device, the method comprising: Receiving a remote packet capture request sent by the first device; In response to the remote packet capture request, relevant operation data of the system is captured.
8. The method according to claim 7, It is characterized in that In response to the remote packet capture request, capture relevant operation data of the device, including: Verifying the identity information of the first device; After the verification is passed, the remote packet capture request is responded to to capture the relevant operation data of the self.
9. A remote packet capture device, It is characterized in that Running on a first device, the first device establishes a remote connection with a second device, and the apparatus includes: A request sending module, used for sending a remote packet capture request to the second device, wherein the remote packet capture request is used for instructing the second device to capture relevant operation data of itself; A data acquisition module is used to acquire the relevant operation data from the second device.
10. A packet grabbing device, It is characterized in that The apparatus is operated on a second device, the second device establishes a remote connection with the first device, and the apparatus includes: A request receiving module, used to receive a remote packet capture request sent by the first device; The request response module is used to respond to the remote packet capture request and capture its own related operation data.
11. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 8 is executed.
12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.
Citation Information
Cited By
Remote packet capturing method and system based on cloud host, electronic equipment and storage medium
CN119697280A
