CN113742408A - Data interaction method based on Protobuf protocol dynamic analysis - Google Patents

Data interaction method based on Protobuf protocol dynamic analysis Download PDF

Info

Publication number
CN113742408A
CN113742408A CN202111033698.3A CN202111033698A CN113742408A CN 113742408 A CN113742408 A CN 113742408A CN 202111033698 A CN202111033698 A CN 202111033698A CN 113742408 A CN113742408 A CN 113742408A
Authority
CN
China
Prior art keywords
interface
data
matching
file
matching rule
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111033698.3A
Other languages
Chinese (zh)
Other versions
CN113742408B (en
Inventor
胡梦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vipshop Guangzhou Software Co Ltd
Original Assignee
Vipshop Guangzhou Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vipshop Guangzhou Software Co Ltd filed Critical Vipshop Guangzhou Software Co Ltd
Priority to CN202111033698.3A priority Critical patent/CN113742408B/en
Publication of CN113742408A publication Critical patent/CN113742408A/en
Application granted granted Critical
Publication of CN113742408B publication Critical patent/CN113742408B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computational Linguistics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a data interaction method based on dynamic analysis of a Protobuf protocol, which can input matching rule data and pre-agreed Protobuf protocol file description contents when a tester configures analog interface data on a front-end page, can monitor and intercept an interface request service after receiving the analog interface data, match the interface request service with the matching rule data in the analog interface data, dynamically analyze the matching rule data through the Protobuf protocol file description contents after successful matching, and return binary array type information obtained after analysis as service response data to an interface requester in the interface request service.

Description

Data interaction method based on Protobuf protocol dynamic analysis
Technical Field
The invention relates to the technical field of development and testing, in particular to a data interaction method and device based on Protobuf protocol dynamic analysis, a storage medium and computer equipment.
Background
The Protobuf (PB for short) is an efficient data transmission format, and can be used only by serializing and deserializing a protocol code file after the Protobuf protocol is analyzed when data is read and written. In an application service development and test link, a reliable and efficient interface mock tool is needed for an application scene of interface data interaction of a PB data protocol, so that development and test personnel can conveniently and quickly simulate interface data of different PB protocol data converted from plain text to deal with different test scenes, and the application service quality is further guaranteed.
At present, for an application scenario of interface data interaction of a PB data protocol, for each piece of data of a Protobuf protocol file, a Protobuf protocol code file needs to be artificially developed and implemented, plaintext data is converted into new Protobuf protocol data to be returned to an interface requester, and tool application service is redeployed.
Disclosure of Invention
The purpose of the present invention is to solve at least one of the above technical defects, especially the technical defect that a great amount of repetitive work is required and manpower is greatly consumed for an application scenario of interface data interaction of a PB data protocol in the prior art.
The invention provides a data interaction method based on Protobuf protocol dynamic analysis, which comprises the following steps:
receiving simulation interface data sent by a front-end page, wherein the simulation interface data comprises matching rule data and a promobuf protocol file description content agreed in advance;
monitoring an interface request service, and matching the interface request service with the matching rule data;
if the matching is successful, dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message;
and returning the binary array type message as service response data to an interface requester in the interface request service.
Optionally, before the step of matching the interface request service with the matching rule data, the method further includes:
and storing the matching rule data into a database.
Optionally, the step of matching the interface request service with the matching rule data includes:
and matching the interface to be requested in the interface request service with the matching rule data in the database.
Optionally, the matching rule data includes a server IP, an interface protocol, a URI, and an interface parameter;
the step of matching the interface to be requested in the interface request service with the matching rule data in the database comprises:
and matching a request source IP, a target IP, an interface request protocol, a request URL and interface access parameters in the interface request service with server IP, interface protocols, URIs and interface access parameters in the database.
Optionally, after the step of matching the interface request service with the matching rule data, the method further includes:
and if the matching is unsuccessful, releasing the intercepted interface request service.
Optionally, the step of dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message includes:
constructing a corresponding dynamic message class based on the Protobuf protocol file description content;
and dynamically analyzing the matching rule data based on the dynamic message class to obtain a binary array type message.
Optionally, the step of constructing a corresponding dynamic message class based on the description content of the Protobuf protocol file includes:
writing the description content of the Protobuf protocol file into a proto file to obtain a description file;
generating a descriptor file based on the description file, wherein the descriptor file is a binary file;
and constructing a corresponding dynamic message class based on the descriptor file.
The invention also provides a data interaction device based on the Protobuf protocol dynamic analysis, which comprises the following steps:
the data receiving module is used for receiving simulation interface data sent by a front-end page, wherein the simulation interface data comprise matching rule data and promissory Protobuf protocol file description content in advance;
the rule matching module is used for monitoring interface request service and matching the interface request service with the matching rule data;
the dynamic analysis module is used for dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message if the matching is successful;
and the data interaction module is used for returning the binary array type message as service response data to an interface requester in the interface request service.
The present invention also provides a storage medium, in which computer readable instructions are stored, and when executed by one or more processors, the one or more processors execute the steps of the method for data interaction based on Protobuf protocol dynamic parsing according to any one of the above embodiments.
The present invention also provides a computer device, in which computer readable instructions are stored, and when executed by one or more processors, the one or more processors execute the steps of the method for data interaction based on dynamic parsing by Protobuf protocol as described in any one of the above embodiments.
According to the technical scheme, the embodiment of the invention has the following advantages:
the invention provides a data interaction method based on dynamic analysis of a Protobuf protocol, which can input matching rule data and pre-agreed Protobuf protocol file description contents when a tester configures analog interface data on a front-end page, can monitor and intercept an interface request service after receiving the analog interface data, match the interface request service with the matching rule data in the analog interface data, dynamically analyze the matching rule data through the Protobuf protocol file description contents after successful matching, and return binary array type information obtained after analysis as service response data to an interface requester in the interface request service.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a data interaction method based on Protobuf protocol dynamic parsing according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a system provided by an embodiment of the invention;
fig. 3 is a schematic diagram of an interface matching rule entry of a front-end page according to an embodiment of the present invention;
FIG. 4 is a schematic flowchart of front-end and back-end interaction provided by an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data interaction device based on Protobuf protocol dynamic parsing according to an embodiment of the present invention;
fig. 6 is a schematic internal structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The Protobuf (PB for short) is an efficient data transmission format, and can be used only by serializing and deserializing a protocol code file after the Protobuf protocol is analyzed when data is read and written. In an application service development and test link, a reliable and efficient interface mock tool is needed for an application scene of interface data interaction of a PB data protocol, so that development and test personnel can conveniently and quickly simulate interface data of different PB protocol data converted from plain text to deal with different test scenes, and the application service quality is further guaranteed.
At present, for an application scenario of interface data interaction of a PB data protocol, for each piece of data of a Protobuf protocol file, a Protobuf protocol code file needs to be artificially developed and implemented, plaintext data is converted into new Protobuf protocol data to be returned to an interface requester, and tool application service is redeployed.
Therefore, the present invention aims to solve the technical problems that in the prior art, a large amount of repetitive work is required and manpower is greatly consumed for an application scenario of interface data interaction of a PB data protocol, and provides the following scheme:
in an embodiment, as shown in fig. 1, fig. 1 is a schematic flowchart of a data interaction method based on Protobuf protocol dynamic parsing according to an embodiment of the present invention; the invention provides a data interaction method based on Protobuf protocol dynamic analysis, which specifically comprises the following steps:
s110: and receiving analog interface data sent by the front-end page.
In this embodiment, for an application scenario of interface data interaction of a PB data protocol, when an interface mock tool is used, corresponding simulation interface data may be input on a front-end page, where the simulation interface data may be matching rule data and a protocol file description content agreed in advance, so that after a back-end receives the data, the interface response data in a json format is dynamically analyzed by using the protocol file description content.
It can be understood that the description content of the Protobuf protocol file is obtained by writing according to a Protobuf protocol agreed by a data producer and a consumer in advance; for example, the contents of the protocol file description may define interface data to be called by the user.
The matching rule data is interface data content in a json format written according to Protobuf protocol file description content, when the interface data is simulated, a tester only needs to simulate the interface data content in the json format, and the interface mock tool can convert a plaintext according to the fixed Protobuf protocol file description content.
It is understood that the interface data content herein includes, but is not limited to, server IP, interface protocol, URI, and interface parameters; the interface mock tool can pretend the technology to be implemented, for example, the front end needs to use some apis for debugging, but the service end does not develop and complete the apis, so that the work of the front end is blocked by the service end, and at this time, the interface mock tool can be pretended to implement the apis and return specific data to help the front end to perform page rendering.
S120: and monitoring the interface request service, and matching the interface request service with the matching rule data.
In this step, after receiving the analog interface data sent by the front-end page in step S110, the back-end service may monitor and intercept the service interface request sent by the front-end, and match the service interface request with the matching rule data, and if the matching is successful, may return the analog interface data as the service response data to the requester of the service interface request.
It is understood that a service interface request may include a request source IP, a target IP, a request protocol, a request URL (including a request URI and an entry parameter), etc., and the server matches the request with the simulated interface data sent by the front-end page after receiving the request processing, and sends the simulated interface data as response data to the requester after the matching is successful.
S130: and if the matching is successful, dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain the binary array type message.
In this step, after the interface request service is matched with the matching rule data in step S120, if the matching is successful, it indicates that the interface data requested in the interface request service corresponds to the simulation interface data. At this time, the matching rule data can be dynamically analyzed based on the description content of the Protobuf protocol file, so as to obtain the binary array type message.
It will be appreciated that Protobuf is a structured data format standard that provides serialization and deserialization methods for storage and exchange, and that the proto file can be used to generate class code in the corresponding language. When interface data of the PB protocol is used for interaction, if the protocol code file needs to be regenerated after the PB protocol file is modified every time, and the tool service application is redeployed to read and write data in a normal serialization and deserialization manner, the working efficiency is low.
Therefore, the matching rule data is dynamically analyzed by using a dynamic analysis mechanism provided by the Protobuf, the Protobuf protocol description file can be dynamically adjusted and generated according to the Protobuf protocol file formulated according to the diversity of the actual service, and then the matching rule data in the json format is dynamically analyzed by using the Protobuf protocol file description content in the Protobuf protocol description file, so that the matching rule data is dynamically converted into the Protobuf protocol data, namely the binary array type message in the application.
S140: and returning the binary array type message as service response data to an interface requester in the interface request service.
In this step, after the binary array type message is obtained in step S130, the binary array type message may be returned as service response data to the interface requester in the successfully matched interface service request, so that the interface requester can perform subsequent work through the interface.
Schematically, as shown in fig. 2, fig. 2 is a schematic diagram of a system provided by an embodiment of the present invention, in fig. 2, when a user accesses a WEB front-end page of a browser, corresponding analog interface data may be input, a main application entry receives the analog interface data, such as interface matching rule configuration, interface data input, i.e., matching rule data in the present application, and PB protocol content input, i.e., contents described in a protocol file agreed in the present application in advance, and then transmits the contents to a back-end service module, which may store rules in a database, and then monitor and match through an interface to determine whether a current interface request service is successfully matched, if matching is successful, the matching rule data is dynamically analyzed through a PB protocol, and a data format of a configuration content is converted into a protocol data, i.e., a binary group type message in the present application, and finally, and returning the binary array type message as service response data to an interface requester in the interface request service.
In the above embodiment, when a tester configures analog interface data on a front-end page, matching rule data and a pre-agreed Protobuf protocol file description content can be input, after receiving the analog interface data, the back-end can store the analog interface data in a database, simultaneously intercept an interface request service, match the interface request service with the matching rule data in the analog interface data, after the matching is successful, dynamically analyze the matching rule data through the Protobuf protocol file description content, and return a binary array type message obtained after the analysis as service response data to an interface requester in the interface request service.
The foregoing embodiment describes a data interaction method based on Protobuf protocol dynamic parsing in the present application, and the following describes matching rule data in the present application.
In one embodiment, before the step of matching the interface request service with the matching rule data in step S120, the method may further include: and storing the matching rule data into a database.
In this embodiment, after the back-end service receives the simulation interface data sent by the front-end page, the matching rule data in the simulation interface data may be stored in the database, so that after monitoring and intercepting the corresponding interface request service, the matching rule data stored in the database is called to match with the corresponding interface request service.
The foregoing embodiment describes matching rule data in the present application, and a process of matching an interface request service with the matching rule data in the present application will be described below.
In one embodiment, the step of matching the interface request service with the matching rule data in step S120 may include:
s121: and matching the interface to be requested in the interface request service with the matching rule data in the database.
In this embodiment, when the interface request service is matched with the matching rule data, the interface to be requested in the interface request service is mainly matched with the matching rule data stored in the database, and the matching may be performed according to a source server IP, an interface protocol, a URI, an interface entry parameter, and the like input by a front end.
The foregoing embodiment describes a matching process between the interface request service and the matching rule data in the present application, and a process of matching an interface to be requested in the interface request service with the matching rule data in the database in the present application will be specifically described below.
In an embodiment, as shown in fig. 3, fig. 3 is a schematic diagram of an interface matching rule entry of a front-end page provided in an embodiment of the present invention; the matching rule data may include server IP, interface protocol, URI, and interface parameters.
The step of matching the interface to be requested in the interface request service with the matching rule data in the database in step S121 may include: and matching a request source IP, a target IP, an interface request protocol, a request URL and interface access parameters in the interface request service with server IP, interface protocols, URIs and interface access parameters in the database.
In this embodiment, as shown in fig. 3, when the rule setting is performed on the simulation interface data in fig. 3, a rule name, a mode, a URL, and Params may be set, so as to form matching rule data.
When the back-end service receives the matching rule data and stores the matching rule data in the database, the request source IP, the target IP, the interface request protocol, the request URL and the interface parameter in the intercepted interface request service can be matched with the server IP, the interface protocol, the URI and the interface parameter stored in the database, so that a corresponding matching result is obtained.
The foregoing embodiment specifically describes a process of matching an interface to be requested in the interface request service in the present application with matching rule data in a database, and a step of unsuccessful matching in the present application will be described below.
In one embodiment, as shown in fig. 4, fig. 4 is a schematic flowchart of front-end and back-end interaction provided by an embodiment of the present invention; after the step of matching the interface request service with the matching rule data in step S120, the method may further include: and if the matching is unsuccessful, releasing the intercepted interface request service.
In this embodiment, if the intercepted interface request service does not match the matching rule data, it indicates that the interface data requested by the current interface request service is not the analog interface data, and at this time, the intercepted interface request service may be released so as to respond to the interface request service through another way.
As shown in fig. 4, the user configures a matching rule on a front-end page and then stores the matching rule in the database, and meanwhile, the back-end service monitors an interception interface, matches the intercepted interface with rule data in the database, if the matching is successful, dynamically analyzes PB description content to obtain a PB description file, serializes a PB description file plaintext and returns the PB description file to the requester, and if the matching is unsuccessful, the interface is not intercepted.
The above embodiment describes the step of unsuccessful matching in the present application, and how to dynamically analyze the matching rule data based on the contents of the descriptions of the Protobuf protocol file in the present application will be described below.
In an embodiment, the step of dynamically analyzing the matching rule data based on the descriptive content of the Protobuf protocol file in step S130 to obtain a binary array type message may include:
s131: and constructing a corresponding dynamic message class based on the Protobuf protocol file description content.
S132: and dynamically analyzing the matching rule data based on the dynamic message class to obtain a binary array type message.
In this embodiment, when the dynamic parsing mechanism of Protobuf is used to process the matching rule data, the message does not need to be deserialized according to the class generated by compiling the proto file, but the dynamic message class is constructed by the descriptor generated by the proto file, and then the message is deserialized (parsed).
Therefore, before dynamically analyzing the matching rule data, the corresponding dynamic message class can be constructed based on the descriptive content of the Protobuf protocol file, so that the matching rule data is dynamically analyzed through the dynamic message class, and the binary array type message is obtained.
The foregoing embodiment explains how to perform a dynamic parsing process on matching rule data based on the description content of the Protobuf protocol file in the present application, and explains how to construct a corresponding dynamic message class based on the description content of the Protobuf protocol file in the present application.
In an embodiment, the step of constructing a corresponding dynamic message class based on the contents described in the Protobuf protocol file in step S131 may include:
s311: and writing the description content of the Protobuf protocol file into a proto file to obtain a description file.
S312: and generating a descriptor file based on the description file, wherein the descriptor file is a binary file.
S313: and constructing a corresponding dynamic message class based on the descriptor file.
In this embodiment, before the back end constructs the corresponding dynamic message class according to the description content of the Protobuf protocol file, a temporary file may be newly created, and it is ensured that the input content in the temporary file is not empty and the format of the protocol content is correct.
After the description content of the proto format file, i.e., the proto file in the present application, is written into the proto format file, a descriptor file may be generated according to the description content in the description file, and then a corresponding dynamic message class may be constructed according to the descriptor file.
It can be understood that, when constructing a dynamic message class, the present application first writes the description content of the Protobuf protocol file into a proto-format file, thereby obtaining a PBMessage object, then obtains a descriptors.descriptor object by using the PBMessage object, and after having the descriptors.descriptor object, it can create a dynamic message object, i.e. the dynamic message class in the present application, and if having the dynamic message class, it can parse the corresponding request.
Further, when generating a descriptor file based on the description file, the descriptor file may be generated by executing a "protoc — descriptor _ set _ out ═ outputpath" command on the description file in the server using a protoc executable file.
In the embodiment, the dynamic parsing mechanism of Protobuf is used for processing the matching rule data, a descriptor file generated by a proto file is used for constructing a DynamicMessage class, interface response data in a json format is parsed through the DynamicMessage class, and data in a binary array type is generated, so that the test efficiency is improved.
The data interaction device based on the dynamic analysis of the Protobuf protocol provided in the embodiment of the present application is described below, and the data interaction device based on the dynamic analysis of the Protobuf protocol described below and the data interaction method based on the dynamic analysis of the Protobuf protocol described above may be referred to correspondingly.
In an embodiment, as shown in fig. 5, fig. 5 is a schematic structural diagram of a data interaction device based on dynamic parsing of a Protobuf protocol according to an embodiment of the present invention, and the present invention further provides a data interaction device based on dynamic parsing of a Protobuf protocol, which includes a data receiving module 210, a rule matching module 220, a dynamic parsing module 230, and a data interaction module 240, and specifically includes the following:
the data receiving module 210 is configured to receive analog interface data sent by a front-end page, where the analog interface data includes matching rule data and a pre-agreed protocol file description content.
And the rule matching module 220 is configured to monitor an interface request service, and match the interface request service with the matching rule data.
And the dynamic analysis module 230 is configured to, if the matching is successful, dynamically analyze the matching rule data based on the descriptive content of the Protobuf protocol file to obtain a binary array type message.
And a data interaction module 240, configured to return the binary array type message as service response data to the interface requester in the interface request service.
In the above embodiment, when a tester configures analog interface data on a front-end page, matching rule data and a pre-agreed Protobuf protocol file description content can be input, after receiving the analog interface data, the back-end can monitor and intercept an interface request service, match the interface request service with the matching rule data in the analog interface data, after matching is successful, dynamically analyze the matching rule data through the Protobuf protocol file description content, and return a binary array type message obtained after analysis as service response data to an interface requester in the interface request service.
In one embodiment, the rule matching module 220 may further include, before:
and the data storage module is used for storing the matching rule data into a database.
In one embodiment, the rule matching module 220 may include:
and the interface matching module is used for matching the interface to be requested in the interface request service with the matching rule data in the database.
In one embodiment, the matching rule data may include server IP, interface protocol, URI, and interface parameter. The interface matching module may include:
and the data matching module is used for matching a request source IP, a target IP, an interface request protocol, a request URL and interface parameter in the interface request service with a server IP, an interface protocol, a URI and an interface parameter in the database.
In one embodiment, after the rule matching module 220, the method may further include:
and the interface release module is used for releasing the intercepted interface request service if the matching is unsuccessful.
In one embodiment, the dynamic parsing module 230 may include:
and the construction module is used for constructing a corresponding dynamic message class based on the Protobuf protocol file description content.
And the analysis module is used for dynamically analyzing the matching rule data based on the dynamic message class to obtain a binary array type message.
In one embodiment, the construction module may include:
and the writing module is used for writing the Protobuf protocol file description content into a proto file to obtain a description file.
And the file generation module is used for generating a descriptor file based on the description file, wherein the descriptor file is a binary file.
And the determining module is used for constructing a corresponding dynamic message class based on the descriptor file.
In one embodiment, the present invention further provides a storage medium, in which computer readable instructions are stored, and when executed by one or more processors, the one or more processors are caused to execute the steps of the data interaction method based on dynamic parsing by Protobuf protocol according to any one of the above embodiments.
In one embodiment, the present invention further provides a computer device, where computer readable instructions are stored, and when executed by one or more processors, cause the one or more processors to perform the steps of the data interaction method based on Protobuf protocol dynamic parsing as described in any one of the above embodiments.
Fig. 6 is a schematic diagram illustrating an internal structure of a computer device according to an embodiment of the present invention, and fig. 6 is a schematic diagram, where the computer device 300 may be provided as a server. Referring to fig. 6, computer device 300 includes a processing component 302 that further includes one or more processors, and memory resources, represented by memory 301, for storing instructions, such as application programs, that are executable by processing component 302. The application programs stored in memory 301 may include one or more modules that each correspond to a set of instructions. Further, the processing component 302 is configured to execute the instructions to perform the data interaction method based on the Protobuf protocol dynamic parsing of any of the embodiments described above.
The computer device 300 may also include a power component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input output (I/O) interface 305. The computer device 300 may operate based on an operating system stored in memory 301, such as Windows Server, Mac OS XTM, Unix, Linux, Free BSDTM, or the like.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, the embodiments may be combined as needed, and the same and similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A data interaction method based on Protobuf protocol dynamic analysis is characterized by comprising the following steps:
receiving simulation interface data sent by a front-end page, wherein the simulation interface data comprises matching rule data and a promobuf protocol file description content agreed in advance;
monitoring an interface request service, and matching the interface request service with the matching rule data;
if the matching is successful, dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message;
and returning the binary array type message as service response data to an interface requester in the interface request service.
2. The method according to claim 1, wherein the step of matching the interface request service with the matching rule data further includes:
and storing the matching rule data into a database.
3. The method according to claim 2, wherein the step of matching the interface request service with the matching rule data includes:
and matching the interface to be requested in the interface request service with the matching rule data in the database.
4. The data interaction method based on Protobuf protocol dynamic parsing of claim 3, wherein the matching rule data includes server IP, interface protocol, URI and interface parameter;
the step of matching the interface to be requested in the interface request service with the matching rule data in the database comprises:
and matching a request source IP, a target IP, an interface request protocol, a request URL and interface access parameters in the interface request service with server IP, interface protocols, URIs and interface access parameters in the database.
5. The method according to claim 1, wherein after the step of matching the interface request service with the matching rule data, the method further comprises:
and if the matching is unsuccessful, releasing the intercepted interface request service.
6. The data interaction method based on Protobuf protocol dynamic analysis according to claim 1, wherein the step of dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message includes:
constructing a corresponding dynamic message class based on the Protobuf protocol file description content;
and dynamically analyzing the matching rule data based on the dynamic message class to obtain a binary array type message.
7. The method according to claim 6, wherein the step of constructing a corresponding dynamic message class based on the description content of the Protobuf protocol file includes:
writing the description content of the Protobuf protocol file into a proto file to obtain a description file;
generating a descriptor file based on the description file, wherein the descriptor file is a binary file;
and constructing a corresponding dynamic message class based on the descriptor file.
8. A data interaction device based on Protobuf protocol dynamic analysis is characterized by comprising the following components:
the data receiving module is used for receiving simulation interface data sent by a front-end page, wherein the simulation interface data comprise matching rule data and promissory Protobuf protocol file description content in advance;
the rule matching module is used for monitoring interface request service and matching the interface request service with the matching rule data;
the dynamic analysis module is used for dynamically analyzing the matching rule data based on the Protobuf protocol file description content to obtain a binary array type message if the matching is successful;
and the data interaction module is used for returning the binary array type message as service response data to an interface requester in the interface request service.
9. A storage medium, characterized by: the storage medium has stored therein computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the Protobuf protocol dynamic parsing based data interaction method according to any of claims 1 to 7.
10. A computer device, characterized by: the computer device has stored therein computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the Protobuf protocol dynamic parsing based data interaction method according to any one of claims 1 to 7.
CN202111033698.3A 2021-09-03 2021-09-03 Protobuf protocol dynamic analysis-based data interaction method Active CN113742408B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111033698.3A CN113742408B (en) 2021-09-03 2021-09-03 Protobuf protocol dynamic analysis-based data interaction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111033698.3A CN113742408B (en) 2021-09-03 2021-09-03 Protobuf protocol dynamic analysis-based data interaction method

Publications (2)

Publication Number Publication Date
CN113742408A true CN113742408A (en) 2021-12-03
CN113742408B CN113742408B (en) 2024-02-02

Family

ID=78735563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111033698.3A Active CN113742408B (en) 2021-09-03 2021-09-03 Protobuf protocol dynamic analysis-based data interaction method

Country Status (1)

Country Link
CN (1) CN113742408B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115454880A (en) * 2022-10-25 2022-12-09 中邮消费金融有限公司 Request processing assembly for dynamically generating data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160065460A1 (en) * 2013-05-10 2016-03-03 Huawei Technologies Co., Ltd. Packet processing method and apparatus
CN106648945A (en) * 2016-09-30 2017-05-10 北京金山安全软件有限公司 Interface data testing method and device and electronic equipment
CN110673856A (en) * 2019-09-30 2020-01-10 新华三大数据技术有限公司 Data processing method and device and machine-readable storage medium
CN111212056A (en) * 2019-12-30 2020-05-29 中电工业互联网有限公司 Data analysis and distribution system and method based on 809 protocol
CN111913922A (en) * 2019-05-10 2020-11-10 北京百度网讯科技有限公司 Binary structured log generation method, device, equipment and storage medium
US20210240712A1 (en) * 2020-01-31 2021-08-05 Salesforce.Com, Inc. Merging multiple unsynchronized streams of related events and multi-tenant support

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160065460A1 (en) * 2013-05-10 2016-03-03 Huawei Technologies Co., Ltd. Packet processing method and apparatus
CN106648945A (en) * 2016-09-30 2017-05-10 北京金山安全软件有限公司 Interface data testing method and device and electronic equipment
CN111913922A (en) * 2019-05-10 2020-11-10 北京百度网讯科技有限公司 Binary structured log generation method, device, equipment and storage medium
CN110673856A (en) * 2019-09-30 2020-01-10 新华三大数据技术有限公司 Data processing method and device and machine-readable storage medium
CN111212056A (en) * 2019-12-30 2020-05-29 中电工业互联网有限公司 Data analysis and distribution system and method based on 809 protocol
US20210240712A1 (en) * 2020-01-31 2021-08-05 Salesforce.Com, Inc. Merging multiple unsynchronized streams of related events and multi-tenant support

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
田丹: "一种Protobuf到JSON动态转换方法", 数据与计算发展前沿, no. 04, pages 155 - 164 *
蔡乐;石荣;许都;: "基于关联规则挖掘的未知协议特征提取方法", 电子信息对抗技术, no. 06, pages 20 - 25 *
隋心怡;王瑞刚;梁小江;: "基于Google Protocol Buffer的即时通讯***设计", 电子科技, no. 01, pages 125 - 128 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115454880A (en) * 2022-10-25 2022-12-09 中邮消费金融有限公司 Request processing assembly for dynamically generating data

Also Published As

Publication number Publication date
CN113742408B (en) 2024-02-02

Similar Documents

Publication Publication Date Title
CN111083225B (en) Data processing method and device in Internet of things platform and Internet of things platform
US10204035B1 (en) Systems, methods and devices for AI-driven automatic test generation
US8745641B1 (en) Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface
Casanova et al. Developing accurate and scalable simulators of production workflow management systems with wrench
CN111930365B (en) Qt-based application program rapid development framework, development method and operation method
CN110287109B (en) Protocol interface testing method and device, computer equipment and storage medium thereof
US6654699B2 (en) Computer network testing system and method using client playback of edited network information
WO2020233369A1 (en) Method for improving software integration system on basis of simulated port, and related device
US20040111727A1 (en) Automatic context management for web applications with client side code execution
US6567767B1 (en) Terminal server simulated client performance measurement tool
CN104932974B (en) A kind of script conversion method and device
US7295953B2 (en) Scenario based testing and load generation for web applications
CN110955409B (en) Method and device for creating resources on cloud platform
US20080091775A1 (en) Method and apparatus for parallel operations on a plurality of network servers
CN111221729B (en) Automatic testing method and system for separating platform service from testing service
CN106919511B (en) Application simulation method, simulation application, operation method thereof and simulation system
CN107168844B (en) Performance monitoring method and device
CN113127356A (en) Pressure measurement method and device, electronic equipment and storage medium
CN113746842A (en) Message sending method based on Protobuf protocol dynamic analysis
CN113742408B (en) Protobuf protocol dynamic analysis-based data interaction method
CN114035789A (en) Log analysis template generation method, log analysis device and log analysis equipment
CN112052163B (en) High concurrency webpage pressure testing method and device, electronic equipment and storage medium
CN111124937B (en) Method and system for assisting in improving test case generation efficiency based on instrumentation function
WO2021093672A1 (en) Method for embedding external system, workflow system, device and computer readable storage medium
CN116521552A (en) Method, device and equipment for acquiring test defects and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant