Data packet capture method, device, equipment and computer readable medium

By deploying agents and packet capture services on the cloud server, the problem that each client needs to install a packet capture tool is solved, efficiency and resource utilization are improved, and multiple people can view and use the packet capture function at the same time.

CN115002203BActive Publication Date: 2024-09-20JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202110231159.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-02
Publication Date
2024-09-20
Estimated Expiration
2041-03-02

AI Technical Summary

Technical Problem

In the existing technology, each machine for debugging needs to install a packet capture tool and configure the corresponding port and host number, resulting in low execution efficiency and serious waste of resources, and the captured data cannot be viewed or used by multiple people at the same time.

Method used

By deploying a proxy service and a packet capture service on the cloud server, a communication connection is established between the client and the cloud server. The proxy service serves as an intermediate node for data forwarding, and the packet capture service captures communication data packets on the cloud server to avoid each Install the packet capture tool on the client.

Benefits of technology

It solves the technical problem that each client needs to install a packet capture tool, improves execution efficiency, reduces resource waste, and allows multiple people to view and use packet capture data at the same time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115002203B
    Figure CN115002203B
Patent Text Reader

Abstract

The present application relates to a data packet capture method, device, equipment and computer-readable medium. The method includes: establishing a communication connection between a proxy service and a client, and establishing a communication connection between a proxy service and a cloud server, wherein the proxy service is used as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server; when the proxy service forwards the communication data between the client and the cloud server, the data packet is captured by a packet capture service, and the data packet includes the communication data, and the packet capture service is deployed on the cloud server. The present application solves the technical problem that each client needs to install a packet capture tool by deploying a packet capture tool on the cloud server, thereby performing data packet capture on the cloud server side.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data packet capture method, device, equipment and computer-readable medium. Background Art

[0002] Data is transmitted in the form of data packets on the network. Data packets can be intercepted during transmission, which is called packet capture. Packet capture is to intercept, resend, edit, transfer, and other operations on data packets sent and received by the network. By capturing the data transmitted on the network, it can be analyzed, such as network fault analysis, program network interface analysis, Trojan communication data content analysis, etc. In program development, packet capture is also very helpful for program debugging.

[0003] At present, in the related technology, each machine for debugging needs to install the corresponding packet capture tool and configure the corresponding port and host number. The repetitive and tedious process results in low execution efficiency and serious waste of resources.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The present application provides a data packet capture method, apparatus, device and computer-readable medium to solve the technical problem that each client needs to install a packet capture tool.

[0006] According to one aspect of an embodiment of the present application, the present application provides a data packet capture method, including: establishing a communication connection between a proxy service and a client, and establishing a communication connection between the proxy service and a cloud server, the proxy service is used to serve as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server; when the proxy service forwards communication data between the client and the cloud server, the data packet is captured through a packet capture service, and the data packet includes communication data, and the packet capture service is deployed on the cloud server.

[0007] Optionally, establishing a communication connection between the proxy service and the client includes: obtaining a connection request sent by the client through the proxy service, the connection request being a request from the client to communicate with the cloud server through a target port, and the target port being a port provided by the client; extracting a preset port number carried in the connection request, the preset port number being the port number of the target port; and sending a connection confirmation message to the target port of the client according to the preset port number to establish a first communication connection between the proxy service and the client.

[0008] Optionally, establishing a communication connection between the proxy service and the cloud server includes: obtaining configuration information sent by the client through the proxy service, the configuration information is sent by the client through the first communication connection, and the configuration information is used to save the communication configuration required for the client to communicate data with the cloud server; extracting the target domain name carried in the configuration information, the target domain name is the domain name to which the client wants to connect through the target port, and the target domain name is included in multiple domain names provided by the cloud server; connecting the proxy service to the target domain name to establish a second communication connection between the proxy service and the cloud server.

[0009] Optionally, before capturing the data packet through the packet capture service, the method also includes: when the client exchanges keys with the cloud server via the first communication connection and the second communication connection, determining an interception certificate through the packet capture service, and the interception certificate is generated according to data generated during the key exchange.

[0010] Optionally, when the client exchanges keys with the server via the first communication connection and the second communication connection, determining the interception certificate through the packet capture service includes: obtaining a target digital certificate sent by the cloud server through a proxy service, where the target digital certificate is a digital certificate that matches the target domain name, and the target digital certificate is sent by the cloud server through the second communication connection; extracting the common name and subject alternative name carried in the target digital certificate; passing the common name and subject alternative name to the packet capture service to generate an interception certificate using the packet capture service.

