CN118132168A - Function injection method and device, storage medium and electronic equipment - Google Patents

Function injection method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN118132168A
CN118132168A CN202410203106.5A CN202410203106A CN118132168A CN 118132168 A CN118132168 A CN 118132168A CN 202410203106 A CN202410203106 A CN 202410203106A CN 118132168 A CN118132168 A CN 118132168A
Authority
CN
China
Prior art keywords
injection
function
node
module
instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410203106.5A
Other languages
Chinese (zh)
Inventor
王晓璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202410203106.5A priority Critical patent/CN118132168A/en
Publication of CN118132168A publication Critical patent/CN118132168A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the specification discloses a function injection method, a function injection device, a storage medium and electronic equipment, wherein in the process of starting a basic application, an injection module is positioned according to positioning parameters in an injection instruction in response to the injection instruction, the injection module is quoted to the basic application, and then an injection node aiming at the injection module is determined according to the injection instruction; finally, determining an injection function according to the injection instruction, and executing the injection function at the injection node.

Description

Function injection method and device, storage medium and electronic equipment
Technical Field
The present invention relates to computer technology, and in particular, to a method and apparatus for function injection, a storage medium, and an electronic device.
Background
Js is an open-source and cross-platform rear-end JavaScript running environment constructed based on a Chrome V8 JavaScript engine, and can efficiently process data-intensive real-time application programs. When private data and real-time service logic in node. Js application are processed, the section cutting technology can realize the capability of injecting services into various systems and frames realized based on nodejs languages, help developers and users to know data flow inside the application, and also can immediately intercept malicious codes and poisoning attacks, so that the safety protection of the private data is realized, and the safety and stability of application programs are protected. However, in the related art, the tangent plane technology is generally required to be implemented by a third party tool or in a specific mode of application switching, which is inefficient and has poor flexibility.
Therefore, a solution for function injection with high efficiency is needed to solve the problems of low implementation efficiency and poor flexibility of the tangent plane technology in node. Js application.
Disclosure of Invention
The embodiment of the specification provides a function injection method, which can complete function injection without modifying codes of original applications or requiring applications to be in a specific state, solves the problem of low function injection efficiency, and is suitable for any node. Js application and has high flexibility. The method comprises the following steps:
Starting a basic application, responding to an injection instruction, and positioning an injection module according to positioning parameters in the injection instruction, wherein the injection module refers to the basic application;
Determining an injection node for the injection module according to the injection instruction;
determining an injection function according to the injection instruction, and executing the injection function at the injection node.
Further, in some embodiments, the injection node includes a pre-start-up phase or a post-run phase of the injection module, the determining an injection function according to the injection instructions, and executing the injection function at the injection node includes:
determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal throwing function and a parameter return function;
And successfully executing the injection function at the injection node, returning parameters according to the parameter return function, and throwing an exception according to the exception throwing function parameter if the injection function is not successfully executed.
Further, in some embodiments, the injection node includes an anomaly phase of the injection module, the determining an injection function according to the injection instructions, and executing the injection function at the injection node includes:
Determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal ejection function;
And based on the injection node being an abnormal stage of the injection module, casting an abnormality according to the abnormality casting function parameter.
Further, in some embodiments, the positioning parameters in the injection instructions include at least one of:
source parameters, path parameters, or name parameters.
Further, in some embodiments, the positioning parameters further comprise a synchronicity parameter or a type parameter.
Further, the method further comprises:
setting a flag bit in the injection function in the process of executing the injection function;
Sharing the zone bit to the basic application through the context;
And in response to detecting the flag bit, jumping out of the injection function and calling the basic application.
Further, in some embodiments, the method further comprises:
And starting a basic application, responding to an injection instruction, and executing the basic application according to the fact that the positioning parameters in the injection instruction are not positioned to the injection module.
Further, in some embodiments, the injection instructions include static injection instructions, the determining an injection function from the injection instructions and executing the injection function at the injection node includes:
Determining an injection function according to the injection instruction, and executing the injection function at the injection node before the base application.
Further, the injection instructions include dynamic injection instructions, the determining an injection function according to the injection instructions and executing the injection function at the injection node includes:
determining an injection function according to the injection instruction, and executing the injection function at the injection node in the running process of the basic application through a debugging process.
Further, the executing, by the debugging process, the injection function at the injection node during the running of the base application includes: the injection function is executed at the injection node during the running of the base application by a debugging process.
Further, the executing, by the debugging process, the injection function at the injection node during the running of the base application includes: the injection function is executed by a debugging process at the injection node during running of the base application and upon restart of the base application.
The embodiment of the specification also provides a function injection device, which comprises:
The positioning module is used for responding to an injection instruction in the process of starting the basic application, positioning the injection module according to positioning parameters in the injection instruction, and introducing the injection module to the basic application;
The node module is used for determining an injection node aiming at the injection module according to the injection instruction;
and the injection module is used for determining an injection function according to the injection instruction and executing the injection function at the injection node.
The present description also provides a computer program product storing at least one instruction adapted to be loaded by a processor and to perform the above-described method steps.
The present description embodiment also provides a storage medium storing a computer program adapted to be loaded by a processor and to perform the steps of the above-described method.
The embodiment of the specification also provides an electronic device, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the steps of the method described above.
In the function injection method provided by the embodiment of the specification, in the process of starting a basic application, responding to an injection instruction, positioning an injection module according to positioning parameters in the injection instruction, introducing the injection module to the basic application, and then determining an injection node aiming at the injection module according to the injection instruction; finally, determining an injection function according to the injection instruction, and executing the injection function at the injection node.
Drawings
FIG. 1 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of a function injection method according to an embodiment of the present disclosure
FIG. 4 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure;
FIG. 5 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure;
FIG. 6 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure;
FIG. 7 is a schematic structural diagram of a function injection device according to an embodiment of the present disclosure;
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
In the related technology, node.js system section can realize function injection by integrating corresponding sdk and using a mode of replacing functions after application starting, however, the mode needs service to modify the original application code, and each function/library needing replacement needs to be manually written with a corresponding function/library for replacement, so that the efficiency is lower; and the method is to inject after the application is started, so that the injection effect is difficult to ensure, and functions directly derived from libraries before injection cannot be injected. Or the application can be set to be in a debugging state after the application is started, and the injection script is operated to replace the objective function to realize function injection.
Based on this, one or more embodiments of the present disclosure provide a node. Js system function injection method, in which, in a process of starting a base application, an injection module is positioned according to a positioning parameter in the injection instruction in response to an injection instruction, the injection module refers to the base application, and then an injection node for the injection module is determined according to the injection instruction; finally, determining an injection function according to the injection instruction, and executing the injection function at the injection node.
Referring to fig. 1, a flow chart of a function injection method is provided in the embodiment of the present disclosure. In the embodiments of the present specification, the function injection method is applied to a function injection device or an electronic apparatus configured with the function injection device. The following details about the flow shown in fig. 1, the function injection method may specifically include the following steps:
S102, starting a basic application, responding to an injection instruction, and positioning an injection module according to method parameters in the injection instruction, wherein the injection module refers to the basic application;
The base application is any node. Js application that needs to execute a slice. Illustratively, the node.js application is any application running in a node.js server framework, which is a software framework built on top of node.js for simplifying development and maintenance of Web applications. It accelerates development by providing common tools, libraries, and templates, while providing a structured method of organizing code and managing dependencies.
The injection instructions can be written in the basic application design writing process, or can be written in the basic application by adding or modifying after the basic application writing is completed. Whichever of the above writing methods does not change the original writing and running logic of the base application.
In one or more embodiments of the present disclosure, the injection instructions include at least positioning parameters for positioning the injection module, for determining the injection module and referencing the injection module to the base application. In a possible embodiment, the injection instruction may be, for example, a module referencing mechanism in node. Js, such as a required mechanism. Specifically, in node. Js, exports is an interface disclosed by a module, and a request can be used to acquire an interface of a module, that is, exports objects of the acquired module, and also can expose an object by using modules, that is, return an object when a request references the module, so that node. Js can directly access all properties and methods in the object.
Further, in one or more embodiments of the present disclosure, in the step of positioning the injection module according to the positioning parameter in the injection instruction, the positioning parameter includes at least one of: source parameters (clazz) such as a system library such as fs, file paths, or regular expressions; the path parameter (path) is used to locate a parent object to a method, or the name parameter (method) such as a method name or a string type, supports a method of injecting a string or Symbol as a name. Illustratively, referencing the injection module by a require function may include the following positioning and referencing means:
Loading from the file module cache, wherein although the priority of the original module is different from that of the file module, the existing module is loaded from the file module cache preferentially;
The priority of the native module is next to the priority of the file module cache, loaded from the native module. The request method preferably checks whether the module is in the native module list after resolving the file name according to the location parameter. Taking the http module as an example, although there is one http/http.js/http.node/http.json file under the directory, the request ("http") will not be loaded from these files, but from the native module. The native module also has a buffer, and is also preferentially loaded from the buffer. If the cache area is not loaded, calling a loading mode of the native module to load and execute;
When the file module cache does not exist and is not the original module, node.js analyzes the positioning parameters transmitted by the requiring method and loads the actual file from the file system.
In one or more embodiments of the present description, in the step of positioning the injection module according to the positioning parameter in the injection instruction, the positioning parameter may further include a synchronization parameter or a type parameter. The synchronicity parameter is used to determine if the injection is a synchronous method, and the return to Promise method is an asynchronous method, otherwise it is a synchronous method. The type parameter may include a method type, such as GETTER, SETTER, SYMBOL, etc. These positioning parameters may further help determine the content and properties of the injection module and injection function, improving the efficiency and accuracy of the injection.
Illustratively, the code expression for locating the location parameters of the injection module is in part as follows:
//{clazz:'/home/admin/store.js',path:['Store','prototype'],method:'status',sync:true}
//{clazz:'/home/admin/store.js',path:['Store','prototype'],method:'name',type:'GETTER'}
//{clazz:'[.*?/store.js$]',path:['Store'],method:'getAllStores',sync:true}
in one or more embodiments of the present description, a base application is executed based on a localization parameter in an injection instruction not being localized to an injection module. Even if the function injection cannot be executed, the operation of the basic application is not affected, and the flexibility of the function injection is higher.
S104, determining an injection node for the injection module according to the injection instruction;
In one or more embodiments of the present disclosure, the injection module may be considered as providing channels and frameworks for function injection, and may be further configured with specific injection timing. Thus, the injection node may also be determined from the injection instructions. The injection node may be a special node before or after the injection module, or even during execution of the injection module, for example, a node reporting an exception. The specific execution node can be adjusted according to the setting, so that the method and the system can better adapt to various section requirements, and the flexibility of the injection function is higher.
S106, determining an injection function according to the injection instruction, and executing the injection function at the injection node.
In one or more embodiments of the present disclosure, the injection module may be considered as a channel and framework that provides function injection, and may be further configured for specific injection content. Illustratively, the content in the injection module in the reference base application may be modified, and the content referenced by the injection module, and the returned content, may be set according to different section requirements.
It should be noted that executing the injection function at the injection node may be regarded as a modification of the module loader. When the modified module loader loads the application code, the cut method, namely the injection module is automatically replaced by the proxy method corresponding to the injection function.
One or more embodiments of the present disclosure provide a node/js system function injection method, in which in a process of starting a base application, an injection module is positioned according to a positioning parameter in the injection instruction in response to the injection instruction, the injection module is referenced to the base application, and then an injection node for the injection module is determined according to the injection instruction; finally, determining an injection function according to the injection instruction, and executing the injection function at the injection node.
Fig. 2 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure. As shown in fig. 2, the method comprises the steps of:
S202, starting a basic application, responding to an injection instruction, and positioning an injection module according to positioning parameters in the injection instruction, wherein the injection module refers to the basic application;
step S202 is referred to in another embodiment of the present disclosure for detailed description of step S102, which is not repeated here.
S204, determining an injection node for an injection module according to an injection instruction;
Step S204 is shown in another embodiment of the present disclosure, and is not described herein in detail. Wherein the injection node comprises a pre-start stage or a post-operation stage of the injection module
S206, determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal throwing function and a parameter return function;
S208, successfully executing the injection function at the injection node, and returning parameters according to the parameter return function;
s210, if the injection function is not successfully executed, the exception is thrown according to the exception throwing function parameter.
In one or more embodiments of the present description, the function injection is performed Before the injection function module performs the start-up (Before phase) or After the run is completed (After the After phase). The injected function logic may include a parameter return function in the case of normal execution and an exception throw function in the case of unsuccessful execution.
Exemplary codes are as follows:
The proxy method can be regarded as a secondary wrapper to the original method, where 'RETURN' is the parameter RETURN and 'THROW' is the exception throw. The result after the function injection is more comprehensive, and corresponding feedback can be obtained no matter the execution of the injection function is completed.
In one or more embodiments of the present disclosure, please refer to fig. 3, which is a schematic flow chart of a function injection method provided in the embodiments of the present disclosure. As shown in fig. 3, the method comprises the steps of:
S302, starting a basic application, responding to an injection instruction, positioning an injection module according to positioning parameters in the injection instruction, and introducing the injection module into the basic application;
Step S302 is shown in another embodiment of the present disclosure, and the detailed description of step S102 is omitted here.
S304, determining an injection node for an injection module according to an injection instruction;
step S304 is shown in another embodiment of the present disclosure, and the detailed description of step S104 is omitted here. Wherein the injection node comprises an abnormal phase of the injection module.
S306, determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal ejection function;
S308, based on the injection node being an abnormal stage of the injection module, the abnormality is thrown out according to the abnormality throwing function parameter.
In the abnormal stage of the injection module, the related parameters are difficult to return under normal conditions, so that only the abnormal ejection function is injected in the abnormal stage, and the injection function also ejects the abnormality under the condition that the injection module ejects the abnormality, so that the feedback of the injection function is more comprehensive.
Illustratively, the injection code for the anomaly phase is as follows:
the ad-hoc function in the code in one or more embodiments described above may refer to the details that are performed for the parameters in the injection function, which may cause recursion problems if the underlying application is referenced in the ad-hoc function.
Thus, in one or more embodiments of the present description, the function injection method further comprises: setting a zone bit in the injection function in the process of executing the injection function; sharing the zone bit to the basic application through the context; and in response to the detection of the flag bit, jumping out of the injection function and calling the basic application.
In order to freely use any function in the cut slice's address without causing recursion, the context may be introduced by introducing a context, and after the context is introduced, only when the address is executed, setting a ADVICE flag bit in the context, so that if the cut method is called in the address, the context ADVICE flag bit is detected, and the method in the original base application is directly called to avoid recursion.
In some possible embodiments, asyncId of the resource of the current callback may be triggered by async_hook.triggerasynclid () in the async_hook library, and asyncId of the current execution context may be triggered by async_hook.execu-nasynclid () for the transfer of the ad-vice flag bit in context.
In a possible embodiment, please refer to fig. 4, which is a schematic flow chart of a function injection method provided in the embodiment of the present disclosure. As shown in fig. 4, the execution process methodproxy includes:
Detecting whether there is a requirement or situation of degradation/fusing/disabling/nesting, if not, inquiring a tangent point ad device, sequentially executing ad device. Before, performing ad device return or exception throwing, then executing the original method, executing ad device. After under the condition that the original method is not abnormal, performing ad device return or exception throwing, and giving a return value of the original method. When the original method is abnormal, the device error is executed, and the device abnormality and the original method abnormality are thrown out. If there is a need or situation for demotion/fusing/disablement/nesting, the original method can be directly invoked.
In one or more embodiments herein, the injection instructions include static injection instructions, determining an injection function from the injection instructions, and executing the injection function at the injection node, comprising: an injection function is determined from the injection instructions and is executed at the injection node prior to the base application. Under the static injection condition, after the basic application is started, function injection is firstly carried out, the function injection is executed before the business process is executed, a tangent plane is loaded, and a nodejs module loader is modified. When the method is called by the subsequent service, the version which is already injected is called, and the problem that the injection cannot be performed is avoided. The static injection has small influence on the business corresponding to the basic application, is suitable for high-security scenes, and can ensure the coverage rate of injection.
In one or more embodiments herein, the injection instructions include dynamic injection instructions, determining an injection function from the injection instructions, and executing the injection function at the injection node, comprising: determining an injection function according to the injection instruction, and executing the injection function at the injection node in the running process of the basic application through the debugging process. After the service process is started, the dynamic injection function executes a command in the service process through the debugging process, the module loader is modified nodejs, and the method which is already derived from the module cannot complete injection. Dynamic injection is applicable to scenes where stability requirements are not high, and for example, scenes where emergency needs to be temporarily blocked by a cut-plane specific attack.
Fig. 5 is a schematic flow chart of a function injection method according to an embodiment of the present disclosure. As shown in fig. 5, in one possible embodiment, the function injection method includes the following steps:
And positioning the module loader in the node.js according to the positioning parameters in the instruction and modifying the module loader by static injection or dynamic injection instructions, and loading the modified node.js module loader to realize function injection. And determining the tangent plane logics such as a tangent plane module, a tangent point list, an enhancement point Map and the like according to the injection function, and feeding back the tangent point list to the node.js module loader through the tangent plane module loader to realize the tangent plane technology aiming at the node.js.
Further, in one or more embodiments of the present description, executing, by a debugging process, an injection function at an injection node during a base application run, includes: the injection function is executed at the injection node during the running of the base application by the debugging process. The loading mode is a hot loading mode, function injection can be realized without reloading, and the method is generally applicable to updating the tangent point or specific operation aiming at the tangent point data.
Optionally, in one or more embodiments of the present specification, executing, by the debugging process, the injection function at the injection node during the running of the base application includes: injecting the injection function at the injection node during the running of the base application by the debugging process, and executing the injection function when the base application is restarted. The loading mode is a cold loading mode, and needs to be reloaded to enable the injection function to be effective, and is usually used for newly adding section logic.
JavaScript code is run on a single thread, and a Node. Js process is run on only one CPU, which causes defects such as inability to enjoy the multi-core computing advantages of modern computers, and failure to provide stable services if there is a code error, resulting in Node service exception. Based on stability, performance, etc., multiple Worker modes of operation may be considered. But for some work in it, problems can occur if multiple Workder are used. For example, generating log files, each Worker generates once to generate waste of resources. Therefore, when the problems are considered, a single process can be specially used for processing the matters, and the single process is the Agent Worker. Functionally, agents are mainly used for processing some public services in a pair, such as log generation, public transactions which need to be executed once, and the like, and works are mainly used for processing external requests.
In a possible embodiment, please refer to fig. 6, which is a schematic thread diagram of a function injection method according to an embodiment of the present disclosure. As shown in FIG. 6, the dynamic injection may be a trigger from a configuration of the agent, or may be a module message from the worker, triggering the dynamic injection event handling in app. Js in the worker, while index. Js in the worker may trigger the static injection event, both types of injection events will be transmitted to the loader through a specific module, such as the SPY module. Static injection is performed by a cold loading mode through a request or global function. Dynamic loading is divided into a clean mode and a dirty mode, and injection and rollback are performed through a method function. The Clean mode is by cold loading and the dirty mode is by hot loading. The functions that can be used for implementing in the cold loading mode include configuration reading, sequential loading modules (which may further include a cleaning module cache, a loading module, an allocation logger, a priority setting, a monitoring module event, a call onload, etc.), summary tangential points, summary add devices, etc., and the functions that can be used for implementing in the hot loading mode include updating tangential points, updating add devices, etc.
Fig. 7 is a schematic structural diagram of a function injection device according to an embodiment of the present disclosure. As shown in fig. 7, the document identification apparatus 1 may be implemented as all or part of an electronic device by software, hardware, or a combination of both. According to some embodiments, the certificate recognition device 1 comprises a positioning module 11, a node module 12 and an injection module 13, and specifically comprises:
The positioning module 11 is used for responding to an injection instruction in the process of starting a basic application, and positioning the injection module according to positioning parameters in the injection instruction, wherein the injection module refers to the basic application;
A node module 12 for determining an injection node for the injection module according to the injection instruction;
an injection module 13 for determining an injection function according to the injection instructions and executing the injection function at the injection node.
Optionally, the injection node in the node module 12 includes a pre-start stage or a post-run stage of the injection module, and the injection module 13 is specifically configured to:
determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal throwing function and a parameter return function;
And successfully executing the injection function at the injection node, returning parameters according to the parameter return function, and throwing an exception according to the exception throwing function parameter if the injection function is not successfully executed.
Optionally, the injection nodes in the node module 12 include a pre-start or a post-run phase of the injection module, and the injection module 13 is specifically configured to:
Determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal ejection function;
And based on the injection node being an abnormal stage of the injection module, casting an abnormality according to the abnormality casting function parameter.
Optionally, the positioning parameters in the injection instruction in the node module 12 include at least one of: source parameters, path parameters, or name parameters.
Optionally, the positioning parameters in the injection instruction in the node module 12 further include: a synchronicity parameter or a type parameter.
Optionally, the injection module 13 is further configured to: setting a flag bit in the injection function in the process of executing the injection function; sharing the zone bit to the basic application through the context; and in response to detecting the flag bit, jumping out of the injection function and calling the basic application.
Optionally, the positioning module 11 is further configured to: and starting a basic application, responding to an injection instruction, and executing the basic application according to the fact that the positioning parameters in the injection instruction are not positioned to the injection module.
Optionally, the injection instructions in the positioning module 11 include static injection instructions, and the injection module 13 is specifically configured to:
Determining an injection function according to the injection instruction, and executing the injection function at the injection node before the base application.
Optionally, the injection instructions in the positioning module 11 include dynamic injection instructions, and the injection module 13 is specifically configured to: determining an injection function according to the injection instruction, and executing the injection function at the injection node in the running process of the basic application through a debugging process.
Optionally, the injection module 13 is specifically further configured to: the injection function is executed at the injection node during the running of the base application by a debugging process.
Optionally, the injection module 13 is specifically further configured to: the injection function is executed by a debugging process at the injection node during running of the base application and upon restart of the base application.
The foregoing apparatus embodiments correspond to the method embodiments, and specific descriptions may be referred to descriptions of method embodiment portions, which are not repeated herein. The device embodiments are obtained based on corresponding method embodiments, and have the same technical effects as the corresponding method embodiments, and specific description can be found in the corresponding method embodiments.
The embodiment of the present disclosure further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are adapted to be loaded by a processor and execute the method according to the embodiment shown in fig. 1 to fig. 6, and a specific execution process may refer to a specific description of the embodiment shown in fig. 1 to fig. 6, which is not repeated herein.
The present disclosure further provides a computer program product, where at least one instruction is stored, where the at least one instruction is loaded by the processor and executed by the processor, where the specific execution process may refer to the specific description of the embodiment shown in fig. 1 to 6, and details are not repeated herein.
The embodiment of the specification also provides a schematic structural diagram of the electronic device shown in fig. 8. At the hardware level, as in fig. 8, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile storage, although other hardware required for the transaction is possible. The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to realize the voice activity detection method.
Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable GATE ARRAY, FPGA)) is an integrated circuit whose logic functions are determined by user programming of the device. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented with "logic compiler (logic compiler)" software, which is similar to the software compiler used in program development and writing, and the original code before being compiled is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but HDL is not just one, but a plurality of kinds, such as ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language), and VHDL (Very-High-SPEED INTEGRATED Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application SPECIFIC INTEGRATED Circuits (ASICs), programmable logic controllers, and embedded microcontrollers, examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (15)

1. A method of function injection, the method comprising:
Starting a basic application, responding to an injection instruction, and positioning an injection module according to positioning parameters in the injection instruction, wherein the injection module refers to the basic application;
Determining an injection node for the injection module according to the injection instruction;
determining an injection function according to the injection instruction, and executing the injection function at the injection node.
2. The method of claim 1, the injection node comprising a pre-start-up phase or a post-run phase of the injection module, the determining an injection function from the injection instructions and executing the injection function at the injection node comprising:
determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal throwing function and a parameter return function;
And successfully executing the injection function at the injection node, returning parameters according to the parameter return function, and throwing an exception according to the exception throwing function parameter if the injection function is not successfully executed.
3. The method of claim 1, the injection node comprising an anomaly phase of the injection module, the determining an injection function according to the injection instructions, and executing the injection function at the injection node comprising:
Determining an injection function according to the injection instruction, wherein the injection function comprises an abnormal ejection function;
And based on the injection node being an abnormal stage of the injection module, casting an abnormality according to the abnormality casting function parameter.
4. The method of claim 1, the location parameters in the injected instructions comprising at least one of:
source parameters, path parameters, or name parameters.
5. The method of claim 4, the positioning parameters further comprising a synchronicity parameter or a type parameter.
6. The method of claim 1, the method further comprising:
setting a flag bit in the injection function in the process of executing the injection function;
Sharing the zone bit to the basic application through the context;
And in response to detecting the flag bit, jumping out of the injection function and calling the basic application.
7. The method of claim 1, the method further comprising:
And starting a basic application, responding to an injection instruction, and executing the basic application according to the fact that the positioning parameters in the injection instruction are not positioned to the injection module.
8. The method of claim 1, the injection instructions comprising static injection instructions, the determining an injection function from the injection instructions and executing the injection function at the injection node, comprising:
Determining an injection function according to the injection instruction, and executing the injection function at the injection node before the base application.
9. The method of claim 1, the injection instructions comprising dynamic injection instructions, the determining an injection function from the injection instructions and executing the injection function at the injection node, comprising:
determining an injection function according to the injection instruction, and executing the injection function at the injection node in the running process of the basic application through a debugging process.
10. The method of claim 9, the executing, by a debugging process, the injection function at the injection node during the base application run, comprising:
the injection function is executed at the injection node during the running of the base application by a debugging process.
11. The method of claim 9, the executing, by a debugging process, the injection function at the injection node during the base application run, comprising:
The injection function is executed by a debugging process at the injection node during running of the base application and upon restart of the base application.
12. A function injection device, comprising:
The positioning module is used for responding to an injection instruction in the process of starting the basic application, positioning the injection module according to positioning parameters in the injection instruction, and introducing the injection module to the basic application;
The node module is used for determining an injection node aiming at the injection module according to the injection instruction;
and the injection module is used for determining an injection function according to the injection instruction and executing the injection function at the injection node.
13. A storage medium having stored thereon a computer program, which when executed by a processor performs the steps of the method according to any of claims 1 to 11.
14. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the steps of the method according to any one of claims 1-11.
15. A computer program product having stored thereon at least one instruction, which when executed by a processor, implements the steps of the method of any of claims 1 to 11.
CN202410203106.5A 2024-02-23 2024-02-23 Function injection method and device, storage medium and electronic equipment Pending CN118132168A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410203106.5A CN118132168A (en) 2024-02-23 2024-02-23 Function injection method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410203106.5A CN118132168A (en) 2024-02-23 2024-02-23 Function injection method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN118132168A true CN118132168A (en) 2024-06-04

Family

ID=91234806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410203106.5A Pending CN118132168A (en) 2024-02-23 2024-02-23 Function injection method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN118132168A (en)

Similar Documents

Publication Publication Date Title
CA3048742C (en) Blockchain-based consensus method and device
CN107392611B (en) Method and device for sending transaction information and consensus verification
CN109032825B (en) Fault injection method, device and equipment
CN108628688B (en) Message processing method, device and equipment
CN110401700B (en) Model loading method and system, control node and execution node
CN107066519B (en) Task detection method and device
CN103677978A (en) Method and electronic device for protecting processes
CN111897493B (en) Storage space management method and device, electronic equipment and storage medium
CN116610568A (en) Method, device, equipment and medium for identifying dependency relationship of codes
CN115185755A (en) Abnormity detection method and device, storage medium and electronic equipment
CN113254163B (en) Processing method and device of block chain data
CN107301097B (en) Method and device for storing calling java object and reference address information of java object
CN110647463B (en) Method and device for restoring test breakpoint and electronic equipment
CN112559565A (en) Abnormity detection method, system and device
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN111078435A (en) Service processing method and device and electronic equipment
CN113556260A (en) Flow monitoring method and device, storage medium and electronic equipment
CN113342376B (en) Method and device for upgrading operating system of Internet of things equipment
CN118132168A (en) Function injection method and device, storage medium and electronic equipment
CN110737524B (en) Task rule management method, device, equipment and medium
CN116108498A (en) Program execution method, program execution device, storage medium and electronic equipment
CN112907198B (en) Service state circulation maintenance method and device and electronic equipment
CN111796864A (en) Data verification method and device
CN108255667B (en) Service monitoring method and device and electronic equipment
CN110908792B (en) Data processing method and device

Legal Events

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