CN112732335A - Object code extraction method, device, computer equipment and storage medium - Google Patents

Object code extraction method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112732335A
CN112732335A CN202110036408.4A CN202110036408A CN112732335A CN 112732335 A CN112732335 A CN 112732335A CN 202110036408 A CN202110036408 A CN 202110036408A CN 112732335 A CN112732335 A CN 112732335A
Authority
CN
China
Prior art keywords
target
code
folder
extracting
extraction logic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110036408.4A
Other languages
Chinese (zh)
Other versions
CN112732335B (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.)
Ping An Asset Management Co Ltd
Original Assignee
Ping An Asset Management 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 Ping An Asset Management Co Ltd filed Critical Ping An Asset Management Co Ltd
Priority to CN202110036408.4A priority Critical patent/CN112732335B/en
Priority claimed from CN202110036408.4A external-priority patent/CN112732335B/en
Publication of CN112732335A publication Critical patent/CN112732335A/en
Application granted granted Critical
Publication of CN112732335B publication Critical patent/CN112732335B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/74Reverse engineering; Extracting design information from source code
    • 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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

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

Abstract

The present application relates to the field of artificial intelligence, and in particular, to a method and an apparatus for extracting an object code, a computer device, and a storage medium. The method comprises the following steps: determining a target folder corresponding to the target code; acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic; setting the use authority of the target code, and testing the code corresponding to the target code after the use authority is set; obtaining a test result, and determining the target code which is not extracted successfully based on the test result; and extracting the target codes which are not successfully extracted from the codes, and determining the corresponding relation between the target folder and the target codes which are successfully extracted. In addition, the invention also relates to a block chain technology, and the object code can be stored in the block chain node. By adopting the method, the target can be accurately extracted from the code.

Description