[0011] Optionally, when the proxy service forwards communication data between the client and the cloud server, capturing the data packet through the packet capture service includes: obtaining a data request sent by the client to the cloud server through the proxy service; and capturing data according to the interception certificate using the packet capture service.

[0012] Optionally, when the proxy service forwards communication data between the client and the cloud server, capturing data packets through the packet capture service also includes: obtaining data sent by the cloud server to the client in response to the data request through the proxy service; and using the packet capture service to capture data according to the interception certificate.

[0013] Optionally, capturing data according to the interception certificate using the packet capture service includes: decrypting the captured data using a key carried in the interception certificate; and saving the decrypted data when the captured data is successfully decrypted.

[0014] Optionally, capturing data packets through the packet capture service also includes: configuring a target expression in the packet capture service; using the target expression to filter redundant data in the decrypted data that does not match the target expression, obtaining target data, and saving the target data.

[0015] Optionally, after saving the target data, the method further includes: transmitting the target data to the message queue through the first communication connection, so that when the client monitors that there is target data in the message queue, it extracts the target data and displays it on the target display interface.

[0016] Optionally, when at least one packet capture data viewing request is received, the method further includes: extracting a target address carried in the packet capture data viewing request, the target address being the Internet Protocol address of the client sending the packet capture data viewing request; and sending target data to the target address to display the target data on the client having the target address.

[0017] Optionally, when multiple data capture requests are received, the method also includes: establishing a communication connection between the proxy service and the client that matches each data capture request, and establishing a communication connection between the proxy service and the cloud server, the data capture request including a connection request sent by the client to the cloud server and configuration information sent by the client to the cloud server; capturing the communication data generated in each port through the packet capture service, and sending the communication data to the client corresponding to each port.

[0018] According to another aspect of an embodiment of the present application, the present application provides a data packet capture device, including: a communication proxy module, used to establish a communication connection between a proxy service and a client, and to establish a communication connection between the proxy service and a cloud server, the proxy service is used to serve as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server; a packet capture module, used to capture data packets through the packet capture service when the proxy service forwards communication data between the client and the cloud server, the data packets include communication data, and the packet capture service is deployed on the cloud server.

[0019] According to another aspect of an embodiment of the present application, the present application provides an electronic device, including a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, the memory and the processor communicate through the communication bus and the communication interface, and the steps of the above method are implemented when the processor executes the computer program.

[0020] According to another aspect of an embodiment of the present application, the present application also provides a computer-readable medium having a non-volatile program code executable by a processor, and the program code enables the processor to execute the above method.

[0021] The above technical solution provided by the embodiment of the present application has the following advantages compared with the related art:

[0022] The technical solution of this application is to establish a communication connection between the proxy service and the client, and to establish a communication connection between the proxy service and the cloud server. The proxy service is used as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server. When the proxy service forwards the communication data between the client and the cloud server, the packet is captured by the packet capture service, and the packet includes the communication data. The packet capture service is deployed on the cloud server. This application solves the technical problem that each client needs to install the packet capture tool by deploying the packet capture tool on the cloud server, thereby performing data packet capture on the cloud server side. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0025] Figure 1 A schematic diagram of a hardware environment for an optional data packet capture method provided according to an embodiment of the present application;

[0026] Figure 2 A flowchart of an optional data packet capture method provided according to an embodiment of the present application;

[0027] Figure 3 This is a schematic diagram of an optional data interaction provided according to an embodiment of the present application;

[0028] Figure 4 A schematic diagram of using an optional packet capture tool provided according to an embodiment of the present application;

[0029] Figure 5 A block diagram of an optional data packet capture device provided according to an embodiment of the present application;

[0030] Figure 6 A schematic diagram of an optional electronic device structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 making creative work are within the scope of protection of this application.

[0032] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application and have no specific meaning. Therefore, "module" and "component" can be used interchangeably.

[0033] In the related art, each machine performing debugging work needs to install the corresponding packet capture tool and configure the corresponding port and host number. The repetitive and cumbersome process results in low execution efficiency, and a large amount of host configuration data is prone to cause confusion. The data captured by the packet capture tool cannot be viewed by multiple people at the same time, and multiple people cannot use the packet capture tool at the same time, resulting in serious waste of resources.

[0034] In order to solve the problem mentioned in the background technology, according to one aspect of the embodiments of the present application, an embodiment of a data packet capture method is provided.

[0035] Optionally, in the embodiment of the present application, the above data packet capture method can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. Figure 1 As shown, the server 103 is connected to the terminal 101 via a network, and can be used to provide services for the terminal or a client installed on the terminal. A database 105 can be set on the server or independently of the server to provide data storage services for the server 103. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 includes but is not limited to a PC, a mobile phone, a tablet computer, etc.

[0036] A data packet capture method in the embodiment of the present application can be executed by the server 103, or can be executed by the server 103 and the terminal 101 together, such as Figure 2 As shown, the method may include the following steps:

[0037] Step S202, establish a communication connection between the proxy service and the client, and establish a communication connection between the proxy service and the cloud server. The proxy service is used as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server.

[0038] In an embodiment of the present application, the client communicates with the cloud server via a network, the client sends a data request to the cloud server, and the cloud server responds to the data request and returns the required data to the client. An embodiment of the present application provides a cloud-based packet capture tool, including the above-mentioned proxy service. The cloud-based packet capture tool needs to perform data packet capture, and the proxy service needs to be used as an intermediate node for communication between the client and the cloud server, that is, the proxy service is used to forward the data request sent by the client to the cloud server, and the response data sent by the cloud server to the client, thereby intervening in the communication between the client and the cloud server on the basis of ensuring normal communication between the client and the cloud server. The proxy service is deployed on the cloud server, so that when the user needs to capture packet data during development testing, program debugging, etc., there is no need to download and install the packet capture tool on the client, nor is there a need to deploy the environment, debugging tools, etc.

[0039] Step S204, when the proxy service forwards the communication data between the client and the cloud server, the packet capture service captures the data packet, the data packet includes the communication data, and the packet capture service is deployed on the cloud server.

[0040] In the embodiment of the present application, the cloud packet capture tool also includes the packet capture service, which is used to capture communication data when the proxy service forwards communication data. The packet capture service can be deployed on the cloud server, and the user only needs to configure the port, access domain name, etc. to capture the communication data between the client and the cloud server through the cloud packet capture tool.

[0041] Through the above steps S202 to S204, the present application deploys the packet capture tool on the cloud server, thereby performing data packet capture on the cloud server side, solving the technical problem that each client needs to install the packet capture tool.

[0042] Optionally, establishing a communication connection between the proxy service and the client includes:

[0043] Step 11, obtaining a connection request sent by the client through the proxy service, where the connection request is a request from the client to communicate with the cloud server through a target port, where the target port is a port provided by the client;

[0044] Step 12, extracting the preset port number carried in the connection request, where the preset port number is the port number of the target port;

[0045] Step 13: Send connection confirmation information to the target port of the client according to the preset port number to establish a first communication connection between the proxy service and the client.

[0046] In the embodiment of the present application, if the client wants to access the cloud server, the client sends a connection request to the cloud server. After the connection request is intercepted by the proxy service, the proxy service "disguises" itself as the cloud server and sends a confirmation message of the connection establishment to the target port of the client. At this time, the proxy service and the client can communicate through the target port of the client, and all data exchanges between the two pass through the target port. The port provided on the client only provides services for one communication link at a time. The communication connection between the client and the proxy service is the above-mentioned first communication connection.

[0047] Optionally, establishing a communication connection between the proxy service and the cloud server includes:

[0048] Step 21, obtaining configuration information sent by the client through the proxy service, where the configuration information is sent by the client through the first communication connection, and the configuration information is used to store the communication configuration required for the client to communicate data with the cloud server;

[0049] Step 22, extracting the target domain name carried in the configuration information, where the target domain name is the domain name that the client wants to connect to through the target port, and the target domain name is included in the multiple domain names provided by the cloud server;

[0050] Step 23, connecting the proxy service to the target domain name to establish a second communication connection between the proxy service and the cloud server.

[0051] In the embodiment of the present application, after receiving the confirmation information of the connection establishment returned by the proxy service, the client identifies the proxy service as a cloud server, which is equivalent to the client believing that it is communicating with the cloud server. Therefore, in order to achieve the access purpose, the client sends configuration information to the "cloud server", including the target domain name to be accessed. The above configuration information is the communication configuration between the client and the cloud server, such as how to encrypt the communication between the client and the cloud server, which requires the establishment of a TLS (Transport Layer Security, a transport layer security protocol used to provide confidentiality and data integrity between two applications) connection. The predecessor of the TLS transport layer security protocol is the SSL (Secure Sockets Layer) protocol.

[0052] In the embodiment of the present application, after the proxy service obtains the target domain name to which the client wants to connect, it sends a connection request to the cloud server to connect to the target domain name. The client can use the SNI (Server Name Indication) extension service to inform the cloud server of the target domain name that the client wants to access, so that the cloud server can determine the domain name that the client wants to access without performing DNS (Domain Name System) domain name resolution, thereby improving access efficiency and reducing resource waste.

[0053] In the embodiment of the present application, the above configuration information may be the configuration information required for the client to establish a TLS connection with the cloud server. Establishing a TLS connection is achieved through a TLS handshake, mainly through the following steps:

[0054] Step 31, the client initiates a request: the client transmits the request information in plain text, including version information, a candidate list of encryption suites, a candidate list of compression algorithms, a random number, an extended field, and other information. The version information is the SSL / TLS version supported by the client, such as TLSv1.2. The candidate list of encryption suites is a list of encryption suites (cipher suites) supported by the client. Each encryption suite corresponds to a combination of four functions in the TLS principle: authentication algorithm (for identity authentication), key exchange algorithm (for key negotiation), symmetric encryption algorithm (for information encryption), and information digest (for integrity verification). The random number random_C is used for subsequent key generation. The extended field is the relevant parameters of the supported protocols and algorithms and other auxiliary information, such as the above-mentioned SNI extended field.

[0055] Step 32, the cloud server responds: The cloud server returns the negotiation information results, including the selected protocol version, the selected encryption suite, the selected compression algorithm, the random number random_S, etc., where the random number is used for subsequent key negotiation. The cloud server also sends back its digital certificate, which usually contains the name of the cloud server, a trusted certificate authority (CA), and the public key of the cloud server.

[0056] Step 33, the client responds: The client needs to send the client's certificate to the cloud server so that the cloud server can verify the legitimacy of the client. The client also needs to check the cloud server's certificate. If the certificate is not issued by a trusted organization, or the domain name in the certificate is inconsistent with the actual domain name, or the certificate has expired, a warning will be displayed to the visitor, who will choose whether to continue the communication. If there is no problem with the certificate, the client will extract the server's public key from the server certificate. Then, a random number, a coding change notification, and a client handshake end notification are sent to the server. The random number is encrypted with the server's public key to prevent eavesdropping. For example, a 48-byte Key can be generated: the client uses encryption algorithms such as RSA and Diffie-Hellman to generate a 48-byte Pre-master. At this point, the client has obtained all the information needed to calculate the negotiation key: two plaintext random numbers random_C and random_S and the Pre-master generated by itself, and the negotiation key enc_key=Fuc(random_C, random_S, Pre-Master) is calculated using the above three random numbers. The encoding change notification indicates that all subsequent information will be sent using the encryption method and key agreed upon by both parties. The client handshake end notification indicates that the client's handshake phase has ended. This item is also the hash value of all content sent previously, which is used for verification by the cloud server.

[0057] Step 34, the final response of the cloud server: The cloud server uses the private key to decrypt the encrypted Pre-master data, and based on the two plaintext random numbers random_C and random_S exchanged previously, calculates the negotiated key: enc_key = Fuc (random_C, random_S, Pre-Master). The cloud server calculates the hash value of all previously received information, and then decrypts the client handshake end notification sent by the client to verify the correctness of the data and key. In response to the encoding change notification sent by the client, the cloud server also sends an encoding change notification to the client, informing the client that it has switched to the negotiated encryption suite state and is ready to use the encryption suite and encrypt data. Finally, the cloud server will also use the encryption algorithm to encrypt a handshake end message and send it to the client to verify whether the encryption and decryption channel previously established through the handshake was successful.

[0058] In the embodiment of the present application, the proxy service acts as an intermediate node for the client to communicate with the cloud server, and the packet capture service performs data packet capture as follows: Figure 3As shown, the connection request sent by the client is intercepted by the proxy service and "disguised" as a cloud server responding to the client. The client believes that it is communicating with the cloud server, so it sends configuration information including the target domain name and other information to the proxy service. The proxy service successfully establishes a connection with the cloud server using the configuration information sent by the client. The cloud server responds to the connection of the proxy service and returns the target digital certificate. The proxy service forwards the target digital certificate to the client to complete the TLS handshake. After that, when the client communicates with the cloud server, the packet capture service can perform data packet capture.

[0059] Optionally, before capturing the data packet through the packet capture service, the method further includes:

[0060] When the client exchanges keys with the cloud server via the first communication connection and the second communication connection, an interception certificate is determined through the packet capture service, and the interception certificate is generated according to data generated during the key exchange.

