CN115391770A - Program monitoring method, device, electronic equipment and computer readable storage medium - Google Patents

Program monitoring method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN115391770A
CN115391770A CN202110572251.7A CN202110572251A CN115391770A CN 115391770 A CN115391770 A CN 115391770A CN 202110572251 A CN202110572251 A CN 202110572251A CN 115391770 A CN115391770 A CN 115391770A
Authority
CN
China
Prior art keywords
program
monitored
monitoring
code
test
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.)
Pending
Application number
CN202110572251.7A
Other languages
Chinese (zh)
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.)
Beijing Zitiao Network Technology Co Ltd
Original Assignee
Beijing Zitiao Network Technology 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 Beijing Zitiao Network Technology Co Ltd filed Critical Beijing Zitiao Network Technology Co Ltd
Priority to CN202110572251.7A priority Critical patent/CN115391770A/en
Publication of CN115391770A publication Critical patent/CN115391770A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the disclosure discloses a program monitoring method, a program monitoring device, electronic equipment and a computer-readable storage medium. Wherein the program monitoring method comprises: receiving a monitoring code from a client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored; receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code. The method solves the technical problem that whether the application is in compliance cannot be monitored in any system by receiving the monitoring code from the client and injecting the monitoring code into the program to be monitored in real time.

Description