Object code extraction method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for extracting an object code, a computer device, and a storage medium.
Background
An API (application programming interface) is a convention for interfacing different components of a software system. The primary purpose of application program interfaces is to provide applications and developers the ability to access a set of routines without accessing source code or to understand the details of the internal working mechanisms, largely divided into Windows API and linux API.
A large number of APIs need to be set in a project to complete corresponding functions, but API calls in the project are scattered in each service code, and it is not possible to directly see which menu/card is under which API is called. When the calling logic of the API needs to be cleared for the first time, only manual statistics is needed, so that the labor is consumed, and conditions such as omission or wrong recording of the corresponding relation are likely to occur, so that an error exists in relation clearing of the menu/card and the calling API.
Disclosure of Invention
In view of the above, it is necessary to provide an object code extraction method, apparatus, computer device, and storage medium capable of accurately extracting an object from a code in view of the above technical problems.
A method of object code extraction, the method comprising:
determining a target folder corresponding to the target code;
acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic;
setting the use authority of the target code, and testing the target code with the use authority;
obtaining a test result, and determining the target code which is not extracted successfully based on the test result;
extracting the target code which is not successfully extracted from the code;
determining a correspondence of the target folder and the extracted target code.
In one embodiment, the object code includes code corresponding to an application program interface and scalable vector graphics, wherein the extracting of the code corresponding to the application program interface includes extracting a common portion, extracting a menu portion, and/or extracting a card portion.
In one embodiment, the obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic includes:
acquiring extraction logic corresponding to the public part, wherein the extraction logic comprises at least one of a urls file mode, a regust request mode or a public part matching mode;
extracting, by the extraction logic, the application program interface of the target common portion from the corresponding folder.
In one embodiment, the obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic includes:
acquiring extraction logic corresponding to the menu part, wherein the extraction logic comprises a urls file mode and/or a regust request mode;
acquiring a routing folder corresponding to the target folder, and performing syntax recognition on the routing folder to recognize file character strings in the routing folder as a syntax abstract tree;
traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and a first file path in a routing folder corresponding to each menu;
analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path;
and matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
In one embodiment, the obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic includes:
identifying the files in the target folder to obtain card identifiers conforming to preset identifiers;
and searching all folders under the card identification, and recording the application program interfaces under the searched folders to the corresponding card identification.
In one embodiment, said extracting said object code from said object folder based on said extracting logic comprises:
acquiring a target folder with a file suffix meeting the requirement;
after the target code which is not successfully extracted is extracted from the code, the method further comprises the following steps:
copying the target folder which is successfully extracted into the web project folder;
cycling the target folder through the web project folders for presentation of scalable vector graphics.
In one embodiment, after the extracting the target code that is not successfully extracted from the code, the method further includes:
obtaining a corresponding intermediate file path for the target code matching request character string which is not successfully extracted;
and updating the extraction logic according to the intermediate file path generation.
An object code extraction apparatus, the apparatus comprising:
the target folder determining module is used for determining a target folder corresponding to the target code;
the first extraction module is used for acquiring extraction logic corresponding to the target code and extracting the target code from the target folder based on the extraction logic;
the test module is used for setting the use permission of the target code and testing the target code with the use permission;
the determining module is used for obtaining a test result and determining the target code which is not extracted successfully based on the test result;
the second extraction module is used for extracting the target code which is not successfully extracted from the codes;
and the output module is used for determining the corresponding relation between the target folder and the extracted target code.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method in any of the above embodiments when executing the computer program.
A computer storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method in any of the above embodiments.
According to the target code extraction method, the target code extraction device, the computer equipment and the storage medium, firstly, the corresponding folders are respectively extracted according to the extraction logic, and then the use permission of the target codes is set, so that the extracted target codes can be normally used in the test, and the targets which are not extracted cannot be normally used in the test, so that the target codes which are not successfully extracted can be obtained in the test mode, and further, the corresponding target codes are completely extracted from the codes.
Drawings
FIG. 1 is a diagram illustrating an exemplary implementation of a target code extraction method;
FIG. 2 is a flowchart illustrating a method for object code extraction according to one embodiment;
FIG. 3 is a flowchart illustrating a target code extraction method according to another embodiment;
FIG. 4 is a block diagram of an object code extracting apparatus according to an embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The object code extraction method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 uploads a code of a target to be extracted to the server, and the server 104 determines a target folder corresponding to the target code; acquiring extraction logic corresponding to the target code, extracting the target code from the target folder based on the extraction logic, setting the use permission of the target code, and testing the code corresponding to the target code after the use permission is set; obtaining a test result, and determining target codes which are not successfully extracted based on the test result; and extracting the target code which is not successfully extracted from the code. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In one embodiment, as shown in fig. 2, an object code extracting method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
s202: and determining a target folder corresponding to the target code.
Specifically, the object code may include codes corresponding to the application program interface API and the scalable vector graphics SVG, and the application program interface API stores different folders in the code as needed, for example, a public part is stored in a public folder, and a card part is stored in a cards folder, so that the server first determines the object folder corresponding to the object code to be extracted, so that files in the object folder can be identified to locate the corresponding object code.
Optionally, wherein the extracting of the application program interface comprises extracting a common part, extracting a menu part and/or extracting a card part.
S204: and acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic.
Specifically, the extraction logic is preset and includes, but is not limited to, a urls file mode, a request mode, a common part matching mode and a common introduction part mode, and the corresponding extraction logic is determined according to different object codes and object folders corresponding to the object codes, so that the server extracts the object codes from the object folders according to the corresponding extraction logic.
S206: and setting the use authority of the object code, and testing the object code with the use authority.
Specifically, the use permission is set in batch, that is, the use permission is set for the extracted object code, and thus, during testing, the item can only execute the API with the permission being the use permission, and cannot be extracted for the API without the use permission. For scalable vector graphics SVG, for scalable vector graphics SVG with permission of available permission, it is displayed normally, and for scalable vector graphics SVG without permission of available permission, it is not displayed normally.
S208: and acquiring a test result, and determining that the target code is not successfully extracted based on the test result.
Specifically, the test result includes a test success and a test failure, the test success indicates that all the target codes are extracted completely, and the test failure indicates that target codes which are not extracted successfully exist, so that the target codes can be extracted again.
S210: and extracting the target code which is not successfully extracted from the code.
Specifically, the API is scanned and then exported to the authority system of the project, so that API authority control is performed on the relevant pages of the project, when a certain page is accessed, part of the APIs are reported without authority, at this time, unscanned APIs are generally omitted, and the part of APIs are supplemented in a manual entry mode.
S212: and determining the corresponding relation between the target folder and the extracted target code.
Specifically, after the object code is extracted, different object folders correspond to different categories, namely, the menu and the card, so that the corresponding relation between the object folder and the object code is directly determined, and the object code corresponding to the menu and the card can be obtained.
It is emphasized that the object code may also be stored in a node of a block chain in order to further ensure privacy and security of the object code. According to the target code extraction method, the corresponding folders are respectively extracted according to the extraction logic, and then the use permission of the target codes is set, so that the extracted target codes can be normally used in the test, and the targets which are not extracted cannot be normally used in the test, so that the target codes which are not successfully extracted can be obtained in the test mode, and the corresponding target codes are completely extracted from the codes.
In one embodiment, acquiring extraction logic corresponding to the object code, and extracting the object code from the object folder based on the extraction logic includes: acquiring extraction logic corresponding to the public part, wherein the extraction logic comprises at least one of a urls file mode, a rule request mode or a public part matching mode; the application program interface of the target public part is extracted from the corresponding folder through extraction logic.
Specifically, in this embodiment, the application program interface of the common part is extracted, where the common part includes a common component, common components of each sub library module, common Filters, a constant file, and the like.
Specifically, the urls file manner includes: the server reads urls. js/urls. jsx in Redux (Redux is a JavaScript state container that provides predictable state management).
The request mode comprises the following steps: the es6 grammar, i.e., template string concatenation, is compatible with $ { baseApi }/urlPath' matching, url variable mode matching, and url wrapping mode, for example. Specifically, the url variable mode matching may be request (url), and this request mode may be that the url variable is defined at the top of the file, and specifically, the url line feed mode compatible mode may be request (url)
`${baseApi}/urlPath`
) The request mode needs to be compatible with the line feed condition of character matching.
The common part matching includes: the method comprises the steps of commonly giving a user, a Filter and a Filter nested component, wherein the commonly giving of the user means that the common component is nested in the common component again, and a recursive troubleshooting condition exists.
And the server extracts the API of the target public part from the corresponding target folder according to the extraction logic.
In one embodiment, acquiring extraction logic corresponding to the object code, and extracting the object code from the object folder based on the extraction logic includes: acquiring extraction logic corresponding to the menu part, wherein the extraction logic comprises a urls file mode and/or a regust request mode; acquiring a routing folder corresponding to the target folder, and performing syntax recognition on the routing folder to recognize file character strings in the routing folder as a syntax abstract tree; traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and a first file path in a routing folder corresponding to each menu; analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path; and matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
Specifically, in the present embodiment, an application program interface of the menu portion is extracted.
Wherein the menu part extraction may include: acquiring a routing folder corresponding to a target folder, carrying out grammar recognition on the routing folder, analyzing a menu file used under routing by recognizing a file character string as an AST (access stratum) grammar abstract tree, and corresponding to a unique identifier of a menu; analyzing all files in the target folder, and recording an API list called under each file path; matching the API call list with the incoming file path in the route, and successfully marking the API list under the corresponding menu.
The AST abstract tree is an abstract representation of a source code structure, the AST abstract tree represents a syntax structure of a programming language in a tree form, and each node on the tree represents a structure in the source code. In the project of the embodiment, the @ babel/parser dependency package is used for parsing file characters, token is generated through lexical analysis, AST is generated through syntax analysis, and configuration data of each menu, namely a unique menu permission identifier, is obtained through traversing a syntax tree.
The identification of the API in the target folder is based on the grammar rule of the sending request of the project, the API rule matching is carried out, and the method mainly comprises the following steps: request acquisition API and url s.js (x) file acquisition API.
Specifically, the urls file manner includes: the server reads urls. js/urls. jsx in Redux (Redux is a JavaScript state container that provides predictable state management).
The request mode comprises the following steps: the es6 grammar, i.e., template string concatenation, is compatible with $ { baseApi }/urlPath' matching, url variable mode matching, and url wrapping mode, for example. Specifically, the url variable mode matching may be request (url), and this request mode may be that the url variable is defined at the top of the file, and specifically, the url line feed mode compatible mode may be request (url)
`${baseApi}/urlPath`
) The request mode needs to be compatible with the line feed condition of character matching.
In one embodiment, acquiring extraction logic corresponding to the object code, and extracting the object code from the object folder based on the extraction logic includes: identifying files in the target folder to obtain a card identifier conforming to a preset identifier; and searching all folders under the card identification, and recording the application program interfaces under the searched folders to the corresponding card identification.
Specifically, the cards refer to a local display area with a small menu granularity, and it can be understood that one menu generally consists of a plurality of cards; in addition, there may be cases where a common portion is introduced into the card.
In practical application, reading all files under the card, identifying config.js to obtain a card identifier, and determining that the secondary card is effective; all folders under existing card identifiers are searched, and all called API lists are gathered under the current card.
The logic of its extraction of APIs for all folders under the card may include the urls file approach, the request approach, and the common import approach.
Specifically, the urls file manner includes: the server reads urls. js/urls. jsx in Redux (Redux is a JavaScript state container that provides predictable state management).
The request mode comprises the following steps: the es6 grammar, i.e., template string concatenation, is compatible with $ { baseApi }/urlPath' matching, url variable mode matching, and url wrapping mode, for example. Specifically, the url variable mode matching may be request (url), and this request mode may be that the url variable is defined at the top of the file, and specifically, the url line feed mode compatible mode may be request (url)
`${baseApi}/urlPath`
) The request mode needs to be compatible with the line feed condition of character matching.
The common Import part way includes an absolute path, a relative path, an alias path, and a Filter special configuration path, where the absolute path is similar to the way that components are imported in the absolute path, which is the way that an Import button from 'components/buttons'. The relative path is similar to the way the relative path introduces components in the form of an Import button from '/components/button'. The alias path is similar to the Import button from'. The Filter special configuration path is in a card configuration, and filters can be introduced through the configuration, and at the moment, corresponding to the introduction of the Filter component by the card, the relevant APIs also need to be collected.
In one embodiment, extracting object code from the object folder based on the extraction logic comprises: acquiring a target folder with a file suffix meeting the requirement; after the target code which is not successfully extracted is extracted from the code, the method further comprises the following steps: copying the target folder which is successfully extracted into the web project folder; the target folder is cycled through the web project folders for presentation of the scalable vector graphics.
Specifically, by configuration, files of all the svg suffixes under multiple paths can be obtained, and a set of data is generated by using the file path name as an identifier. Then copying the svg file to a web project folder, and copying the nonexistent file to the project folder by judging whether the current path exists or not. And generating a third web preview page, introducing svg file display by circulating an svg file path, and displaying the file name and the path name so as to generate the svg preview page. And finally, automatically updating, namely cloning the project to a tmp temporary folder, operating a command for generating an svg data file, packaging and generating an svg preview page command, and deploying the svg preview page command in an accessible server to realize the preview page, wherein the preview page is automatically updated at 11 points per night.
In the embodiment, the svg is extracted in batch, the preview page is automatically updated, the efficiency of finding the svg picture can be greatly improved, and the corresponding development efficiency is improved.
In one embodiment, after the target code which is not successfully extracted is extracted from the code, the method further comprises the following steps: obtaining a corresponding intermediate file path for the target code matching request character string which is not successfully extracted; the extraction logic is updated based on the intermediate file path generation.
Specifically, in this embodiment, missing parts match: matching the request character strings in the project through the known missing application program interface API, so as to find out a corresponding file path, and generating a missing API file path, so as to find out the reason of missing matching, wherein if the missing matching is in accordance with the rule but not scanned, the rule is extended and compatible; if the part is not in accordance with the rule, the entry is supplemented manually.
In the above embodiment, the application program interface API is extracted in batch, so that the correspondence between the application program interfaces API can be continuously recorded and updated in the process of continuous service iteration, and the adjustment process of the application program interface API corresponding to the relevant menu/card can be seen; or after the development lasts for a period of time, the application program interface API relationship file is generated again and used for verifying the recording result of the application program interface API.
Specifically, referring to fig. 3, fig. 3 is a flow chart illustrating an object code extraction method in another embodiment, in which the extraction of the application program interface may include a public portion, a menu portion, a card portion, and a manual entry portion.
The common part mainly comprises the extraction of common components, common components of all the sub-library modules, common Filters, constant files and the like, and the extraction rule is as described above.
For the extraction of the menu part, the routing file needs to be analyzed to obtain the menu identifier, the target folder needs to be analyzed to obtain the menu configuration, the application program interfaces under the target folder are matched, the specific rule is as described above, and finally the application program interfaces obtained by matching are classified under the corresponding menu identifier according to the mode of the file path.
The extraction of the card part is performed according to the above-mentioned rule.
Finally, for the missing part, because the matching rule is limited and can not cover all calling modes, some few special application program interface API calls are supplemented in a manual input mode.
According to the target code extraction method, the corresponding folders are respectively extracted according to the extraction logic, and then the use permission of the target codes is set, so that the extracted target codes can be normally used in the test, and the targets which are not extracted cannot be normally used in the test, so that the target codes which are not successfully extracted can be obtained in the test mode, and the corresponding target codes are completely extracted from the codes.
It should be understood that although the steps in the flowcharts of fig. 2 and 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 4, there is provided an object code extracting apparatus including: a target folder determination module 100, a first extraction module 200, a test module 300, an unextracted target determination module 400, and a second extraction module 500, wherein:
an object folder determining module 100, configured to determine an object folder corresponding to an object code;
a first extraction module 200, configured to obtain an extraction logic corresponding to the target code, and extract the target code from the target folder based on the extraction logic;
the test module 300 is used for setting the use permission of the target code and testing the target code with the use permission;
an unextracted target determining module 400, configured to obtain a test result, and determine an unextracted target code based on the test result;
a second extraction module 500, configured to extract an object code that is not successfully extracted from the code;
an output module 600, configured to determine a corresponding relationship between the target folder and the extracted target code.
In one embodiment, the object code includes code corresponding to an application program interface and scalable vector graphics, wherein the extracting of the code corresponding to the application program interface includes extracting a common portion, extracting a menu portion, and/or extracting a card portion.
In one embodiment, the first extraction module 200 includes:
the first extraction logic acquisition unit is used for acquiring extraction logic corresponding to the public part, and the extraction logic comprises at least one of a urls file mode, a regust request mode or a public part matching mode;
a first extraction unit for extracting the application program interface of the target common part from the corresponding folder through the extraction logic.
In one embodiment, the first extraction module 200 includes:
the second extraction logic acquisition unit is used for acquiring extraction logic corresponding to the menu part, and the extraction logic comprises a urls file mode and/or a regust request mode;
the grammar recognition unit is used for acquiring a routing folder corresponding to the target folder and carrying out grammar recognition on the routing folder so as to recognize file character strings in the routing folder as a grammar abstract tree;
the first file path determining unit is used for traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and first file paths in the routing folders corresponding to the menus;
the second file path determining unit is used for analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path;
and the second extraction unit is used for matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
In one embodiment, the first extraction module 200 includes:
the file identification unit is used for identifying files in the target folder to obtain card identifications conforming to preset identifications;
and the third extraction unit is used for searching all folders under the card identification and recording the application program interfaces under the searched folders to the corresponding card identification.
In one embodiment, the first extraction module 200 includes:
a suffix identification unit for acquiring a target folder with a file suffix meeting requirements;
the object code extracting apparatus further includes:
the copying module is used for copying the target folder which is successfully extracted into the web project folder;
and the display module is used for circulating the target folder through the web project folder to display the scalable vector graphics.
In one embodiment, the object code extracting apparatus further includes:
the file path acquisition module is used for acquiring a corresponding intermediate file path for the target code matching request character string which is not successfully extracted;
and the updating module is used for updating the extraction logic according to the intermediate file path generation.
For specific limitations of the object code extracting apparatus, reference may be made to the above limitations of the object code extracting method, which are not described herein again. The modules in the object code extracting apparatus may be wholly or partially implemented by software, hardware, or a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store the object code. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an object code extraction method.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: determining a target folder corresponding to the target code; acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic; setting the use authority of the target code, and testing the target code with the use authority; obtaining a test result, and determining target codes which are not successfully extracted based on the test result; and extracting target codes which are not successfully extracted from the codes, and determining the corresponding relation between the target folder and the extracted target codes.
In one embodiment, the object code involved in the execution of the computer program by the processor comprises code corresponding to an application program interface and the scalable vector graphics, wherein the extraction of code corresponding to the application program interface comprises extraction of a common portion, extraction of a menu portion, and/or extraction of a card portion.
In one embodiment, the obtaining of the extraction logic corresponding to the object code and the extracting of the object code from the object folder based on the extraction logic, which are implemented when the processor executes the computer program, includes: acquiring extraction logic corresponding to the public part, wherein the extraction logic comprises at least one of a urls file mode, a rule request mode or a public part matching mode; the application program interface of the target public part is extracted from the corresponding folder through extraction logic.
In one embodiment, the obtaining of the extraction logic corresponding to the object code and the extracting of the object code from the object folder based on the extraction logic, which are implemented when the processor executes the computer program, includes: acquiring extraction logic corresponding to the menu part, wherein the extraction logic comprises a urls file mode and/or a regust request mode; acquiring a routing folder corresponding to the target folder, and performing syntax recognition on the routing folder to recognize file character strings in the routing folder as a syntax abstract tree; traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and a first file path in a routing folder corresponding to each menu; analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path; and matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
In one embodiment, the obtaining of the extraction logic corresponding to the object code and the extracting of the object code from the object folder based on the extraction logic, which are implemented when the processor executes the computer program, includes: identifying files in the target folder to obtain a card identifier conforming to a preset identifier; and searching all folders under the card identification, and recording the application program interfaces under the searched folders to the corresponding card identification.
In one embodiment, extracting object code from an object folder based on extraction logic implemented by a processor when executing a computer program comprises: acquiring a target folder with a file suffix meeting the requirement; after the object code which is not successfully extracted is extracted from the code when the processor executes the computer program, the method further comprises the following steps: copying the target folder which is successfully extracted into the web project folder; the target folder is cycled through the web project folders for presentation of the scalable vector graphics.
In one embodiment, after the extracting of the target code that is not successfully extracted from the code, which is implemented when the processor executes the computer program, the method further includes: obtaining a corresponding intermediate file path for the target code matching request character string which is not successfully extracted; the extraction logic is updated based on the intermediate file path generation.
In one embodiment, a computer storage medium is provided, having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of: determining a target folder corresponding to the target code; acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic; setting the use authority of the target code, and testing the target code with the use authority; obtaining a test result, and determining target codes which are not successfully extracted based on the test result; and extracting target codes which are not successfully extracted from the codes, and determining the corresponding relation between the target folder and the extracted target codes.
In one embodiment, the object code involved in the execution of the computer program by the processor comprises code corresponding to an application program interface and scalable vector graphics, wherein the extraction of code corresponding to the application program interface comprises extraction of a common portion, extraction of a menu portion, and/or extraction of a card portion.
In one embodiment, the computer program, when executed by a processor, implements extraction logic to obtain object code corresponding to the object code, and extracts the object code from the object folder based on the extraction logic, including: acquiring extraction logic corresponding to the public part, wherein the extraction logic comprises at least one of a urls file mode, a rule request mode or a public part matching mode; the application program interface of the target public part is extracted from the corresponding folder through extraction logic.
In one embodiment, the computer program, when executed by a processor, implements extraction logic to obtain object code corresponding to the object code, and extracts the object code from the object folder based on the extraction logic, including: acquiring extraction logic corresponding to the menu part, wherein the extraction logic comprises a urls file mode and/or a regust request mode; acquiring a routing folder corresponding to the target folder, and performing syntax recognition on the routing folder to recognize file character strings in the routing folder as a syntax abstract tree; traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and a first file path in a routing folder corresponding to each menu; analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path; and matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
In one embodiment, the computer program, when executed by a processor, implements extraction logic to obtain object code corresponding to the object code, and extracts the object code from the object folder based on the extraction logic, including: identifying files in the target folder to obtain a card identifier conforming to a preset identifier; and searching all folders under the card identification, and recording the application program interfaces under the searched folders to the corresponding card identification.
In one embodiment, extracting object code from an object folder based on extraction logic implemented when a computer program is executed by a processor includes: acquiring a target folder with a file suffix meeting the requirement; after the computer program is executed by a processor and used for extracting the target code which is not successfully extracted from the code, the method further comprises the following steps: copying the target folder which is successfully extracted into the web project folder; the target folder is cycled through the web project folders for presentation of the scalable vector graphics.
In one embodiment, the computer program, when executed by a processor, further performs, after extracting the target code that is not successfully extracted from the code: obtaining a corresponding intermediate file path for the target code matching request character string which is not successfully extracted; the extraction logic is updated based on the intermediate file path generation.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for extracting an object code, the method comprising:
determining a target folder corresponding to the target code;
acquiring extraction logic corresponding to the target code, and extracting the target code from the target folder based on the extraction logic;
setting the use authority of the target code, and testing the target code with the use authority;
obtaining a test result, and determining the target code which is not extracted successfully based on the test result;
extracting the target code which is not successfully extracted from the code;
determining a correspondence of the target folder and the extracted target code.
2. The method of claim 1, wherein the object code comprises code corresponding to an application program interface and scalable vector graphics, and wherein extracting code corresponding to the application program interface comprises extracting a common portion, extracting a menu portion, and/or extracting a card portion.
3. The method of claim 2, wherein obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic comprises:
acquiring extraction logic corresponding to the public part, wherein the extraction logic comprises at least one of a urls file mode, a regust request mode or a public part matching mode;
extracting, by the extraction logic, the application program interface of the target common portion from the corresponding folder.
4. The method of claim 2, wherein obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic comprises:
acquiring extraction logic corresponding to the menu part, wherein the extraction logic comprises a urls file mode and/or a regust request mode;
acquiring a routing folder corresponding to the target folder, and performing syntax recognition on the routing folder to recognize file character strings in the routing folder as a syntax abstract tree;
traversing the abstract syntax tree to obtain menu identifiers of menus in the target folder and a first file path in a routing folder corresponding to each menu;
analyzing the target folder to obtain a second file path corresponding to each file and an application program interface under the second file path;
and matching the first file path with the second file path to obtain an application program interface corresponding to each menu identifier.
5. The method of claim 2, wherein obtaining extraction logic corresponding to the object code and extracting the object code from the object folder based on the extraction logic comprises:
identifying the files in the target folder to obtain card identifiers conforming to preset identifiers;
and searching all folders under the card identification, and recording the application program interfaces under the searched folders to the corresponding card identification.
6. The method of claim 2, wherein said extracting the object code from the object folder based on the extraction logic comprises:
acquiring a target folder with a file suffix meeting the requirement;
after the target code which is not successfully extracted is extracted from the code, the method further comprises the following steps:
copying the target folder which is successfully extracted into the web project folder;
cycling the target folder through the web project folders for presentation of scalable vector graphics.
7. The method according to any one of claims 1 to 5, wherein after the extracting the target code that is not successfully extracted from the code, further comprising:
obtaining a corresponding intermediate file path for the target code matching request character string which is not successfully extracted;
and updating the extraction logic according to the intermediate file path generation.
8. An object code extraction apparatus, characterized in that the apparatus comprises:
the target folder determining module is used for determining a target folder corresponding to the target code;
the first extraction module is used for acquiring extraction logic corresponding to the target code and extracting the target code from the target folder based on the extraction logic;
the test module is used for setting the use permission of the target code and testing the target code with the use permission;
the determining module is used for obtaining a test result and determining the target code which is not extracted successfully based on the test result;
the second extraction module is used for extracting the target code which is not successfully extracted from the codes;
and the output module is used for determining the corresponding relation between the target folder and the extracted target code.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium on which a computer program is stored, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110036408.4A 2021-01-12 Object code extraction method, device, computer equipment and storage medium Active CN112732335B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110036408.4A CN112732335B (en) 2021-01-12 Object code extraction method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110036408.4A CN112732335B (en) 2021-01-12 Object code extraction method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112732335A true CN112732335A (en) 2021-04-30
CN112732335B CN112732335B (en) 2024-05-31