[0061] In the embodiment of the present application, the process of exchanging reverse keys between the client and the cloud server is included in the above-mentioned TLS handshake process, and the proxy service can generate an interception certificate based on the data of plain text communication during the key exchange process.

[0062] Optionally, when the client exchanges keys with the server via the first communication connection and the second communication connection, determining the interception certificate through the packet capture service specifically includes:

[0063] Step 41, obtaining a target digital certificate sent by the cloud server through a proxy service, where the target digital certificate is a digital certificate matching the target domain name, and the target digital certificate is sent by the cloud server through a second communication connection;

[0064] Step 42, extracting the common name and subject alternative name carried in the target digital certificate;

[0065] Step 43: pass the common name and the subject alternative name to the packet capture service to generate an interception certificate using the packet capture service.

[0066] In the embodiment of the present application, the target digital certificate sent by the cloud server includes a trusted certificate authority (CA), and the proxy service extracts the common name (Common Name) and the subject alternative name (Subject Alternative Name) therein and passes them to the packet capture service to generate an interception certificate. The common name and the subject alternative name are used for identity authentication. The common name (Common Name) is the domain name (Domain) or subdomain (Subdomain) used to apply for the target digital certificate.

[0067] Optionally, in the case where the proxy service forwards the communication data between the client and the cloud server, capturing the data packet through the packet capture service includes:

[0068] Step 51, obtaining the data request sent by the client to the cloud server through the proxy service;

[0069] Step 52, using the packet capture service to capture data according to the interception certificate.

[0070] In the embodiment of the present application, the proxy service acts as an intermediate node for communication between the client and the cloud server. When forwarding the data request sent by the client to the cloud server, the packet capture service can capture data, wherein the captured data is the data generated in the above-mentioned target port of the client, that is, the client can access the cloud server through multiple ports, and the user can simultaneously set multiple ports of the client to communicate with the cloud server, and then capture the data generated on each port through the cloud packet capture tool.

[0071] Optionally, in the case where the proxy service forwards the communication data between the client and the cloud server, capturing the data packet through the packet capture service further includes:

[0072] Step 61, obtaining data sent by the cloud server to the client in response to the data request through the proxy service;

[0073] Step 62, using the packet capture service to capture data according to the interception certificate.

[0074] In the embodiment of the present application, the proxy service acts as an intermediate node for communication between the client and the cloud server. When forwarding the response data sent by the cloud server to the client, the packet capture service can capture data, wherein the captured data is transmitted to the client through the above-mentioned target port of the client. The client can access the cloud server through multiple ports, and the cloud server can also return corresponding data for data requests from multiple ports, and return the corresponding data to the corresponding sending port. The user can simultaneously set multiple ports of the client to communicate with the cloud server, and then capture the data generated on each port through the cloud packet capture tool.

[0075] Optionally, using the packet capture service to capture data according to the interception certificate includes:

[0076] Step 71, decrypting the captured data using the key carried in the interception certificate;

[0077] Step 72, when the captured data is successfully decrypted, save the decrypted data.

[0078] In an embodiment of the present application, the packet capture service can decrypt the communication data by intercepting the key in the certificate. The key is equivalent to the private key held by the client or the cloud server. The client encrypts the data with the public key matching the private key held by the cloud server and sends it to the cloud server. When the proxy service forwards the encrypted data, the packet capture service captures it and decrypts the data using the private key held by the cloud server. The successfully decrypted data is saved. The cloud server encrypts the data with the public key matching the private key held by the client and sends it to the client. When the proxy service forwards the encrypted data, the packet capture service captures it and decrypts the data using the private key held by the client. The successfully decrypted data is saved.

[0079] Optionally, capturing data packets through the packet capture service also includes:

[0080] Step 81, configure the target expression in the packet capture service;

[0081] Step 82, using the target expression to filter the redundant data in the decrypted data that does not match the target expression, obtain the target data, and save the target data.

[0082] In the embodiment of the present application, the data can also be filtered and intercepted by means of regular expressions, for example, using an expression to set only data carrying target characters to be captured, or using an expression to set not to capture data carrying target characters, etc.

[0083] Optionally, after saving the target data, the method further includes:

[0084] The target data is transmitted to the message queue through the first communication connection, so that when the client monitors that there is the target data in the message queue, the client extracts the target data and displays it on the target display interface.

[0085] In an embodiment of the present application, data can be cached through a message queue. When a user using the client needs to view the packet capture data of a certain port, the message queue is searched to see whether there is packet capture data for the port. If so, the data is displayed on the display screen.

[0086] Optionally, when at least one packet capture data viewing request is received, the method further includes:

