CN113630295A - Protocol testing method and device - Google Patents

Protocol testing method and device Download PDF

Info

Publication number
CN113630295A
CN113630295A CN202110945459.9A CN202110945459A CN113630295A CN 113630295 A CN113630295 A CN 113630295A CN 202110945459 A CN202110945459 A CN 202110945459A CN 113630295 A CN113630295 A CN 113630295A
Authority
CN
China
Prior art keywords
protocol
copy
base class
class constructor
game
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
CN202110945459.9A
Other languages
Chinese (zh)
Other versions
CN113630295B (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110945459.9A priority Critical patent/CN113630295B/en
Publication of CN113630295A publication Critical patent/CN113630295A/en
Application granted granted Critical
Publication of CN113630295B publication Critical patent/CN113630295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/70Game security or game management aspects
    • A63F13/77Game security or game management aspects involving data related to game devices or game servers, e.g. configuration data, software version or amount of memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a protocol testing method and device. The method comprises the steps of responding to a trigger event of a first game function, generating a first protocol corresponding to the first game function, and sending the first protocol to a base class constructor; calling a hook function corresponding to the base class constructor to copy a first protocol from the base class constructor to obtain a first copy protocol, wherein the execution of the base class constructor is intercepted when the hook function is executed; calling a reduction function to recover the execution of the base class constructor; executing the base class constructor to send the first protocol to the server; receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation; and sending the modified first copy protocol to the base class constructor, and executing the base class constructor to send the modified first copy protocol to the server. The method and the device can accurately capture and modify the protocol to be captured in the game item.

Description

Protocol testing method and device
Technical Field
The present application relates to game development technologies, and in particular, to a protocol testing method and apparatus.
Background
In many game development engines currently on the market, for instance, Unity3d, more than half of all games on clients (including PC, mainframe, mobile device) are created using Unity. After the game item is created, the game item needs to be tested to be played online. Among them, the protocol test for the Unity3d game item is an important test.
The protocol test of the game item is a test for the communication protocol rule between the client and the server. The communication protocol can be understood as an interaction link between a client and a server, and the protocol test is a means for verifying the reliability of the link. The communication protocol is bidirectional, and the game has a protocol that the client sends to the server and a protocol that the server returns to the client. The server generally cannot monitor the source of the received protocol, that is, after receiving any protocol request matching the communication rule, the server executes corresponding logic according to the protocol content corresponding to the protocol request. Some malicious players would, through some special means, have the game client send the protocol multiple times or even try to break and forge the protocol to trick the server into performing additional game logic to gain revenue. Therefore, protocol testing must be done to ensure the robustness and safety of the server game logic.
When conducting protocol testing on a game item, a tester needs to find a protocol to be tested and modify and test the protocol to be tested so as to complete the game item. In the prior art, when a protocol to be tested is found, all protocols of a network card passing through a client are generally captured and displayed through an existing WPE protocol tool, a tester determines the protocol to be tested when a game runs from all the protocols displayed by the WPE protocol tool, and the protocol is modified and then sent to a server again. This method of determining the protocol to be tested is dependent on the ability of the tester and is unreliable, resulting in protocol revision errors if a grab error or a pick error.
Therefore, how to accurately capture and modify the protocol to be tested in the game item is still a problem worthy of research.
Disclosure of Invention
The application provides a protocol testing method and a protocol testing device, which are used for accurately capturing and modifying a protocol to be tested in a game project.
In one aspect, the present application provides a protocol testing method applied to a client, including:
responding to a trigger event of a first game function, generating a first protocol corresponding to the first game function, and sending the first protocol to a base class constructor;
calling a hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, wherein the execution of the base class constructor is intercepted when the hook function is executed;
calling a reduction function to recover the execution of the base class constructor;
executing the base class constructor to send the first protocol to a server;
receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation;
and sending the modified first copy protocol to a base class constructor, and executing the base class constructor to send the modified first copy protocol to the server.
In one embodiment, the method further comprises the following steps:
determining a display type of the first copy protocol according to the type of a protocol parameter in the first copy protocol, and displaying the first copy protocol based on the display type of the first copy protocol, wherein the display type comprises an integer type, a floating point type and a character string;
the receiving a modification operation for the first copy protocol, modifying the first copy protocol in accordance with the modification operation comprising:
displaying the first copy protocol in a display type of the first copy protocol;
receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation.
In one embodiment, the receiving a modification operation for the first copy protocol, the modifying the first copy protocol according to the modification operation includes:
when the first copy protocol is displayed in a corresponding display type, acquiring a modification parameter input by the modification operation, wherein the display type of the modification parameter is the same as that of the first copy protocol;
and modifying the protocol parameters in the first copy protocol according to the modification parameters to obtain the modified first copy protocol.
In one embodiment, the step of copying the first protocol from the base class constructor to obtain a first copy protocol by calling the hook function corresponding to the base class constructor includes:
receiving a protocol grabbing instruction;
and calling a hook function corresponding to the base class constructor according to the protocol grabbing instruction to copy the first protocol from the base class constructor to obtain the first copy protocol.
In one embodiment, the receiving the protocol capture instruction includes:
displaying a protocol capture button;
and responding to the selected operation generation of the protocol grabbing button, and generating the protocol grabbing instruction.
In one embodiment, the method further comprises the following steps:
receiving a protocol grabbing stopping instruction;
and according to the protocol grabbing stopping instruction, stopping calling the hook function corresponding to the base class constructor, copying the first protocol from the base class constructor to obtain a first copy protocol.
In one embodiment, the receiving the protocol stop grab instruction comprises:
displaying a protocol capture stop button;
and responding to the selected operation of the protocol grabbing stopping button, and generating a protocol grabbing stopping instruction.
In another aspect, the present application provides a protocol testing apparatus, including:
the system comprises a protocol generation module, a base class constructor and a game execution module, wherein the protocol generation module is used for responding to a trigger event of a first game function, generating a first protocol corresponding to the first game function and sending the first protocol to the base class constructor;
a protocol copying module, configured to call a hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, where the execution of the base class constructor is intercepted when the hook function is executed;
the function execution module is used for calling the reduction function to recover the execution of the base class constructor;
the protocol sending module is used for executing the base class constructor and sending the first protocol to a server;
a protocol modification module, configured to receive a modification operation for the first copy protocol, and modify the first copy protocol according to the modification operation;
the protocol sending module is further configured to send the modified first copy protocol to a base class constructor, and execute the base class constructor to send the modified first copy protocol to the server.
In one embodiment, the method further comprises the following steps:
the protocol processing module is used for determining the display type of the first copy protocol according to the type of the protocol parameter in the first copy protocol and displaying the first copy protocol based on the display type of the first copy protocol, wherein the display type comprises integer type, floating point type and character string;
the protocol modification module is further configured to display the first copy protocol in a display type of the first copy protocol;
receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation.
In another aspect, the present application provides a computer device comprising a memory for storing instructions, a processor for communicating with other devices, and a transceiver for executing the instructions stored in the memory to cause the computer device to perform the protocol testing method according to the first aspect.
In another aspect, the present application provides a computer device readable storage medium having stored therein computer device executable instructions, which when executed, cause a computer device to perform the protocol testing method according to the first aspect.
In another aspect, the present application provides a computer device program product comprising a computer device program which, when executed by a processor, implements the protocol testing method according to the first aspect.
The method provided by the application can be controlled by a tester to only capture the protocol when a certain function in the game is executed, and the protocol does not need to be searched in all protocols through the network card of the client. Therefore, the situation of protocol capture errors caused by insufficient capability of testers can be avoided, and the situation of protocol modification errors caused by the protocol capture errors is also avoided. Namely, the method provided by the application can accurately capture and modify the protocol to be tested in the game item.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a schematic view of an application scenario of the protocol testing method provided in the present application.
Fig. 2 is a flowchart illustrating a protocol testing method according to an embodiment of the present application.
Fig. 3 is a schematic diagram of modules used in a protocol testing method according to an embodiment of the present application.
Fig. 4 is another schematic diagram of a protocol testing method according to an embodiment of the present application.
Fig. 5 is a flowchart illustrating a protocol testing method according to a second embodiment of the present application.
Fig. 6 is a schematic diagram of a protocol testing apparatus according to a third embodiment of the present application.
FIG. 7 is a schematic diagram of a computer device provided by an embodiment of the present application.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The protocol test for the game item is a test for the rules of the communication protocol between the client and the server. The communication protocol is bidirectional, and the game has a protocol that the client sends to the server and a protocol that the server returns to the client. Since the server generally cannot monitor the source of the received protocol, that is, after receiving any protocol request matching the communication rule, the server will execute the corresponding logic according to the protocol content corresponding to the protocol request. Some malicious players would, through some special means, have the game client send the protocol multiple times or even try to break and forge the protocol to trick the server into performing additional game logic to gain revenue. Therefore, protocol testing must be done to ensure the robustness and safety of the server game logic.
Hereinafter, 3 test cases of the communication protocol between the client and the server will be described by taking the purchase of a prop in mall of the Unity3d game project as an example.
In the first case: bypassing the client judgment, and directly sending a correct protocol to the server to test whether the server has relevant function limitation.
For example, a game mall purchases a shoe prop, the game is designed to limit a player to purchase the shoe prop only 1 time, and after purchasing the shoe prop 1 time, the player cannot purchase the shoe prop again. When the tester tests, after 1 time of purchasing the shoe props, the protocol tool directly sends the purchase protocols of the shoe props to try to purchase again so as to test the protocols. If the server has an associated functional limitation, the tester must not succeed in purchasing after clicking the buy button.
If the server does not have the associated functional limitations, the server must return information to the client like "purchase success". Thus, the player has bought an additional pair of shoes, and the logic of the game design that limits the purchase of 1 shoe prop is violated, so that it can be tested that a logical error occurs in the agreement between the client and the server for the purchase of the shoes prop.
In the second case: the protocol with the modified protocol parameters is sent to the server to test whether the server will execute additional game logic.
For example, if a player spends 10 shoe items in a game mall and the relevant parameters of the shoe items in the protocol for buying the shoe items are modified, the purchased shoe items are changed to more valuable weapon items requiring 20 shoe items. When the server receives the protocol, judges that 10 Yuan Bao is not capable of purchasing 20 Yuan Bao weapon prop, and returns that the purchase fails, the protocol between the client and the server about purchasing the shoe prop has correct logic.
If the server receives the agreement of buying shoes with 10 Yuan Bao, and returns the agreement to the client for successful purchase, the player spends 10 Yuan Bao to obtain more valuable 20 Yuan Bao props, and thus the agreement between the client and the server about buying the shoes props is tested to be wrong.
In the third case: sending many protocols at once can test whether the server can only execute one protocol.
Such as the protocol of spending 20 Yuan Bao in a mall to buy weapon prop, 10 protocols of buying weapon prop are sent to the server at one time. If the server receives 10 protocols for purchasing weapon props, 20 Yuanbao logics are deducted for 10 times and then returned to the client for purchasing 10 weapons, or only 20 Yuanbao are deducted and returned to the client for purchasing 1 weapon. The protocol between the client and the server for purchasing weapons props is certified with the correct logic.
If the server receives all the 10 protocols for purchasing weapon items and returns a successful purchase, the player only spends 20 Yuan and purchases 10 weapon items, which is not in accordance with the game design logic, and the protocol between the client and the server for purchasing weapon items is proved to be wrong.
In conducting protocol testing on a Unity3d game item, a tester needs to find a desired protocol and modify and test the desired protocol to complete the Unity3d game item. For example, when testing the above-mentioned protocol for purchasing shoe props in a mall, the tester needs to find the purchase protocol for shoe props first, and then modify and repeat the test to ensure the robustness of game logic. In the prior art, when a protocol to be tested is found, all protocols of a network card passing through a client are generally grabbed and displayed through an existing WPE protocol tool, a tester determines the protocol to be tested when a game runs from all the protocols displayed by the WPE protocol tool, and the protocol is modified and then sent to a server again. This method of determining the protocol to be tested is dependent on the ability of the tester and is unreliable, resulting in failure to test the protocol if a grab or pick is wrong.
Therefore, how to accurately capture and modify the protocol to be tested in the game item is still a problem worthy of research.
Based on the above, the application provides a protocol testing method and device, and a hook function and a reduction function are set on a base class constructor used when a first protocol of a game item is sent. When the first protocol of the game item is sent, the hook function is called to copy the first protocol from the base class constructor to obtain a first copy protocol, and the first copy protocol is modified and then sent to the server. The hook function is invoked after detecting that the first game function of the game item is triggered, and stopping protocol grabbing until the first game function is completed. Therefore, the hook function only grabs a small number of protocols passing through the client gateway, and the difficulty and time for a tester to screen out a first copy protocol to be tested from the grabbed protocols are reduced. From the perspective of the client, the protocol to be tested in the game item is accurately captured.
Based on accurate capture of the protocol to be tested in the game item, the tester can modify the protocol to be tested, thereby avoiding the situation that the tester cannot accurately find the protocol to be tested due to too much capture of the protocol and too high screening difficulty.
The protocol testing method provided by the application is applied to computer equipment such as computer equipment, a tablet computer, a mobile phone and the like. Fig. 1 is an application schematic diagram of a protocol testing method provided in the present application, in which a game function interface for a game item is shown on a computer device interface, and a tester can operate on the game function interface to trigger a first game function of the game item. After triggering a first game function of a game item, a first copy protocol and a small part of other protocols of the first protocol of the first game function captured are displayed on the interface of the computer device. The first protocol for the first game function continues to be sent to the server. After the tester can modify the first copy protocol, the computer device sends the first copy protocol to the server.
Referring to fig. 2, an embodiment of the present application provides a protocol testing method, including:
s210, responding to a trigger event of the first game function, generating a first protocol corresponding to the first game function, and sending the first protocol to a base class constructor.
The base class constructor is a base class function of a game item bottom protocol, and any logic communication protocol in the game item is transmitted by calling the bottom protocol base class constructor.
Each game function of the game item corresponds to a protocol, when the first game function is triggered by a tester, namely the computer equipment generates a trigger event of the first game function, a first protocol corresponding to the first game function is immediately generated, and the first protocol is sent to the base class constructor.
The first game function is for example the purchase of a shoe prop as described in the second case above, then the first protocol may be understood as the protocol for purchasing a shoe prop, carrying the ID of the shoe prop, such as 1001. The ID 1001 can be modified to represent the 1002 of the weapon when the protocol is tested, so that the judgment logic for spending the number of the shoe-shaped elements and the property value is needed for testing the first protocol, otherwise, the condition that 20 shoe-shaped elements of weapon properties are bought at 10 shoe-shaped elements occurs.
S220, calling the hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, wherein the execution of the base class constructor is intercepted when the hook function is executed.
Both the hook function and the reduction function described below are functions commonly used in the MonoHook technique. When the hook function, the reduction function and the base class constructor are set in an associated mode, a tester obtains the base class constructor, and three MethodInfo objects including the base class constructor, the hook function and the reduction function are used as instantiation parameters to create a MonoHook object.
Specifically, referring to fig. 3, the computer device may be provided with an initialization module, a protocol content module, and a protocol sending module. The initialization module is used to initialize the Monohook object and to execute the Monohook code when the Unity3d game item is started. Upon execution of the MonoHook code, the initialization module instantiates three MethodInfo objects (base class constructor, hook and restore functions), creating a MonoHook object. Thereby completing the association of the hook function, the reduction function and the base class constructor. The protocol content module is configured to save the first protocol and the content of the first protocol when the hook function is called, that is, save a protocol id (identification) of the first protocol and protocol parameters transferred by the first protocol, so as to generate the first copy protocol. The protocol sending module can call the base class constructor to complete the sending of the protocol.
Thus, the hook function can copy the protocol received by the base class constructor through the protocol content module. When the base class constructor receives the first protocol, the hook function copies the first protocol from the base class constructor to obtain a first copy protocol, and the contents of the first copy protocol and the first protocol are the same.
Optionally, as shown in fig. 3, a switch module is further disposed in the computer device. The switch module in the computer equipment can receive a protocol grabbing instruction, and then call the hook function corresponding to the base class constructor according to the protocol grabbing instruction to copy the hook function from the base class constructor to be copied by a first protocol to obtain a first copy protocol. The protocol capture command is input into the computer device by the tester, and optionally, the computer device may display a protocol capture button, and generate the protocol capture command in response to a selected operation of the protocol capture button.
Correspondingly, the switch module in the computer device may further receive a protocol capture stopping instruction, and then stop calling the hook function corresponding to the base class constructor according to the protocol capture stopping instruction to copy the first protocol from the base class constructor to obtain the first copy protocol. Optionally, the computer device may display a protocol capture stop button, and generate the protocol capture stop instruction in response to the selection of the protocol capture stop button.
Alternatively, the capture protocol may be stopped after the protocol to be captured completes the corresponding logic. For example, the agreement to grab is an agreement to buy items in a game mall, and the grabbing agreement can be stopped as soon as the purchase is successful.
S230, calling a reduction function to recover the execution of the base class constructor.
When the hook function executes, the hook function copies the first protocol to obtain the first copy protocol, but the execution of the base class constructor is intercepted when the hook function executes, and at this time, the restore function needs to be called to recover the execution of the base class constructor. I.e. the first protocol will still be sent to the server.
S240, executing the base class constructor to send the first protocol to a server.
As described above in relation to the above, executing the base class constructor may send the first protocol to the server.
S250, receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation.
The modification operation is directly input to the computer device by a tester and is used for modifying the relevant parameters in the first copy protocol. When the relevant parameters of the first copy protocol are modified, the first copy protocol can be displayed in a simple form such as integer, floating point, character string and the like, so as to facilitate the modification of a tester.
S260, sending the modified first copy protocol to a base class constructor, and executing the base class constructor to send the modified first copy protocol to the server.
And after the modified first copy protocol is obtained, sending the modified first copy protocol to the base class constructor, and when the base class constructor executes, sending the modified first copy protocol to the server.
For easier understanding of the execution of steps S210 to S250 in the present embodiment, please refer to the related description of fig. 4 below. In fig. 4, when the client sends the first protocol to the base class constructor, the hook function is called to copy the first protocol to obtain the first copy protocol. And calling a restoring function to recover the execution of the base class constructor and still sending the first protocol to the server. The first copy protocol is modified and then the base class constructor is called to send the modified first copy protocol to the server. Alternatively, as shown in fig. 4, a Unity editor may be further provided, which may implement the same function as the switch module shown in fig. 3.
The protocol testing method provided by this embodiment may call a hook function corresponding to the base class constructor to copy the first protocol corresponding to the first game function after the first game function of the game item is triggered. And after the first copy protocol is modified based on the modification operation of the tester on the first copy protocol, sending the modified first copy protocol to the server. Thus, the server responds to the modified first copy protocol, modifying the errant game logic caused by the previous response to the errant protocol, such that the game logic of the server for the game item is correct and secure. In addition, the hook function is called after detecting that the first game function of the game item is triggered, so that the hook function does not grab the protocol passing through the base class constructor in all time intervals, and only grabs the first protocol corresponding to the first game function and a small part of other protocols after the first game function is triggered until the protocol grabbing is stopped after the first game function is completed.
Therefore, the protocol testing method provided by the application realizes accurate capture of the protocol in the game item. The protocol corresponding to the first game function and a small part of other protocols in the protocols passing through the client gateway are only captured, so that a tester can determine the protocol to be tested in a small number of protocols. The protocol testing method provided by the application can avoid the situation of protocol capture errors caused by insufficient capability of testers and also avoid the situation of protocol modification errors caused by the protocol capture errors.
Referring to fig. 5, a second embodiment of the present application provides a protocol testing method based on the first embodiment, including:
s510, responding to a trigger event of the first game function, generating a first protocol corresponding to the first game function, and sending the first protocol to a base class constructor.
S520, calling the hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, wherein the execution of the base class constructor is intercepted when the hook function is executed.
S530, calling the reduction function to recover the execution of the base class constructor.
S540, executing the base class constructor to send the first protocol to a server.
For the related description of step S510 to step S540, reference may be made to the related description of step S210 to step S240 in the first embodiment, and details are not repeated here.
S550, determining the display type of the first copy protocol according to the type of the protocol parameter in the first copy protocol, and displaying the first copy protocol based on the display type of the first copy protocol, wherein the display type comprises integer, floating point and character string.
After the protocol content module stores the protocol content of the first protocol to obtain the first replica protocol, the protocol content of the first replica protocol may be analyzed to determine the type of each protocol parameter in the first replica protocol. And determining a display type corresponding to each protocol parameter according to the type of each protocol parameter in the first copy protocol, and converting the first copy protocol into integer, floating point and character strings which can be visually identified by a tester.
Where integer refers to data presented in numerical form, such as presenting the number 10 with a value of 10 dollars. Floating point refers to data presented in decimal form, for example 5.789 is a floating point type of data. A string is a string of characters consisting of numbers, letters, underlines.
The computer device can preset the mapping relation between the type of the protocol parameter and the corresponding display type, for example, the display type corresponding to the gold money recharging protocol is set to be integer, and the recharged amount is shown to be 10 yuan in a numerical form.
And S560, displaying the first copy protocol according to the display type of the first copy protocol.
In the prior art, a WPE protocol tool can only display a captured protocol as binary data or hexadecimal data, the binary data and the hexadecimal data are difficult to modify, a tester can often modify wrong protocol parameters, and the modification errors can cause protocol transmission failure. And the integer, the floating point and the character string are display types which are easy to intuitively recognize and modify, so that the first copy protocol is displayed by the integer, the floating point or the character string, which is favorable for a tester to intuitively determine the first copy protocol and directly modify the first copy protocol.
For example, in the example described above where shoe items are purchased in 10-shoe-shaped boxes, the protocol parameter in the protocol for purchasing the shoe items is the ID of the shoe item, which is an integer and is shown as 1001. The tester may modify 1001 to 1002 and 1002 may represent a weapon prop.
S570, receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation.
Referring to the relevant description in step S560, the modification of the first copy protocol by the tester is a direct modification of the protocol parameters displayed in integer, floating point, or string. Specifically, when the first copy protocol is displayed in a corresponding display type, a modification parameter input by the modification operation is acquired, and a protocol parameter in the first copy protocol is modified according to the modification parameter, so that the modified first copy protocol is obtained. Wherein the display type of the modified parameter is the same as the display type of the first copy protocol.
After the protocol parameters in the first copy protocol are modified according to the modification parameters, performing type encapsulation on the modified protocol parameters to form a modified first copy protocol. Wherein type encapsulation may be understood as converting modified protocol parameters to a protocol form that is not used for display.
S580, sending the modified first copy protocol to the base class constructor, and executing the base class constructor to send the modified first copy protocol to the server.
For the related description of step S580, reference may be made to the related description of step S260, which is not described herein again.
In summary, the protocol testing method provided in this embodiment displays the first copy protocol in the form of integer, floating point, or character string, so that the tester can determine the first copy protocol more intuitively, and the tester can modify the first copy protocol based on the form of integer, floating point, or character string. Compared with the method in the prior art in which the WPE protocol tool can only display all protocols passing through the client gateway in a binary form or a hexadecimal form, the protocol testing method provided by the embodiment enables the protocol display to be more intuitive and is more convenient to modify, and can further avoid the problems that the protocol to be tested cannot be determined and the protocol is modified incorrectly due to insufficient capability of testers.
Referring to fig. 6, a third embodiment of the present application further provides a protocol testing apparatus 10, applied to a client, including:
the protocol generation module 11 is configured to generate a first protocol corresponding to a first game function in response to a trigger event of the first game function, and send the first protocol to a base class constructor;
a protocol copying module 12, configured to call a hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, where the execution of the base class constructor is intercepted when the hook function is executed;
a function execution module 13, configured to call a restore function to recover the execution of the base class constructor;
a protocol sending module 14, configured to execute the base class constructor to send the first protocol to a server;
a protocol modification module 15, configured to receive a modification operation for the first copy protocol, and modify the first copy protocol according to the modification operation.
The protocol sending module is further configured to send the modified first copy protocol to a base class constructor, and execute the base class constructor to send the modified first copy protocol to the server.
The protocol processing module 16 is configured to determine a display type of the first copy protocol according to a type of a protocol parameter in the first copy protocol, and display the first copy protocol based on the display type of the first copy protocol, where the display type includes an integer type, a floating point type, and a character string;
the protocol modification module 15 is further configured to display the first copy protocol in the display type of the first copy protocol; a modification operation for the first copy protocol is received, and the first copy protocol is modified according to the modification operation.
The protocol modification module 15 is further configured to, when the first copy protocol is displayed in a corresponding display type, obtain a modification parameter input by the modification operation, where the display type of the modification parameter is the same as the display type of the first copy protocol; and modifying the protocol parameters in the first copy protocol according to the modification parameters to obtain the modified first copy protocol.
The protocol copy module 12 may also receive a protocol grab instruction; and calling a hook function corresponding to the base class constructor according to the protocol grabbing instruction to copy the first protocol from the base class constructor to obtain the first copy protocol.
The protocol copy module 12 may also display a protocol grab button; the protocol grabbing instruction is generated in response to the selection operation of the protocol grabbing button.
The protocol processing module 16 is further configured to receive a fetch stop instruction; and according to the protocol grabbing stopping instruction, stopping calling the hook function corresponding to the base class constructor, copying the first protocol from the base class constructor to obtain a first copy protocol.
The protocol processing module 16 is further configured to display a protocol stop grabbing button; and generating the protocol grabbing stopping instruction in response to the selection operation of the protocol grabbing stopping button.
Referring to fig. 7, a computer device 20 is further provided in a fourth embodiment of the present application, including a memory 21, a processor 22 and a transceiver 23, where the memory 21 is used to store instructions, the transceiver 23 is used to communicate with other devices, and the processor 22 is used to execute the instructions stored in the memory 21, so that the terminal device 20 executes the protocol testing method provided in the first embodiment and the second embodiment, and specific implementation and technical effects are similar, and are not described again here.
The present application also provides a computer device readable storage medium, in which computer device execution instructions are stored, and when executed, the instructions cause the computer device to execute the instructions, when executed by the processor, for implementing the protocol testing method provided in the above embodiments one to two.
The present application further provides a computer device program product, which includes a computer device program, and when the computer device program is executed by a processor, the protocol testing method provided in the above first embodiment and the second embodiment is implemented, and the specific implementation manner and the technical effect are similar, and are not described herein again.
The computer-readable storage medium may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a magnetic Random Access Memory (FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical Disc, or a Compact Disc Read-Only Memory (CD-ROM), and the like. And may be various electronic devices such as mobile phones, computer devices, tablet devices, personal digital assistants, etc., including one or any combination of the above-described memories.
It should be noted that, in this document, 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 like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a server device (e.g., a mobile phone, a computer device, a server, an air conditioner, or a network device) to execute the method described in the embodiments of the present application.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer apparatus program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer device program instructions. These computer device program instructions may be provided to a processor of a general purpose computer device, special purpose computer device, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer device or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer device program instructions may also be stored in a computer device-readable memory that can direct a computer device or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer device-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer device program instructions may also be loaded onto a computer device or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer device or other programmable apparatus to produce a computer device implemented process such that the instructions which execute on the computer device or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. A protocol testing method, comprising:
responding to a trigger event of a first game function, generating a first protocol corresponding to the first game function, and sending the first protocol to a base class constructor;
calling a hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, wherein the execution of the base class constructor is intercepted when the hook function is executed;
calling a reduction function to recover the execution of the base class constructor;
executing the base class constructor to send the first protocol to a server;
receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation;
and sending the modified first copy protocol to a base class constructor, and executing the base class constructor to send the modified first copy protocol to the server.
2. The method of claim 1, further comprising:
determining a display type of the first copy protocol according to the type of a protocol parameter in the first copy protocol, and displaying the first copy protocol based on the display type of the first copy protocol, wherein the display type comprises an integer type, a floating point type and a character string;
the receiving a modification operation for the first copy protocol, modifying the first copy protocol in accordance with the modification operation comprising:
displaying the first copy protocol in a display type of the first copy protocol;
receiving a modification operation aiming at the first copy protocol, and modifying the first copy protocol according to the modification operation.
3. The method of claim 2, wherein the receiving a modification operation for the first replica protocol, wherein modifying the first replica protocol according to the modification operation comprises:
when the first copy protocol is displayed in a corresponding display type, acquiring a modification parameter input by the modification operation, wherein the display type of the modification parameter is the same as that of the first copy protocol;
and modifying the protocol parameters in the first copy protocol according to the modification parameters.
4. The method according to any one of claims 1 to 3, wherein the calling the hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol comprises:
receiving a protocol grabbing instruction;
and calling a hook function corresponding to the base class constructor according to the protocol grabbing instruction to copy the first protocol from the base class constructor to obtain the first copy protocol.
5. The method of claim 4, wherein receiving the protocol grab instruction comprises:
displaying a protocol capture button;
and responding to the selected operation of the protocol grabbing button to generate the protocol grabbing instruction.
6. The method of claim 4, further comprising:
receiving a protocol grabbing stopping instruction;
and according to the protocol grabbing stopping instruction, stopping calling the hook function corresponding to the base class constructor, copying the first protocol from the base class constructor to obtain a first copy protocol.
7. The method of claim 6, wherein receiving the protocol stop grab instruction comprises:
displaying a protocol capture stop button;
and responding to the selected operation of the protocol grabbing stopping button, and generating a protocol grabbing stopping instruction.
8. A protocol testing apparatus, comprising:
the system comprises a protocol generation module, a base class constructor and a game execution module, wherein the protocol generation module is used for responding to a trigger event of a first game function, generating a first protocol corresponding to the first game function and sending the first protocol to the base class constructor;
a protocol copying module, configured to call a hook function corresponding to the base class constructor to copy the first protocol from the base class constructor to obtain a first copy protocol, where the execution of the base class constructor is intercepted when the hook function is executed;
the function execution module is used for calling the reduction function to recover the execution of the base class constructor;
the protocol sending module is used for executing the base class constructor and sending the first protocol to a server;
a protocol modification module, configured to receive a modification operation for the first copy protocol, and modify the first copy protocol according to the modification operation;
the protocol sending module is further configured to send the modified first copy protocol to a base class constructor, and execute the base class constructor to send the modified first copy protocol to the server.
9. A computer device comprising a memory for storing instructions, a processor for communicating with other devices, and a transceiver for executing the instructions stored in the memory to cause the computer device to perform the protocol testing method of any of claims 1-7.
10. A computer device readable storage medium having computer device executable instructions stored therein that, when executed, cause a computer device to perform the protocol testing method of any of claims 1-7.
CN202110945459.9A 2021-08-17 2021-08-17 Protocol testing method and device Active CN113630295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110945459.9A CN113630295B (en) 2021-08-17 2021-08-17 Protocol testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110945459.9A CN113630295B (en) 2021-08-17 2021-08-17 Protocol testing method and device

Publications (2)

Publication Number Publication Date
CN113630295A true CN113630295A (en) 2021-11-09
CN113630295B CN113630295B (en) 2022-12-06

Family

ID=78386201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110945459.9A Active CN113630295B (en) 2021-08-17 2021-08-17 Protocol testing method and device

Country Status (1)

Country Link
CN (1) CN113630295B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050039190A1 (en) * 2003-08-12 2005-02-17 Jeffrey Rees Propagating web transaction context into common object model (COM) business logic components
US7702764B1 (en) * 2004-01-30 2010-04-20 Cisco Technology, Inc. System and method for testing network protocols
CN104052628A (en) * 2013-03-12 2014-09-17 腾讯科技(深圳)有限公司 Protocol packet detection method and protocol packet detection device
CN106294094A (en) * 2015-05-13 2017-01-04 腾讯科技(成都)有限公司 The method of testing of game server, client, server and system
CN108614776A (en) * 2018-05-04 2018-10-02 艺龙网信息技术(北京)有限公司 Across the dynamic fixing method and system of language protocol test request
CN109499071A (en) * 2018-12-06 2019-03-22 珠海西山居移动游戏科技有限公司 A kind of test method and device detecting game server protocol security
CN112241356A (en) * 2019-07-16 2021-01-19 腾讯科技(深圳)有限公司 Page testing method, device, equipment and storage medium
US10979539B1 (en) * 2017-07-21 2021-04-13 State Farm Mutual Automobile Insurance Company Method and system of generating generic protocol handlers

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050039190A1 (en) * 2003-08-12 2005-02-17 Jeffrey Rees Propagating web transaction context into common object model (COM) business logic components
US7702764B1 (en) * 2004-01-30 2010-04-20 Cisco Technology, Inc. System and method for testing network protocols
CN104052628A (en) * 2013-03-12 2014-09-17 腾讯科技(深圳)有限公司 Protocol packet detection method and protocol packet detection device
CN106294094A (en) * 2015-05-13 2017-01-04 腾讯科技(成都)有限公司 The method of testing of game server, client, server and system
US10979539B1 (en) * 2017-07-21 2021-04-13 State Farm Mutual Automobile Insurance Company Method and system of generating generic protocol handlers
CN108614776A (en) * 2018-05-04 2018-10-02 艺龙网信息技术(北京)有限公司 Across the dynamic fixing method and system of language protocol test request
CN109499071A (en) * 2018-12-06 2019-03-22 珠海西山居移动游戏科技有限公司 A kind of test method and device detecting game server protocol security
CN112241356A (en) * 2019-07-16 2021-01-19 腾讯科技(深圳)有限公司 Page testing method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
秦梦远等: "基于Chrome调试协议的Chromium浏览器V8引擎漏洞检测方法", 《智能计算机与应用》 *

Also Published As

Publication number Publication date
CN113630295B (en) 2022-12-06

Similar Documents

Publication Publication Date Title
Wei et al. Taming android fragmentation: Characterizing and detecting compatibility issues for android apps
WO2020019484A1 (en) Simulator recognition method, recognition device, and computer readable medium
CN109241709B (en) User behavior identification method and device based on slider verification code verification
CN109308263B (en) Applet testing method, device and equipment
WO2020019485A1 (en) Simulator identification method, identification device, and computer readable medium
CN110619210A (en) Simulator detection method and system
CN111078554B (en) Applet debugging method, device, equipment and storage medium
CN104123493A (en) Method and device for detecting safety performance of application program
JP2019500680A (en) Data processing method and apparatus
CN110928777B (en) Test case processing method, device, equipment and storage medium
CN112437294B (en) Method, device and equipment for testing identity hiding function and storage medium
CN107391362A (en) Application testing method, mobile terminal and storage medium
CN113986256A (en) Method and device for issuing application program, electronic equipment and storage medium
CN110210225A (en) A kind of intelligentized Docker container malicious file detection method and device
CN112882732A (en) Method and device for updating function codes in Software Development Kit (SDK)
CN113467784A (en) Application program processing method and device and computer readable storage medium
CN110737887B (en) Malicious code detection method and device, electronic equipment and storage medium
CN107357721B (en) Method and device for testing system
CN112529575A (en) Risk early warning method, equipment, storage medium and device
CN105100132A (en) Terminal device and terminal device identification method and system
CN108197914B (en) Information acquisition method and device and server
CN113630295B (en) Protocol testing method and device
CN110489347A (en) Method for edition management, device, equipment and readable storage medium storing program for executing based on GIT
CN110751486B (en) Intelligent contract replay proof method, system, electronic equipment and storage medium
CN112181521A (en) Parameter acquisition method, device, equipment and 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