Program monitoring method, device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of program monitoring, and in particular, to a program monitoring method and apparatus, an electronic device, and a computer-readable storage medium.
Background
In recent years, as personal privacy information is more and more concerned by users, a series of policy and regulations are issued in the country to restrict the collection of the personal privacy information. Mobile phone manufacturers have increased means for privacy compliance monitoring.
At present, the Android privacy compliance monitoring at home and abroad is mainly realized by customizing an Android system ROM. For example, a millet mobile phone has privacy compliance monitoring only if the system is MIUI12, and does not have corresponding monitoring capability on a mobile phone below the MIUI12 system. Therefore, it is not possible to monitor whether an application is in compliance in any system.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In order to solve the above technical problem, the embodiments of the present disclosure propose the following technical solutions.
In a first aspect, an embodiment of the present disclosure provides a program monitoring method, including:
receiving a monitoring code from a client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored; receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code.
Further, the monitoring code includes: the monitoring code is used for monitoring the program to be monitored, the identifier of the program to be monitored and the identifier of the interface to be monitored.
Further, the injecting the monitoring code in the program to be monitored includes: searching a monitoring point in the program to be detected according to the identifier of the interface to be monitored; and injecting the monitoring codes at the monitoring points.
Further, the monitoring the interface called by the program to be monitored according to the monitoring code includes: when the program to be monitored calls the interface to be monitored, the monitoring code is used for replacing the program to be monitored to call the interface to be monitored; and the monitoring code acquires parameters when the to-be-monitored program calls the to-be-detected interface.
Further, the method further comprises: and obtaining a monitoring result of the monitoring code and sending the monitoring result to the client.
Further, the test instructions include: testing scenes and driving instructions of a program to be monitored; the test scene comprises one of test case execution, automatic traversal and manual test, and the program to be monitored driving instruction is used for driving the program to be monitored to run according to the test scene.
Further, the test instructions include: and the screen recording instruction is used for recording the state information of the program to be monitored during the running period.
In a second aspect, an embodiment of the present disclosure provides a program monitoring method, including:
receiving a selection instruction of an interface to be monitored to select the interface to be monitored; generating a monitoring code according to the selected interface to be monitored; and sending the monitoring code to a server.
Further, the method further comprises: and receiving and displaying the monitoring result from the server.
Further, the method further comprises: generating a test configuration instruction, wherein the test configuration instruction is used for configuring a test scene; the test scenario includes one of test case execution, automated traversal, and manual testing.
In a third aspect, an embodiment of the present disclosure provides a program monitoring apparatus, including:
the monitoring code injection module is used for receiving monitoring codes from the client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored;
the monitoring module is used for receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code.
Further, the monitoring code includes: the monitoring code is used for monitoring the program to be monitored, the identifier of the program to be monitored and the identifier of the interface to be monitored.
Further, the monitoring code injection module is further configured to:
searching a monitoring point in the program to be detected according to the identifier of the interface to be monitored;
and injecting the monitoring code at the monitoring point.
Further, the monitoring module is further configured to:
when the program to be monitored calls the interface to be monitored, the monitoring code is used for replacing the program to be monitored to call the interface to be monitored;
and the monitoring code acquires parameters when the to-be-monitored program calls the to-be-detected interface.
Further, the program monitoring device further includes: and the monitoring result sending module is used for obtaining the monitoring result of the monitoring code and sending the monitoring result to the client.
Further, the test instructions include: testing a scene and driving instructions of a program to be monitored; the test scene comprises one of test case execution, automatic traversal and manual test, and the program to be monitored driving instruction is used for driving the program to be monitored to run according to the test scene.
Further, the test instructions include: and the screen recording instruction is used for recording the state information of the program to be monitored during the running period.
In a fourth aspect, an embodiment of the present disclosure provides a program monitoring apparatus, including:
the monitoring code generation module is used for receiving selection instructions of the program to be monitored and the interface to be monitored so as to select the program to be monitored and the interface to be monitored; generating a monitoring code according to the selected interface to be monitored;
and the monitoring code sending module is used for sending the monitoring code to the server.
Further, the program monitoring device further includes: and the monitoring result receiving module is used for receiving and displaying the monitoring result from the server.
Further, the program monitoring device further includes: the test configuration instruction generating module is used for generating a test configuration instruction, wherein the test configuration instruction is used for configuring a test scene; the test scenario includes one of test case execution, automated traversal, and manual testing.
In a fifth aspect, an embodiment of the present disclosure provides an electronic device, including:
a memory for storing computer readable instructions; and
a processor configured to execute the computer readable instructions to cause the electronic device to implement the method according to any one of the first or second aspects.
In a sixth aspect, embodiments of the present disclosure provide a non-transitory computer-readable storage medium storing computer-readable instructions that, when executed by a computer, cause the computer to implement the method of any one of the first or second aspects.
The embodiment of the disclosure discloses a program monitoring method, a program monitoring device, electronic equipment and a computer-readable storage medium. Wherein the program monitoring method comprises: receiving a monitoring code from a client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored; receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code. The method solves the technical problem that whether the application is in compliance cannot be monitored in any system by receiving the monitoring code from the client and injecting the monitoring code into the program to be monitored in real time.
The foregoing is a summary of the present disclosure, and for the purposes of promoting a clear understanding of the technical means of the present disclosure, the present disclosure may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flow chart diagram of a program monitoring method provided in an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart diagram illustrating a further method for monitoring a program according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart diagram illustrating a further exemplary method for monitoring a program according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart diagram illustrating another method for monitoring a program according to an embodiment of the present disclosure;
fig. 5 is a schematic view of an application scenario of the program monitoring method according to the embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of an embodiment of a program monitoring device provided in an embodiment of the present disclosure
FIG. 7 is a schematic structural diagram of another embodiment of a process monitoring device according to the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device provided according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and the embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a" or "an" in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will appreciate that references to "one or more" are intended to be exemplary and not limiting unless the context clearly indicates otherwise.
Fig. 1 is a flowchart of an embodiment of a program monitoring method provided in this disclosure, where the program monitoring method provided in this embodiment may be executed by a program monitoring device, the program monitoring device may be implemented as software, or implemented as a combination of software and hardware, and the program monitoring device may be integrated in a certain device in a program monitoring system, such as a program monitoring service terminal or a server. As shown in fig. 1, the method comprises the steps of:
step S101: a monitoring code is received from a client.
In order to solve the problem that privacy compliance of monitoring applications cannot be flexibly monitored in all systems in the prior art, the architecture of the client and the server is used in the disclosure, so that a monitoring program can be configured and generated at the client and run at the server.
In this step, a monitoring code is received from a client, where the monitoring code includes a monitoring code for monitoring a program to be monitored, an identifier of the program to be monitored, and an identifier of an interface to be monitored. The Interface to be monitored comprises a privacy sensitive Interface, such as a clipboard related API (Application Programming Interface), a geographic position related API, a Wifi information related API, an Android unique identifier and equipment serial number related API, an authority request related API, an address book reading related API, a reading equipment account related API, a short message sending related API, a Bluetooth address related API, a mobile phone App list related API and a Bluetooth information related API. It should be understood that the above-mentioned interface to be monitored is only an example, and does not constitute a limitation to the present disclosure, and other interfaces may also be used as the interface to be monitored in the present disclosure, and are not described herein again.
Illustratively, the monitoring code is a code of a hook program, and the hook program is used for monitoring a call action of the to-be-monitored program to the to-be-monitored interface.
Returning to fig. 1, the program monitoring method further includes step S102: and determining a program to be monitored according to the monitoring code.
The program to be monitored is determined, wherein the determining of the program to be monitored comprises installing the program to be monitored in a server or receiving an installation program of the program to be monitored. In this embodiment, the program to be monitored is installed or uploaded to the server in real time.
Alternatively, the program to be monitored may be pre-installed in the server. As stated in step S101, the monitoring code includes information of the program to be monitored, such as an identifier of the program to be monitored, and the program to be monitored is determined by the identifier. By this step, the program to be monitored can be flexibly determined by the monitoring code. The identifier of the program to be monitored may be a name of the program to be monitored or an ID of a process generated when the program to be monitored runs, and is not described herein again.
Returning to fig. 1, the program monitoring method further includes step S103: and injecting the monitoring code in the program to be monitored.
In step S103, the server injects a monitoring code into the program to be monitored, so that the program to be monitored can be monitored when the program to be monitored runs.
Optionally, as shown in fig. 2, the step S103 includes:
step S201, searching monitoring points in the program to be detected according to the identifier of the interface to be monitored;
and step S202, injecting the monitoring code into the monitoring point.
The program to be monitored may call the interface to be monitored during running, and the call of the interface to be monitored is represented by using the identifier of the interface to be monitored in the code of the program to be monitored. Therefore, in step S201, a monitoring point is searched in the program to be monitored according to the identifier of the interface to be monitored, that is, the position of the code of the program to be monitored, which corresponds to the calling of the interface to be monitored, where the identifier of the interface to be monitored may be the name, ID, or name of the calling function of the interface to be monitored, and is not described herein again.
In step S202, after the monitoring point is found, the monitoring code is injected into the monitoring point. Illustratively, the injecting means replacing code of the program to be monitored with monitoring code to call the interface to be monitored. Or, the injecting means that the monitoring code is inserted after the code for calling the detection interface to monitor a return value after the interface to be monitored is called, and the like. It is understood that the manner of injection in the present disclosure may be any manner, and the present disclosure is not limited thereto, and will not be described herein again.
Returning to fig. 1, the program monitoring method further includes step S104 of receiving a test instruction.
And enabling the program to be monitored to run through the test instruction so that the monitoring program can monitor the condition of calling an interface when the program to be monitored runs.
Illustratively, the test instructions include: testing scenes and driving instructions of a program to be monitored; the test scene comprises one of test case execution, automatic traversal and manual test, and the program to be monitored driving instruction is used for driving the program to be monitored to run according to the test scene.
The test cases are tests aiming at specific functions, such as App privacy popup front cases, app login and registration function cases, front/background long-time stay cases, front and background frequent switching cases, video shooting cases, front page up-down sliding cases and permission consent front/back cases.
The automatic traversal comprises the step of using an automatic testing tool to realize the random traversal test of the program to be monitored, so that the coverage of more pages and the touch of more user scenes are realized.
The manual test is that a user manually operates the App, the execution condition of the App running sensitive API is monitored in real time, and debugging and troubleshooting are facilitated.
The program to be monitored driving instruction is used for driving the program to be tested to run according to the test scene so as to realize the test process defined by the test scene.
Illustratively, the test instructions may further include: and the screen recording instruction is used for recording the state information of the program to be monitored during the running period. The states of the program to be monitored during operation include, but are not limited to: and page information, operation events and input and output data of the program to be monitored during the running period. The state information acquired by the screen recording instruction can be used for positioning the state of a program to be monitored when a problem occurs, and the problem can be rapidly and efficiently checked.
Optionally, the step S104 includes: and receiving a test configuration instruction and generating a test instruction. In this embodiment, the test instruction is generated at the server, that is, a module for generating the test instruction is preset at the server, and the server configures the module for generating the test instruction by receiving the test configuration instruction to generate an available test instruction. For example, the test may be configured by the test configuration instructions: test case execution, automated traversal, and manual testing. And then, generating a test instruction through configuration instruction configuration to call a to-be-monitored program driving instruction to drive the to-be-monitored program to run according to the configuration of the test configuration instruction.
Returning to fig. 1, the program monitoring method further includes step S105 of operating the program to be monitored according to the test instruction.
In this step, the program to be monitored is run through the test instruction received in step S104, the program to be monitored is run according to the mode defined by the test scenario, and the interface is called to obtain a returned value and the like through the called interface.
Returning to fig. 1, the program monitoring method further includes step S106 of monitoring an interface called by the program to be monitored according to the monitoring code.
In this step, the interface called by the detection program is monitored in different modes according to different injection modes of the monitoring code.
Optionally, as shown in fig. 3, the step S106 includes:
step S301, when the program to be monitored calls an interface to be monitored, the monitoring code is used for replacing the program to be monitored to call the interface to be monitored;
step S302, the monitoring code collects parameters when the program to be monitored calls the interface to be monitored.
When a monitoring code is used for replacing a corresponding code in a program to be monitored, when the program to be monitored operates according to the test instruction and a port to be monitored is called, the monitoring code is used for replacing the program to be monitored to call the port to be monitored, and when a detection code is operated, the port to be monitored is called; and then, the monitoring code calls the interface to be monitored, acquires data returned by the interface to be monitored, and returns the data to the program to be monitored, wherein the monitoring code is transparent to the program to be monitored.
The detection code collects parameters of the to-be-monitored program when the to-be-monitored program calls the to-be-monitored interface, such as a return value of the to-be-monitored interface, call time, page information of the to-be-monitored program, a current thread number of the to-be-monitored program, a current execution method of the to-be-monitored program, stack information called by the execution method, and the like.
Further, the method further comprises: and obtaining a monitoring result of the monitoring code and sending the monitoring result to the client.
In the optional step, when the server side obtains the monitoring result, the monitoring result is sent to the client side, so that a user of the client side can browse the monitoring result. The monitoring result includes the parameters obtained in step S106, such as the return value of the interface to be monitored, the call time, the page information of the program to be monitored, the current thread number of the program to be monitored, the current execution method of the program to be monitored, the stack information called by the execution method, and the like. Illustratively, the parameters are sent to the client in the form of structured data, such as JSON.
Through the steps S101 to S106, the monitoring step of the program to be monitored is executed on the server, and the specific content of monitoring is flexibly determined through the received monitoring configuration information and the test instruction, so that the problem that the monitoring mode is fixed and inflexible is solved.
Fig. 4 is a flowchart of another embodiment of a program monitoring method provided in this disclosure, where the program monitoring method provided in this embodiment may be executed by a program monitoring device, the program monitoring device may be implemented as software, or implemented as a combination of software and hardware, the program monitoring device may be integrated in a certain device in a program monitoring system, for example, a program monitoring terminal, and a program monitoring client is installed in the program monitoring terminal to operate the program monitoring method. As shown in fig. 4, the method includes the steps of:
step S401: receiving a selection instruction of an interface to be monitored to select the interface to be monitored;
in the step, the client comprises a set of all the monitorable interfaces, and the client receives a selection instruction of an interface in the set of monitorable interfaces through the man-machine interaction interface to obtain a set of the interfaces to be monitored.
If the program to be monitored is specified by the client side, before step S401, the method further includes:
and receiving a program to be monitored selection instruction to select the program to be monitored.
In this optional embodiment, the program to be monitored is pre-installed in the server, and the user selects the program to be monitored currently according to the program to be monitored selection instruction.
Optionally, the set of monitorable interfaces includes privacy-sensitive APIs, such as clipboard-related API, geographic location-related API, wifi information-related API, android unique identifier and device serial number-related API, permission request-related API, contact list-reading related API, read-write device account-related API, short message-sending related API, bluetooth address-related API, mobile phone App list-related API, bluetooth information-related API, and the like, as described in the above embodiments.
Returning to fig. 4, the program monitoring method further includes step S402 of generating a monitoring code according to the selected interface to be monitored.
Wherein, the interface to be monitored is represented by a character string, such as the name or ID of the interface to be monitored. In this step, the interface to be monitored is converted into a corresponding monitoring code. Optionally, the monitoring code is a JS (JavaScript) code.
Optionally, a corresponding monitoring code is written in advance for each interface in the set of monitorable interfaces. And after the interface to be monitored is selected, searching a monitoring code corresponding to the interface to be monitored according to the identifier, such as the name or the ID, of the interface to be monitored. Or, according to a preset conversion rule, generating a corresponding monitoring code according to the identifier of the interface to be monitored. Illustratively, the detection code is code executed in a hook program.
The monitoring code also comprises an identifier of the program to be monitored and the interface to be monitored. Illustratively, the monitoring code includes a header and a data portion, where the header includes an identifier of the interface to be monitored or an identifier of the interface to be monitored and an identifier of the program to be monitored, and the data portion includes the monitoring code corresponding to the interface to be monitored.
Returning to fig. 4, the program monitoring method further includes step S403 of sending the monitoring code to the server.
In this step, the client sends the monitoring code to the server, so that the server can configure the monitoring process.
Further, the method further comprises:
and receiving and displaying the monitoring result from the server.
In this step, a monitoring result fed back by the server is received, and the monitoring result is displayed in a display page of the client. Optionally, the detection result is fed back to the server in a JSON data format, and after the server parses the JSON data, the JSON data is displayed in a display page according to a preset format. The monitoring result comprises context information, page information, thread numbers, executed methods, stack information of executed method calls and the like when the program to be monitored returned by the server calls the interface to be monitored.
Optionally, the method further includes:
generating a test configuration instruction, wherein the test configuration instruction is used for configuring a test scene; the test scenario includes one of test case execution, automated traversal, and manual testing.
In this alternative embodiment, the test instructions are generated at the server, and then the test configuration instructions are generated at the client. The test configuration instruction is used for configuring a test scene, when the test scene is a test case for execution, the test configuration instruction further comprises the test case, and the test case is used for testing the preset function of the program to be monitored; when the test scenario is an automatic traversal, the test configuration instruction may further include an algorithm for an automatic traversal test; and when the test scene is a manual test, the client is further used for receiving a test instruction sent by a user, and the test instruction is generated by the operation of the program to be monitored.
It will be appreciated that the step of generating test configuration instructions may also be performed by a separate test client. That is, steps related to the test instruction may all be executed by an independent test client, and at this time, the test client is specifically configured to generate a test configuration instruction, a test instruction, or a screen recording instruction, and so on, which are not described herein again.
The embodiment of the disclosure discloses a program monitoring method, which comprises the following steps: receiving a monitoring code from a client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored; receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code. The method solves the technical problem that whether the application is in compliance cannot be monitored in any system by receiving the monitoring code from the client and injecting the monitoring code into the program to be monitored in real time.
Fig. 5 is a schematic view of an application scenario of the program monitoring method according to the embodiment of the present disclosure. As shown in fig. 5, a compliance monitoring scenario for the privacy API. As shown in fig. 5, the program monitoring method is executed in a program monitoring system, where the program monitoring system includes a client and a server, and the client and the server may be executed in two terminal devices respectively, or executed in the same terminal. The client comprises a monitoring injection module, and the monitoring injection module comprises a privacy API set module and is used for determining a privacy API set; the JS code module is used for converting the API in the privacy API set into a corresponding JS code; and the injection frame module is used for injecting the JS codes into an APK (Android application package) in the server. Sending the JS code to a server through the monitoring injection module; the server side comprises an injection module, the injection module comprises a hook module and an interaction module, wherein the hook module is used for injecting the JS codes sent by the client side into the monitoring points corresponding to the APK. The server also comprises a test module, wherein the test module comprises a test scene module, a test driving module and a screen recording module, the test scene module is used for determining a test mode, the test driving module drives the APK to execute corresponding actions according to the test mode, and the screen recording module simultaneously starts to record state information when the APK executes a test process. And the interaction module of the server receives state information when the APK acquired by the detection code calls the privacy API, and encapsulates the state information into JSON data. The server side sends the JSON data to the client side, and the client side further comprises a data processing module, wherein the data processing module comprises: the data acquisition module is used for receiving JSON data sent by the server; the processing module is used for analyzing and processing the JSON data into a preset format; and the chart display module is used for displaying the monitoring result contained in the JSON data according to a preset format.
In the above, although the steps in the above method embodiments are described in the above sequence, it should be clear to those skilled in the art that the steps in the embodiments of the present disclosure are not necessarily performed in the above sequence, and they may also be performed in other sequences such as reverse, parallel, and cross, and other sequences may also be added on the basis of the above steps, and these obvious modifications or equivalents should also be included in the protection scope of the present disclosure, and are not described herein again.
Fig. 6 is a schematic structural diagram of an embodiment of a program monitoring apparatus provided in the embodiment of the present disclosure. As shown in fig. 6, the apparatus 600 includes a monitoring code injection module 601 and a monitoring module 602. Wherein,
a monitoring code injection module 601, configured to receive a monitoring code from a client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored;
a monitoring module 602, configured to receive a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code.
Further, the monitoring code includes: the monitoring code is used for monitoring the program to be monitored, the identifier of the program to be monitored and the identifier of the interface to be monitored.
Further, the monitoring code injection module 601 is further configured to:
searching a monitoring point in the program to be detected according to the identifier of the interface to be monitored;
and injecting the monitoring code at the monitoring point.
Further, the monitoring module 602 is further configured to:
when the program to be monitored calls an interface to be monitored, the monitoring code is used for replacing the program to be monitored to call the interface to be monitored;
and the monitoring code acquires parameters when the to-be-monitored program calls the to-be-detected interface.
Further, the program monitoring apparatus 600 further includes: and the monitoring result sending module is used for obtaining the monitoring result of the monitoring code and sending the monitoring result to the client.
Further, the test instructions include: testing scenes and driving instructions of a program to be monitored; the test scene comprises one of test case execution, automatic traversal and manual test, and the program to be monitored driving instruction is used for driving the program to be monitored to run according to the test scene.
Further, the test instruction includes: and the screen recording instruction is used for recording the state information of the program to be monitored during the running period.
The apparatus shown in fig. 6 can perform the method of the embodiment shown in fig. 1-3, and the detailed description of the embodiment not described in detail can refer to the related description of the embodiment shown in fig. 1-3. The implementation process and technical effect of the technical solution are described in the embodiments shown in fig. 1 to 3, and are not described herein again.
Fig. 7 is a schematic structural diagram of an embodiment of a program monitoring apparatus provided in the embodiment of the present disclosure. As shown in fig. 7, the apparatus 700 includes a monitoring code generating module 701 and a monitoring code transmitting module 702. Wherein,
a monitoring code generating module 701, configured to receive a selection instruction of a program to be monitored and an interface to be monitored so as to select the program to be monitored and the interface to be monitored; generating a monitoring code according to the selected interface to be monitored;
a monitoring code sending module 702, configured to send the monitoring code to a server.
Further, the program monitoring apparatus 700 further includes: and the monitoring result receiving module is used for receiving and displaying the monitoring result from the server.
Further, the program monitoring apparatus 700 further includes: the test configuration instruction generating module is used for generating a test configuration instruction, wherein the test configuration instruction is used for configuring a test scene; the test scenario includes one of test case execution, automated traversal, and manual testing.
The apparatus shown in fig. 7 can perform the method of the embodiment shown in fig. 4, and reference may be made to the related description of the embodiment shown in fig. 4 for a part of this embodiment that is not described in detail. The implementation process and technical effect of the technical solution refer to the description in the embodiment shown in fig. 4, and are not described herein again.
Referring now to FIG. 8, shown is a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 may include a processing means (e.g., central processing unit, graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
Generally, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; and a communication device 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 illustrates an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 809, or installed from the storage means 808, or installed from the ROM 802. The computer program, when executed by the processing apparatus 801, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may be separate and not incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: the program monitoring method in the above embodiment is performed.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, including conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the program monitoring methods of the above embodiments.
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium characterized by storing computer instructions for causing a computer to execute the program monitoring method of any one of the above-described embodiments.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (14)

1. A program monitoring method, comprising:
receiving a monitoring code from a client;
determining a program to be monitored according to the monitoring code;
injecting the monitoring code in the program to be monitored;
receiving a test instruction;
running the program to be monitored according to the test instruction;
and monitoring the interface called by the program to be monitored according to the monitoring code.
2. The program monitoring method of claim 1, wherein the monitoring code comprises:
the monitoring code is used for monitoring the program to be monitored, the identifier of the program to be monitored and the identifier of the interface to be monitored.
3. The program monitoring method of claim 2, wherein the injecting the monitoring code in the program to be monitored comprises:
searching a monitoring point in the program to be detected according to the identifier of the interface to be monitored;
and injecting the monitoring codes at the monitoring points.
4. The program monitoring method according to claim 1, wherein the monitoring the interface called by the program to be monitored according to the monitoring code comprises:
when the program to be monitored calls an interface to be monitored, the monitoring code is used for replacing the program to be monitored to call the interface to be monitored;
and the monitoring code acquires parameters when the to-be-monitored program calls the to-be-detected interface.
5. The process monitoring method of claim 1, further comprising:
and obtaining a monitoring result of the monitoring code and sending the monitoring result to the client.
6. The program monitoring method of claim 1, wherein the test instructions comprise:
testing scenes and driving instructions of a program to be monitored; the test scene comprises one of test case execution, automatic traversal and manual test, and the program to be monitored driving instruction is used for driving the program to be monitored to run according to the test scene.
7. The program monitoring method of claim 1 or 6, wherein the test instruction comprises:
and the screen recording instruction is used for recording the state information of the program to be monitored during the running period.
8. A program monitoring method, comprising:
receiving a selection instruction of an interface to be monitored to select the interface to be monitored;
generating a monitoring code according to the selected interface to be monitored;
and sending the monitoring code to a server.
9. The program monitoring method of claim 1, further comprising:
and receiving and displaying the monitoring result from the server.
10. The process monitoring method of claim 1, further comprising:
generating a test configuration instruction, wherein the test configuration instruction is used for configuring a test scene; the test scenario includes one of test case execution, automated traversal, and manual testing.
11. A program monitoring device, comprising:
the monitoring code injection module is used for receiving monitoring codes from the client; determining a program to be monitored according to the monitoring code; injecting the monitoring code in the program to be monitored;
the monitoring module is used for receiving a test instruction; running the program to be monitored according to the test instruction; and monitoring the interface called by the program to be monitored according to the monitoring code.
12. A program monitoring device, comprising:
the monitoring code generation module is used for receiving a selection instruction of the program to be monitored and the interface to be monitored so as to select the program to be monitored and the interface to be monitored; generating a monitoring code according to the selected interface to be monitored;
and the monitoring code sending module is used for sending the monitoring code to the server.
13. An electronic device, comprising:
a memory for storing computer readable instructions; and
a processor for executing the computer readable instructions such that the processor when executed implements the method of any of claims 1-10.
14. A non-transitory computer readable storage medium storing computer readable instructions which, when executed by a computer, cause the computer to perform the method of any one of claims 1-10.
CN202110572251.7A 2021-05-25 2021-05-25 Program monitoring method, device, electronic equipment and computer readable storage medium Pending CN115391770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110572251.7A CN115391770A (en) 2021-05-25 2021-05-25 Program monitoring method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110572251.7A CN115391770A (en) 2021-05-25 2021-05-25 Program monitoring method, device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115391770A true CN115391770A (en) 2022-11-25

Family

ID=84114123

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110572251.7A Pending CN115391770A (en) 2021-05-25 2021-05-25 Program monitoring method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115391770A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116860358A (en) * 2023-08-30 2023-10-10 北京趋动智能科技有限公司 Method, system, device and medium for executing injection code

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116860358A (en) * 2023-08-30 2023-10-10 北京趋动智能科技有限公司 Method, system, device and medium for executing injection code
CN116860358B (en) * 2023-08-30 2024-01-02 北京趋动智能科技有限公司 Method, system, device and medium for executing injection code

Similar Documents

Publication Publication Date Title
CN111694757B (en) Application program testing method and device, electronic equipment and computer readable storage medium
CN109510754B (en) Online document generation method, device and system and electronic equipment
CN111432001B (en) Method, apparatus, electronic device and computer readable medium for jumping scenes
CN112953791B (en) Network detection method and device, electronic equipment and computer readable storage medium
CN113806212A (en) Application program exception positioning method and device and electronic equipment
CN111930709B (en) Data storage method, apparatus, electronic device, and computer readable medium
CN112905281A (en) View display method and device, electronic equipment and storage medium
CN115622963A (en) Message detection method, device, equipment and medium based on industrial switch
CN115391770A (en) Program monitoring method, device, electronic equipment and computer readable storage medium
CN112162682A (en) Content display method and device, electronic equipment and computer readable storage medium
CN112306858A (en) Test method and device and electronic equipment
CN111382038A (en) Method, device, electronic equipment and storage medium for reporting service data
CN112311749B (en) Method and device for adding participating members and electronic equipment
US20240089560A1 (en) Video generation method, apparatus, electronic device and storage medium
CN115412389B (en) Message recommendation method and device, electronic equipment and readable storage medium
CN115481376A (en) Setting management method and device of test terminal equipment and electronic equipment
CN118131953A (en) Data configuration method, device, medium, electronic equipment and program product
CN112182347A (en) Method and device for detecting punishment state, electronic equipment and storage medium
CN118695046A (en) Wheat connecting method, device, equipment and storage medium
CN117290038A (en) Application distribution method, device, equipment and storage medium
CN118779551A (en) Page management method, device, medium, electronic equipment and program product
CN117093284A (en) Plug-in calling method, device, medium and electronic equipment
CN116401173A (en) Test case generation method and device, medium and electronic equipment
CN117492615A (en) Information display method, device, electronic equipment and storage medium
CN116419371A (en) Method, apparatus, device, storage medium and program product for establishing communication connection

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