[0087] Step 91, extracting the target address carried in the packet capture data viewing request, where the target address is the Internet Protocol address of the client sending the packet capture data viewing request;

[0088] Step 92: Send the target data to the target address, so as to display the target data on the client having the target address.

[0089] In the embodiment of the present application, if multiple users access the cloud packet capture tool through multiple clients and send a request to view the captured packet data, the proxy service sends the captured packet data (i.e., target data) to each client, and each client is distinguished by its own Internet Protocol address. Alternatively, a client can also access the cloud server through multiple ports, that is, the cloud packet capture tool can capture data from multiple ports on a client, and send the data of each port to the user respectively, and the user can choose to view the captured data on one or more ports.

[0090] Optionally, when multiple data crawling requests are received, the method further includes:

[0091] Step 101, establishing a communication connection between the proxy service and each client matching the data capture request, and establishing a communication connection between the proxy service and the cloud server, wherein the data capture request includes a connection request sent by the client to the cloud server and configuration information sent by the client to the cloud server;

[0092] Step 102: Capture the communication data generated in each port through the packet capture service, and send the communication data to the client corresponding to each port.

[0093] Step 103: The configuration information includes the port provided by the cloud server, and the ports used by any two clients are different.

[0094] In an embodiment of the present application, when multiple users perform data capture, the proxy service can respectively connect to one or more ports of each client for which data needs to be captured, and then establish a TLS connection with each port of each client through the TLS handshake method as described above, as well as a TLS connection between the proxy service and the cloud server, so that the cloud-based packet capture tool can process multiple data capture tasks in parallel.

[0095] The present application embodiment provides a usage process of a cloud packet capture tool as follows: Figure 4 As shown. The user connects to a proxy tool (equivalent to the above-mentioned proxy service) via the Internet, such as Mitmproxy. Mitmproxy can customize extended functions by writing scripts, and can also complete host configuration, port configuration, etc. through custom scripts. After the user issues a data packet capture request, the cloud packet capture tool starts, saves the port information, host information, etc. configured by the user in the cloud server, and starts the packet capture service to capture data. The packet capture service can be mitmweb, etc. After the data is captured, the captured data is displayed on the client. When the cloud packet capture tool provided in this application is deployed on a cloud server, it is necessary to deploy the front-end interface and the back-end database, dependency library, etc. separately, and the user can perform port configuration, host configuration, etc. through the front-end interface of the cloud packet capture tool.

[0096] According to another aspect of the embodiment of the present application, Figure 5 As shown, a data packet capture device is provided, comprising:

[0097] The communication proxy module 501 is used to establish a communication connection between the proxy service and the client, and to establish a communication connection between the proxy service and the cloud server. The proxy service is used as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server;

[0098] The packet capture module 503 is used to capture data packets through the packet capture service when the proxy service forwards the communication data between the client and the cloud server. The data packets include the communication data. The packet capture service is deployed on the cloud server.

[0099] It should be noted that the communication agent module 501 in this embodiment can be used to execute step S202 in the embodiment of the present application, and the packet capture module 503 in this embodiment can be used to execute step S204 in the embodiment of the present application.

[0100] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware.

[0101] Optionally, the communication proxy module is specifically used to: obtain a connection request sent by the client through the proxy service, the connection request is a request from the client to communicate with the cloud server through a target port, and the target port is a port provided by the client; extract a preset port number carried in the connection request, the preset port number is the port number of the target port; send a connection confirmation message to the target port of the client according to the preset port number to establish a first communication connection between the proxy service and the client.

[0102] Optionally, the communication proxy module is also used to: obtain configuration information sent by the client through the proxy service, the configuration information is sent by the client through the first communication connection, and the configuration information is used to save the communication configuration required for the client to communicate data with the cloud server; extract the target domain name carried in the configuration information, the target domain name is the domain name to which the client wants to connect through the target port, and the target domain name is included in the multiple domain names provided by the cloud server; connect the proxy service to the target domain name to establish a second communication connection between the proxy service and the cloud server.

[0103] Optionally, the data packet capture device also includes an interception certificate generation module, which is used to: when the client exchanges keys with the cloud server via the first communication connection and the second communication connection, determine the interception certificate through the packet capture service, and the interception certificate is generated based on the data generated during the key exchange.

[0104] Optionally, the interception certificate generation module is specifically used to: obtain the target digital certificate sent by the cloud server through the proxy service, the target digital certificate is a digital certificate that matches the target domain name, and the target digital certificate is sent by the cloud server through the second communication connection; extract the common name and subject alternative name carried in the target digital certificate; pass the common name and subject alternative name to the packet capture service to generate an interception certificate using the packet capture service.