Family

ID=

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005497A (en) * 2006-11-27 2007-07-25 科博技术有限公司 System and method for preventing vicious code attach
CN103593238A (en) * 2012-08-16 2014-02-19 腾讯科技(深圳)有限公司 Method and device for controlling invocation of application programming interfaces
CN106851026A (en) * 2017-01-23 2017-06-13 北京奇虎科技有限公司 Inactive phone number is recognized and method for cleaning, device and mobile terminal
US20190196796A1 (en) * 2017-12-21 2019-06-27 Fujitsu Limited Api mashup generation
CN110297639A (en) * 2019-07-01 2019-10-01 北京百度网讯科技有限公司 Method and apparatus for detecting code
CN110727597A (en) * 2019-10-15 2020-01-24 杭州安恒信息技术股份有限公司 Method for completing use case based on log troubleshooting invalid codes

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101005497A (en) * 2006-11-27 2007-07-25 科博技术有限公司 System and method for preventing vicious code attach
CN103593238A (en) * 2012-08-16 2014-02-19 腾讯科技(深圳)有限公司 Method and device for controlling invocation of application programming interfaces
CN106851026A (en) * 2017-01-23 2017-06-13 北京奇虎科技有限公司 Inactive phone number is recognized and method for cleaning, device and mobile terminal
US20190196796A1 (en) * 2017-12-21 2019-06-27 Fujitsu Limited Api mashup generation
CN110297639A (en) * 2019-07-01 2019-10-01 北京百度网讯科技有限公司 Method and apparatus for detecting code
CN110727597A (en) * 2019-10-15 2020-01-24 杭州安恒信息技术股份有限公司 Method for completing use case based on log troubleshooting invalid codes

