[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN109960656B - Program detection method and device and electronic equipment - Google Patents

Program detection method and device and electronic equipment Download PDF

Info

Publication number
CN109960656B
CN109960656B CN201910223263.1A CN201910223263A CN109960656B CN 109960656 B CN109960656 B CN 109960656B CN 201910223263 A CN201910223263 A CN 201910223263A CN 109960656 B CN109960656 B CN 109960656B
Authority
CN
China
Prior art keywords
file
tested
detection
program
preset
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.)
Active
Application number
CN201910223263.1A
Other languages
Chinese (zh)
Other versions
CN109960656A (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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online 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 Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201910223263.1A priority Critical patent/CN109960656B/en
Publication of CN109960656A publication Critical patent/CN109960656A/en
Application granted granted Critical
Publication of CN109960656B publication Critical patent/CN109960656B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a program detection method, a program detection device and electronic equipment, wherein the method is applied to the compiling period of the program, and one specific implementation mode of the method comprises the following steps: acquiring a plurality of byte code files obtained after compiling a target program; determining preset configuration information, wherein the configuration information comprises file information to be tested and detection rules; determining a file to be tested in the plurality of byte code files based on the file to be tested information; and detecting each file to be detected based on the detection rule, and outputting a detection result, wherein the detection result is used for indicating an error file in the file to be detected. The implementation method avoids the problem that the application program of the background service end has errors after installation and deployment, improves the performance of the background service and improves the usability of the whole service system.

Description

Program detection method and device and electronic equipment
Technical Field
The present invention relates to the field of computer software technologies, and in particular, to a method and an apparatus for detecting a program, and an electronic device.
Background
With the continuous development of internet technology, a micro-service architecture is increasingly applied to internet services. In the application process of the micro-service framework, a remote call situation may exist, and the problem that the downstream call occupies upstream resources may occur. In general, fusing, current limiting, degradation, etc. mechanisms are often employed to avoid exacerbations of the problem. However, in the prior art, the application program of the background service end is easy to be misused and missed in the aspect of the code of the mechanism, and once the error exists, the performance of the background service is greatly affected, so that the usability of the whole service system is reduced.
Disclosure of Invention
In order to solve one of the above technical problems, the present application provides a method and apparatus for detecting a program, and an electronic device.
According to a first aspect of embodiments of the present application, there is provided a method for detecting a program, applied to a compile time of the program, including:
acquiring a plurality of byte code files obtained after compiling a target program;
determining preset configuration information, wherein the configuration information comprises file information to be tested and detection rules;
determining a file to be tested in the plurality of byte code files based on the file to be tested information;
and detecting each file to be detected based on the detection rule, and outputting a detection result, wherein the detection result is used for indicating an error file in the file to be detected.
Optionally, the determining the file to be tested in the plurality of byte code files based on the file to be tested information includes:
acquiring an identifier corresponding to each byte code file;
traversing the byte code files, and determining the byte code file as a file to be tested if the identification corresponding to the byte code file is recorded in the file information to be tested for any byte code file.
Optionally, the detecting each file to be detected based on the detection rule includes:
analyzing each file to be tested to obtain metadata information corresponding to each file to be tested;
and detecting metadata information corresponding to each file to be detected based on the detection rule by adopting a preset plug-in, wherein the preset plug-in is inserted into a compiling stage of the compiling period of the target program in advance.
Optionally, the detection rule includes a preset variable feature and a preset specification feature;
for any file to be tested, a preset plug-in is adopted, and metadata information corresponding to the file to be tested is detected in the following mode:
performing first detection on metadata information corresponding to the file to be detected based on the preset variable characteristics;
and if the result of the first detection indicates that the file to be detected contains a code program for remote calling, performing second detection on metadata information corresponding to the file to be detected based on the preset standard characteristic so as to determine whether the file to be detected is an error file.
Optionally, the first detecting, based on the preset variable feature, metadata information corresponding to the file to be detected includes:
determining a plurality of member variables of the file to be tested based on metadata information corresponding to the file to be tested;
and if at least one member variable with the preset variable characteristics exists in the member variables, determining that the file to be tested contains a code program for remote calling.
Optionally, the second detecting, based on the preset specification feature, metadata information corresponding to the file to be detected includes:
determining a plurality of target member methods in the file to be tested based on metadata information corresponding to the file to be tested, wherein the target member methods comprise member variables with preset variable characteristics;
and if at least one member method which does not have the preset standard characteristics exists in the target member methods, determining that the file to be detected is an error file.
According to a second aspect of embodiments of the present application, there is provided a detection apparatus for a program, applied to a compile time of the program, including:
the acquisition module is used for acquiring a plurality of byte code files obtained after compiling the target program;
the determining module is used for determining preset configuration information, wherein the configuration information comprises file information to be detected and detection rules;
the screening module is used for determining a file to be tested in the plurality of byte code files based on the file information to be tested;
the detection module is used for detecting each file to be detected based on the detection rule and outputting a detection result, wherein the detection result is used for indicating an error file in the file to be detected.
Optionally, the detection module includes:
the analysis submodule is used for analyzing each file to be tested to obtain metadata information corresponding to each file to be tested;
and the verification sub-module is used for detecting the metadata information corresponding to each file to be detected based on the detection rule by adopting a preset plug-in, and the preset plug-in is inserted into the compiling stage of the compiling period of the target program in advance.
According to a third aspect of embodiments of the present application, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements the method of any one of the first aspects described above.
According to a fourth aspect of embodiments of the present application, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of the above first aspects when executing the program.
The technical scheme provided by the embodiment of the application can comprise the following beneficial effects:
according to the program detection method and device, the plurality of byte code files obtained after compiling the target program are obtained in the compiling period of the target program, and preset configuration information is determined, wherein the configuration information comprises file information to be detected and detection rules. And determining the files to be detected in the plurality of byte code files based on the file information to be detected, detecting each file to be detected based on a detection rule, and outputting a detection result, wherein the detection result is used for indicating the error files in the files to be detected. Because the embodiment detects the byte code file corresponding to the target program based on the preset configuration information at the compiling period of the target program, the error file is found, and thus the error file can be modified in time. The problem that the application program of the background service end has errors after installation and deployment is avoided, the performance of the background service is improved, and the usability of the whole service system is also improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow chart of a method of detecting a program according to an exemplary embodiment;
FIG. 2 is a flow chart of a method of detecting another program according to an exemplary embodiment;
FIG. 3 is a flow chart of a method of detecting another program according to an exemplary embodiment of the present application;
FIG. 4 is a block diagram of a detection device of a program according to an exemplary embodiment of the present application;
FIG. 5 is a block diagram of a detection device of a program according to an exemplary embodiment of the present application;
FIG. 6 is a block diagram of a detection device of a program according to an exemplary embodiment of the present application;
FIG. 7 is a block diagram of a detection device of a program according to an exemplary embodiment of the present application;
fig. 8 is a schematic structural view of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
As shown in fig. 1, fig. 1 is a flowchart illustrating a detection method of a program according to an exemplary embodiment, which can be applied to a server. The method comprises the following steps:
in step 101, a plurality of bytecode files obtained by compiling a target program are acquired.
In this embodiment, the target program is a program installed on a background server, and the target program may be a program written in JAVA. Specifically, in the process of installing the target program, the target program needs to be compiled first to obtain a plurality of byte code files corresponding to the target program.
In step 102, predetermined configuration information is determined, where the configuration information includes file information to be tested and detection rules.
In this embodiment, configuration information may be preset, and the configuration information may include file information to be tested and detection rules. The information of the to-be-detected file may include identification information of all to-be-detected files, where the to-be-detected file is a file to be detected. For example, the information of the file to be tested may include, but is not limited to, a path of the file to be tested, a name of the file to be tested, a code of the file to be tested, and the like. It is understood that the specific content included in the file information to be tested is not limited in this application. The detection rule may be rule information for detecting whether the file to be detected is an error file.
In step 103, a file under test in the plurality of bytecode files is determined based on the file under test information.
In this embodiment, the file to be tested in the plurality of byte code files may be determined based on the file to be tested information. Specifically, an identifier corresponding to each byte code file may be obtained, and the identifier corresponding to the byte code file may be a path, a name, a code, or the like. Then, each byte code file is traversed, and if the identification corresponding to the byte code file is recorded in the file information to be detected, the byte code file can be determined to be the file to be detected.
In step 104, each file to be tested is tested based on the testing rule, and a testing result is output, where the testing result is used to indicate an error file in the files to be tested.
In this embodiment, each file to be tested may be detected based on a detection rule in the configuration information, a file to be tested having an error is detected as an error file, and a detection result is output, so as to modify the error file in time.
The processes from step 101 to step 104 are all performed at the compile time of the target program.
It should be noted that while in the embodiment of fig. 1 described above, the operations of the methods of the present application are described in a particular order, this does not require or imply that the operations must be performed in that particular order or that all of the illustrated operations be performed in order to achieve desirable results. Rather, the steps depicted in the flowcharts may change the order of execution. For example, step 101 may be performed first, and then step 102 may be performed. Step 102 may be performed first, and then step 102 may be performed. Steps 101 and 102 may also be performed simultaneously. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
According to the program detection method provided by the embodiment of the application, the plurality of byte code files obtained by compiling the target program are obtained at the compiling period of the target program, and the preset configuration information is determined, wherein the configuration information comprises file information to be detected and detection rules. And determining the files to be detected in the plurality of byte code files based on the file information to be detected, detecting each file to be detected based on a detection rule, and outputting a detection result, wherein the detection result is used for indicating the error files in the files to be detected. Because the embodiment detects the byte code file corresponding to the target program based on the preset configuration information at the compiling period of the target program, the error file is found, and thus the error file can be modified in time. The problem that the application program of the background service end has errors after installation and deployment is avoided, the performance of the background service is improved, and the usability of the whole service system is also improved.
As shown in fig. 2, fig. 2 is a flowchart illustrating a detection method of another program according to an exemplary embodiment, which describes a process of determining a file to be tested, and the method may be applied to a server, including the steps of:
in step 201, a plurality of bytecode files obtained by compiling a target program are acquired.
In step 202, predetermined configuration information is determined, where the configuration information includes file information to be tested and detection rules.
In step 203, an identifier corresponding to each byte code file is obtained.
In this embodiment, the identifier corresponding to the byte code file is information for distinguishing the byte code file, for example, the identifier corresponding to the byte code file may be a path corresponding to the byte code file, a name corresponding to the byte code file, a code corresponding to the byte code file, or the like. It may be understood that the identifier corresponding to the bytecode file may be any other information in any reasonable form, and the specific form aspect of the identifier corresponding to the bytecode file is not limited in this application.
In step 204, the byte code file is traversed, and if the identifier corresponding to the byte code file is recorded in the information of the file to be tested, the byte code file is determined to be the file to be tested.
In this embodiment, the information of the file to be tested may include identification information of all files to be tested, and the information of the file to be tested may include, but is not limited to, a path of the file to be tested, a name of the file to be tested, a code of the file to be tested, and the like. Each byte code file can be traversed, and if the identification corresponding to the byte code file is recorded in the file information to be tested for any byte code file, the byte code file can be determined to be the file to be tested.
In step 205, each file to be tested is tested based on the testing rule, and a testing result is output, where the testing result is used to indicate an error file in the files to be tested.
The processes from step 201 to step 205 are all performed at the compile time of the target program.
It should be noted that, for the same steps as those in the embodiment of fig. 2, the description of the steps in the embodiment of fig. 1 is omitted, and the related content may be referred to the embodiment of fig. 2.
According to the program detection method provided by the embodiment of the application, the plurality of byte code files obtained by compiling the target program are obtained at the compiling period of the target program, and the preset configuration information is determined, wherein the configuration information comprises file information to be detected and detection rules. Obtaining the corresponding identification of each byte code file, traversing the byte code files, determining the byte code file as a file to be tested if the corresponding identification of the byte code file is recorded in the file to be tested information aiming at any byte code file, detecting each file to be tested based on a detection rule, and outputting a detection result, wherein the detection result is used for indicating the target file with errors in the file to be tested. Therefore, the performance of the background service is further improved, and the usability of the whole service system is improved.
As shown in fig. 3, fig. 3 is a flowchart illustrating a detection method of another program according to an exemplary embodiment, which describes in detail a process of detecting each file to be detected, and the method may be applied to a server, including the steps of:
in step 301, a plurality of bytecode files obtained by compiling a target program are acquired.
In step 302, predetermined configuration information is determined, where the configuration information includes file information to be tested and detection rules.
In this embodiment, a detection plug-in for detecting a file to be detected may be preset, and configuration information may be set for the plug-in, where the configuration information may include information of the file to be detected and a detection rule. The information of the to-be-detected file may include identification information of all to-be-detected files, and the detection rule may be rule information for detecting whether the to-be-detected file is an error file.
In this embodiment, the above detection plug-in may be inserted into the compiling stage of the compiling period of the target program in advance. After compiling the target program, the detection plug-in can be started to execute the operation of detecting the file to be detected.
In step 303, a file under test in the plurality of bytecode files is determined based on the file under test information.
In step 304, each file to be tested is parsed to obtain metadata information corresponding to each file to be tested.
In this embodiment, an ASM bytecode generating architecture may be used to parse each file to be tested to obtain metadata information corresponding to each file to be tested. The metadata information corresponding to the file to be tested can include class, method, annotation, method body information and the like in the file to be tested.
In step 305, a preset plug-in is adopted, metadata information corresponding to each file to be tested is detected based on a detection rule, and a detection result is output, wherein the detection result is used for indicating an error file in the file to be tested.
In this embodiment, the preset plug-in is the detection plug-in inserted into the compiling stage of the compiling period of the target program in advance, and the detection plug-in may be started, and the detection plug-in is adopted to detect metadata information corresponding to each file to be detected based on a detection rule, and output a detection result.
In particular, the detection rules may include preset variable features and preset specification features. For any one file to be detected, a preset plug-in can be adopted, and metadata information corresponding to the file to be detected is detected in the following manner: firstly, whether the file to be tested contains a code program for remote call can be judged based on the preset variable characteristics and metadata information corresponding to the file to be tested. If the file under test does not contain a code program for remote invocation, it may be determined that the file under test is not an error file. If the file to be tested contains a code program for remote call, whether the file to be tested is an error file can be further judged based on preset standard characteristics and metadata information corresponding to the file to be tested.
The processes from step 301 to step 305 are all performed at the compile time of the target program.
It should be noted that, for the same steps as those in the embodiment of fig. 1 and 2, the description of the embodiment of fig. 3 is omitted, and the related content may be referred to the embodiment of fig. 1 and 2.
According to the program detection method provided by the embodiment of the application, the plurality of byte code files obtained by compiling the target program are obtained at the compiling period of the target program, and the preset configuration information is determined, wherein the configuration information comprises file information to be detected and detection rules. Determining to-be-detected files in the plurality of byte code files based on the to-be-detected file information, analyzing each to-be-detected file to obtain metadata information corresponding to each to-be-detected file, detecting the metadata information corresponding to each to-be-detected file based on a detection rule by adopting a preset plug-in, and outputting a detection result, wherein the detection result is used for indicating an error file in the to-be-detected file. The preset plug-in is a plug-in which is inserted into a compiling stage of a compiling period of a target program in advance. According to the embodiment, through the preset plug-in, the metadata information of the file to be tested obtained through analysis is detected at the compiling period of the target program, so that the verification of the program is realized, and the expandability of the program verification is enhanced. The problem that the application program of the background service end has errors after installation and deployment is further avoided, the performance of the background service is improved, and the usability of the whole service system is also improved.
In some alternative embodiments, the detection rule may include a preset variable feature and a preset specification feature. For any one file to be detected, a preset plug-in can be adopted, and metadata information corresponding to the file to be detected is detected in the following manner:
first, metadata information corresponding to the file to be tested can be first detected based on preset variable features, so that whether the file to be tested contains a code program for remote calling is judged.
Specifically, a plurality of member variables of the file to be tested may be determined based on metadata information corresponding to the file to be tested. And judging whether each member variable has the preset variable characteristics or not according to each member variable. If it is determined that at least one member variable having the preset variable characteristics exists among the plurality of member variables, it may be determined that the file to be tested contains a code program for remote call. If it is determined that the member variable having the preset variable characteristic does not exist among the plurality of member variables, it may be determined that the file to be measured does not contain a code program for remote call, and it may be further determined that the file to be measured is not an error file.
Then, if the result of the first detection indicates that the file to be tested includes the code program for remote call, the metadata information corresponding to the file to be tested can be subjected to second detection based on the preset specification features so as to determine whether the file to be tested is an error file.
Specifically, a plurality of target member methods in the file to be tested can be determined based on metadata information corresponding to the file to be tested, wherein the target member methods comprise member variables with preset variable characteristics, and the target member methods are call points for remote call. And judging whether the member method with the preset standard characteristics exists in the target member methods according to each target member method. If it is determined that at least one member method which does not have the preset specification characteristics exists in the target member methods, it may be determined that the file to be tested is an error file. If it is determined that there is no member method having no preset specification feature in the target member methods, it may be determined that the file to be tested is not an error file.
According to the embodiment, whether the file to be tested contains a code program for remote call or not can be judged based on the preset variable characteristics and metadata information corresponding to the file to be tested, and whether the file to be tested is an error file or not is judged based on the preset standard characteristics and the metadata information corresponding to the file to be tested when the file to be tested contains the code program for remote call. Thereby being beneficial to finding out the error file and modifying the target file in time. The problem that the application program of the background server has errors after being installed and deployed is further avoided.
Corresponding to the detection method embodiment of the program, the application also provides an embodiment of the detection device of the program.
As shown in fig. 4, fig. 4 is a block diagram of a detection apparatus of a program according to an exemplary embodiment of the present application, which may include: the device comprises an acquisition module 401, a determination module 402, a screening module 403 and a detection module 404.
The obtaining module 401 is configured to obtain a plurality of bytecode files obtained by compiling the target program.
The determining module 402 is configured to determine preset configuration information, where the configuration information includes file information to be tested and detection rules.
And a filtering module 403, configured to determine a file to be tested in the plurality of byte code files based on the file to be tested information.
The detection module 404 is configured to detect each file to be detected based on the detection rule, and output a detection result, where the detection result is used to indicate an error file in the file to be detected.
As shown in fig. 5, fig. 5 is a block diagram of a detection apparatus of another program according to an exemplary embodiment of the present application, where the screening module 403 may include: an acquisition submodule 501 and a traversal submodule 502.
The obtaining submodule 501 is configured to obtain an identifier corresponding to each byte code file.
The traversal submodule 502 is configured to traverse the byte code files, and determine, for any byte code file, that the byte code file is a file to be tested if an identifier corresponding to the byte code file is recorded in the file to be tested information.
As shown in fig. 6, fig. 6 is a block diagram of a detection apparatus of another program according to an exemplary embodiment of the present application, where the detection module 404 may include: a parsing sub-module 601 and a checking sub-module 602.
The parsing sub-module 601 is configured to parse each file to be tested to obtain metadata information corresponding to each file to be tested.
And the verification sub-module 602 is configured to detect metadata information corresponding to each file to be detected based on the detection rule by using a preset plug-in, where the preset plug-in is inserted into a compiling stage of a compiling period of the target program in advance.
As shown in fig. 7, fig. 7 is a block diagram of a detection apparatus of another program according to an exemplary embodiment of the present application, where the verification sub-module 602 may include: a first detection sub-module 701 and a second detection sub-module 702.
The detection rule may include a preset variable feature and a preset specification feature.
Wherein, for any file to be tested:
the first detection sub-module 701 is configured to perform a first detection on metadata information corresponding to the file to be detected based on the preset variable feature.
And the second detection sub-module 702 is configured to, when the result of the first detection indicates that the file to be detected includes a code program for remote call, perform a second detection on metadata information corresponding to the file to be detected based on the preset specification feature, so as to determine whether the file to be detected is an error file.
In other alternative embodiments, the first detection sub-module 701 is configured to: and determining a plurality of member variables of the file to be tested based on the metadata information corresponding to the file to be tested. If at least one member variable with preset variable characteristics exists in the plurality of member variables, determining that the file to be tested contains a code program for remote calling.
In other alternative embodiments, the second detection sub-module 702 is configured to: and determining a plurality of target member methods in the file to be tested based on the metadata information corresponding to the file to be tested, wherein the target member methods comprise member variables with preset variable characteristics. If at least one member method which does not have the preset standard characteristics exists in the plurality of target member methods, determining that the file to be tested is an error file.
It should be understood that the above device may be preset in the server, or may be loaded into the server by downloading or the like. The corresponding modules in the device can be matched with the modules in the server to realize the detection scheme of the program.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The embodiment of the application further provides a computer readable storage medium, and the storage medium stores a computer program, and the computer program can be used to execute the method for detecting the program provided by any one of the embodiments of fig. 1 to 3.
Corresponding to the above-mentioned detection method of the program, the embodiment of the present application also proposes a schematic block diagram of the electronic device according to an exemplary embodiment of the present application shown in fig. 8. Referring to fig. 8, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a nonvolatile memory, and may include hardware required by other services. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form a program detection device on a logic level. Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present application, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (7)

1. A method for detecting a program, applied to a compile time of the program, the method comprising:
acquiring a plurality of byte code files obtained after compiling a target program;
determining preset configuration information, wherein the configuration information comprises file information to be tested and detection rules;
determining a file to be tested in the plurality of byte code files based on the file to be tested information;
analyzing each file to be tested to obtain metadata information corresponding to each file to be tested;
detecting each file to be detected based on the detection rule, wherein the detection rule comprises preset variable characteristics and preset standard characteristics, and aiming at any file to be detected, a preset plug-in is adopted to detect metadata information corresponding to the file to be detected in the following mode:
and carrying out first detection on metadata information corresponding to the file to be detected based on the preset variable characteristics:
determining a plurality of member variables of the file to be tested based on metadata information corresponding to the file to be tested;
if at least one member variable with the preset variable characteristics exists in the member variables, determining that the file to be tested contains a code program for remote calling;
if the result of the first detection indicates that the file to be detected contains a code program for remote calling, performing a second detection on metadata information corresponding to the file to be detected based on the preset specification feature:
determining a plurality of target member methods in the file to be tested based on metadata information corresponding to the file to be tested, wherein the target member methods comprise member variables with preset variable characteristics;
and if at least one member method which does not have the preset standard characteristics exists in the target member methods, determining that the file to be detected is an error file.
2. The method of claim 1, wherein the determining a file to be tested of the plurality of bytecode files based on the file to be tested information comprises:
acquiring an identifier corresponding to each byte code file;
traversing the byte code files, and determining the byte code file as a file to be tested if the identification corresponding to the byte code file is recorded in the file information to be tested for any byte code file.
3. The method of claim 1, wherein the detecting each of the files under test based on the detection rules comprises:
and detecting metadata information corresponding to each file to be detected based on the detection rule by adopting a preset plug-in, wherein the preset plug-in is inserted into a compiling stage of a compiling period of a target program in advance.
4. A program detection apparatus, which is applied to a compile time of a program, the apparatus comprising:
the acquisition module is used for acquiring a plurality of byte code files obtained after compiling the target program;
the determining module is used for determining preset configuration information, wherein the configuration information comprises file information to be detected and detection rules;
the screening module is used for determining a file to be tested in the plurality of byte code files based on the file information to be tested;
the analysis submodule is used for analyzing each file to be tested to obtain metadata information corresponding to each file to be tested;
the detection module is used for detecting each file to be detected based on the detection rule, the detection rule comprises preset variable characteristics and preset standard characteristics, and aiming at any file to be detected, a preset plug-in is adopted to detect metadata information corresponding to the file to be detected in the following mode:
and carrying out first detection on metadata information corresponding to the file to be detected based on the preset variable characteristics:
determining a plurality of member variables of the file to be tested based on metadata information corresponding to the file to be tested; if at least one member variable with the preset variable characteristics exists in the member variables, determining that the file to be tested contains a code program for remote calling; if the result of the first detection indicates that the file to be detected contains a code program for remote calling, performing a second detection on metadata information corresponding to the file to be detected based on the preset specification feature: determining a plurality of target member methods in the file to be tested based on metadata information corresponding to the file to be tested, wherein the target member methods comprise member variables with preset variable characteristics; and if at least one member method which does not have the preset standard characteristics exists in the target member methods, determining that the file to be detected is an error file.
5. The apparatus of claim 4, wherein the detection module comprises:
and the verification sub-module is used for detecting the metadata information corresponding to each file to be detected based on the detection rule by adopting a preset plug-in, and the preset plug-in is inserted into the compiling stage of the compiling period of the target program in advance.
6. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-3.
7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of the preceding claims 1-3 when executing the program.
CN201910223263.1A 2019-03-22 2019-03-22 Program detection method and device and electronic equipment Active CN109960656B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910223263.1A CN109960656B (en) 2019-03-22 2019-03-22 Program detection method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910223263.1A CN109960656B (en) 2019-03-22 2019-03-22 Program detection method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109960656A CN109960656A (en) 2019-07-02
CN109960656B true CN109960656B (en) 2023-05-30

Family

ID=67024812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910223263.1A Active CN109960656B (en) 2019-03-22 2019-03-22 Program detection method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109960656B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112286826B (en) * 2020-11-25 2024-04-09 惠州Tcl移动通信有限公司 VTS test method and device, storage medium and computer equipment
CN113157296B (en) * 2021-04-27 2024-03-12 北京达佳互联信息技术有限公司 Method and device for updating compiled file, server and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040073904A1 (en) * 2002-10-15 2004-04-15 Nokia Corporation Method and apparatus for accelerating program execution in platform-independent virtual machines
CN106844096A (en) * 2016-12-27 2017-06-13 北京五八信息技术有限公司 The treating method and apparatus of program code
CN109491924A (en) * 2018-12-21 2019-03-19 北京达佳互联信息技术有限公司 Code detection method, device, terminal and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040073904A1 (en) * 2002-10-15 2004-04-15 Nokia Corporation Method and apparatus for accelerating program execution in platform-independent virtual machines
CN106844096A (en) * 2016-12-27 2017-06-13 北京五八信息技术有限公司 The treating method and apparatus of program code
CN109491924A (en) * 2018-12-21 2019-03-19 北京达佳互联信息技术有限公司 Code detection method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN109960656A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
US8584101B2 (en) Apparatus and method for automatically analyzing program for detecting malicious codes triggered under specific event/context
CN110941528B (en) Log buried point setting method, device and system based on fault
CN107145437B (en) Java annotation test method and device
CN110908888B (en) Server testing method and device
US8397104B2 (en) Creation of test plans
CN108459954B (en) Application program vulnerability detection method and device
CN110704306B (en) Assertion processing method, device, equipment and storage medium in test
US11888885B1 (en) Automated security analysis of software libraries
KR20080068385A (en) Program test system, method and computer readable medium on which program for executing the method is recorded
CN111045944A (en) Regression testing method, device and system and computer readable storage medium
CN109255240B (en) Vulnerability processing method and device
CN109960656B (en) Program detection method and device and electronic equipment
CN109614107B (en) Integration method and device of software development kit
CN115757092A (en) Application software compatibility detection method based on binary file symbol table
JP4587976B2 (en) Application vulnerability inspection method and apparatus
CN110825451A (en) Method and device for configuring and verifying small program page address
CN113946516A (en) Code coverage rate determining method and device and storage medium
US20070088986A1 (en) Systems and methods for testing software code
CN109684205B (en) System testing method, device, electronic equipment and storage medium
CN114328168A (en) Anomaly detection method and device, computer equipment and storage medium
US20080115016A1 (en) System and method for analyzing unknown file format to perform software security test
US9057764B2 (en) Detection of unchecked signals in circuit design verification
CN116541847A (en) Security detection method and device for application program
CN113127367B (en) Defect detection method for Android dynamic permission application
CN110442370B (en) Test case query method and device

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