[0105] Optionally, the packet capture module is specifically used to: obtain a data request sent by the client to the cloud server through a proxy service; and capture data using the packet capture service according to the interception certificate.

[0106] Optionally, the packet capture module is further used to: obtain data sent by the cloud server to the client in response to the data request through a proxy service; and capture data according to the interception certificate using the packet capture service.

[0107] Optionally, the packet capture module is further used to: decrypt the captured data using the key carried in the interception certificate; and save the decrypted data when the captured data is successfully decrypted.

[0108] Optionally, the packet capture module is further used to: configure a target expression in the packet capture service; use the target expression to filter redundant data in the decrypted data that does not match the target expression, obtain the target data, and save the target data.

[0109] Optionally, the data packet capture device also includes a data display module, which is used to: transmit the target data to the message queue through the first communication connection, so that when the client monitors that there is target data in the message queue, it extracts the target data and displays it on the target display interface.

[0110] Optionally, the data display module is also used to: extract the target address carried in the packet capture data viewing request, the target address being the Internet Protocol address of the client sending the packet capture data viewing request; and send target data to the target address to display the target data on the client having the target address.

[0111] Optionally, the data packet capture device also includes a parallel processing module, which is used to: establish a communication connection between the proxy service and each client that matches the data capture request, and establish a communication connection between the proxy service and the cloud server, the data capture request includes a connection request sent by the client to the cloud server and configuration information sent by the client to the cloud server; capture the communication data generated in each port through the packet capture service, and send the communication data to the client corresponding to each port.

[0112] According to another aspect of the embodiments of the present application, the present application provides an electronic device, such as Figure 6 As shown, it includes a memory 601, a processor 603, a communication interface 605 and a communication bus 607. The memory 601 stores a computer program that can be run on the processor 603. The memory 601 and the processor 603 communicate through the communication interface 605 and the communication bus 607. When the processor 603 executes the computer program, the steps of the above method are implemented.

[0113] The memory and processor in the above electronic device communicate via a communication bus and a communication interface. The communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.

[0114] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0115] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0116] According to another aspect of the embodiments of the present application, a computer-readable medium having a non-volatile program code executable by a processor is provided.

[0117] Optionally, in an embodiment of the present application, the computer-readable medium is configured to store program codes for the processor to perform the following steps:

[0118] Establish a communication connection between the proxy service and the client, and establish a communication connection between the proxy service and the cloud server. The proxy service is used as an intermediate node for communication between the client and the cloud server, and the proxy service is deployed on the cloud server;

[0119] In the case where the proxy service forwards the communication data between the client and the cloud server, the data packet is captured by the packet capture service, and the data packet includes the communication data. The packet capture service is deployed on the cloud server.

[0120] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0121] When the embodiments of the present application are specifically implemented, reference may be made to the above-mentioned embodiments, which have corresponding technical effects.

[0122] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.

[0123] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0124] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0126] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0127] 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.

[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0129] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk. It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "include" or any other variant thereof is 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 that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0130] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A data packet capture method, It is characterized in that include: Establishing a communication connection between the proxy service and the client, and establishing a communication connection between the proxy service and the cloud server, wherein the proxy service is used to act as an intermediate node for communication between the client and the cloud server, forwarding data requests sent by the client to the cloud server to the cloud server, and forwarding response data sent by the cloud server to the client to the client, and the proxy service is deployed on the cloud server; In the case where the proxy service forwards the communication data between the client and the cloud server, capturing a data packet through a packet capture service, wherein the data packet includes the communication data, and the packet capture service is deployed on the cloud server; Establishing a communication connection between the proxy service and the client includes: Acquire, through the proxy service, a connection request sent by the client, wherein the connection request is a request by the client to apply for communication with the cloud server through a target port, and the target port is a port provided by the client; Extracting a preset port number carried in the connection request, wherein the preset port number is the port number of the target port; A connection confirmation message is sent to the target port of the client according to the preset port number to establish a first communication connection between the proxy service and the client.

2. The method according to claim 1, It is characterized in that Establishing a communication connection between the proxy service and the cloud server includes: Acquire, through the proxy service, configuration information sent by the client, wherein the configuration information is sent by the client through the first communication connection, and the configuration information is used to store communication configuration required for the client to communicate data with the cloud server; Extracting a target domain name carried in the configuration information, wherein the target domain name is a domain name to which the client is to connect through the target port, and the target domain name is included in a plurality of domain names provided by the cloud server; The proxy service is connected to the target domain name to establish a second communication connection between the proxy service and the cloud server.