Similar Documents

Publication Publication Date Title
CN110290212B (en) Service call recording method, device, computer equipment and storage medium
CN110866198B (en) Static resource caching method, system, device, computer equipment and storage medium
CN109814854B (en) Project framework generation method, device, computer equipment and storage medium
CN109032662B (en) Code file generation method and device, computer equipment and storage medium
CN110166543B (en) Application program processing method and device and computer equipment
CN109726134B (en) Interface test method and system
CN109361628B (en) Message assembling method and device, computer equipment and storage medium
CN111310195A (en) Security vulnerability management method, device, system, equipment and storage medium
CN113157315A (en) Method, device, equipment and medium for identifying difference information of different versions of software
CN111083054B (en) Route configuration processing method and device, computer equipment and storage medium
CN111078559A (en) Method, device, medium and computer equipment for extracting function call in java code
CN112559526A (en) Data table export method and device, computer equipment and storage medium
CN112507729A (en) Method and device for translating text in page, computer equipment and storage medium
US20220237240A1 (en) Method and apparatus for collecting information regarding dark web
CN112882782A (en) Page generation method and device, computer equipment and storage medium
CN111708971A (en) Page configuration method and device, computer equipment and storage medium
CN110362478B (en) Application upgrade test method and device, computer equipment and storage medium
CN111597422A (en) Buried point mapping method and device, computer equipment and storage medium
CN111191443A (en) Sensitive word detection method and device based on block chain, computer equipment and storage medium
CN108460116B (en) Search method, search device, computer equipment, storage medium and search system
CN108897772B (en) Data source supplementing method and device, computer equipment and storage medium
CN112732335B (en) Object code extraction method, device, computer equipment and storage medium
CN112732335A (en) Object code extraction method, device, computer equipment and storage medium
Michalas et al. MemTri: A memory forensics triage tool using bayesian network and volatility
CN110460585B (en) Equipment identity identification method and device, computer equipment and storage medium

Legal Events

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