3. The method according to claim 2, It is characterized in that Before capturing the data packet through the packet capture service, the method further includes: When the client exchanges keys with the cloud server via the first communication connection and the second communication connection, an interception certificate is determined through the packet capture service, wherein the interception certificate is generated according to data generated during the key exchange.

4. The method according to claim 3, It is characterized in that When the client exchanges keys with the server via the first communication connection and the second communication connection, determining the interception certificate through the packet capture service includes: Acquire, through the proxy service, a target digital certificate sent by the cloud server, wherein the target digital certificate is a digital certificate matching the target domain name, and the target digital certificate is sent by the cloud server through the second communication connection; Extracting the common name and subject alternative name carried in the target digital certificate; The common name and the subject alternative name are passed to the packet capture service to generate an interception certificate using the packet capture service.

5. The method according to claim 4, It is characterized in that In the case where the proxy service forwards the communication data between the client and the cloud server, capturing the data packet through the packet capture service includes: Acquire, through the proxy service, a data request sent by the client to the cloud server; The packet capture service is used to capture data according to the interception certificate.

6. The method according to claim 5, It is characterized in that In the case where the proxy service forwards the communication data between the client and the cloud server, capturing the data packet through the packet capture service further includes: Acquiring, through the proxy service, data sent by the cloud server to the client in response to the data request; The packet capture service is used to capture data according to the interception certificate.

7. The method according to claim 6, It is characterized in that Using the packet capture service to capture data according to the interception certificate includes: Decrypting the captured data using the key carried in the interception certificate; In case the captured data is successfully decrypted, the decrypted data is saved.

8. The method according to claim 7, It is characterized in that Capturing data packets through the packet capture service also includes: Configuring a target expression in the packet capture service; The target expression is used to filter redundant data in the decrypted data that does not match the target expression, obtain target data, and save the target data.

9. The method according to claim 8, It is characterized in that After saving the target data, the method further includes: The target data is transmitted to the message queue through the first communication connection, so that when the client monitors that the target data exists in the message queue, the client extracts the target data and displays it on the target display interface.

10. The method according to claim 9, It is characterized in that In the case of receiving at least one packet capture data viewing request, the method further includes: Extracting a target address carried in the packet capture data viewing request, wherein the target address is an Internet Protocol address of a client sending the packet capture data viewing request; The target data is sent to the target address, so as to display the target data on the client having the target address.

11. The method according to any one of claims 1 to 10, It is characterized in that In the case of receiving multiple data crawling requests, the method further includes: Establishing a communication connection between the proxy service and each client matching the data capture request, and establishing a communication connection between the proxy service and the cloud server, wherein the data capture request includes a connection request sent by the client to the cloud server and configuration information sent by the client to the cloud server; The communication data generated in each port is captured by the packet capture service, and the communication data is sent to the client corresponding to each port.

12. A data packet capture device, It is characterized in that include: A communication proxy module, used to establish a communication connection between the proxy service and the client, and to establish a communication connection between the proxy service and the cloud server, wherein the proxy service is used to act as an intermediate node for communication between the client and the cloud server, forwarding data requests sent by the client to the cloud server to the cloud server, and forwarding response data sent by the cloud server to the client to the client, and the proxy service is deployed on the cloud server; A packet capture module, used for capturing a data packet through a packet capture service when the proxy service forwards the communication data between the client and the cloud server, wherein the data packet includes the communication data, and the packet capture service is deployed on the cloud server; The communication proxy module is specifically used to: obtain a connection request sent by a client through a proxy service, where the connection request is a request from the client to communicate with a cloud server through a target port, and the target port is a port provided by the client; extract a preset port number carried in the connection request, where the preset port number is the port number of the target port; and send a connection confirmation message to the target port of the client according to the preset port number to establish a first communication connection between the proxy service and the client.

13. An electronic device comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, and the memory and the processor communicate through the communication bus and the communication interface. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A computer readable medium having a non-volatile program code executable by a processor, It is characterized in that The program code enables the processor to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Method and system for combining redirected download request and agency service to accelerate network service

    CN102594877A

  • Traffic auditing method applicable to cloud environment

    CN107566218A

  • Log buried-point access test method and device and server

    CN107832210A

  • Loophole detection method and device

    CN108173813A

  • Data capture processing method and terminal equipment

    CN109474603A