WO2020177429A1 - Method and apparatus for embedding codes in application, and electronic device - Google Patents

Method and apparatus for embedding codes in application, and electronic device Download PDF

Info

Publication number
WO2020177429A1
WO2020177429A1 PCT/CN2019/123871 CN2019123871W WO2020177429A1 WO 2020177429 A1 WO2020177429 A1 WO 2020177429A1 CN 2019123871 W CN2019123871 W CN 2019123871W WO 2020177429 A1 WO2020177429 A1 WO 2020177429A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
file
dynamic library
application
sdk
Prior art date
Application number
PCT/CN2019/123871
Other languages
French (fr)
Chinese (zh)
Inventor
汪德嘉
邵根波
钱潇龄
孟啸龙
Original Assignee
江苏通付盾信息安全技术有限公司
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 江苏通付盾信息安全技术有限公司 filed Critical 江苏通付盾信息安全技术有限公司
Publication of WO2020177429A1 publication Critical patent/WO2020177429A1/en
Priority to ZA2021/00858A priority Critical patent/ZA202100858B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Definitions

  • the present invention relates to the technical field of code integration, in particular to a method, device and electronic equipment for embedding codes in applications.
  • modifying the sequence number information of the location information of the original dynamic library in the code segment specifically includes:
  • the method further includes:
  • the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information;
  • the dynamic library loading information specifically includes at least one of the following: redirection information, static Binding information.
  • the method, device and electronic device for embedding code in an application include: integrating the SDK into the application, and embedding the loading information of the SDK in the dynamic library information list of the executable file of the application according to a preset loading sequence ; According to the file information of the SDK, modify the offset information and length information of the dynamic library loading information contained in the executable file; modify the loading sequence number information of the original dynamic library contained in the executable file and the code corresponding to the original dynamic library. The offset address information in the executable file is modified, and the serial number information of the original dynamic library location information in the code segment is modified; the updated application file is generated according to the modified executable file.
  • This method can separate the source code and embed the SDK according to the specified loading sequence for any application, so that the newly added SDK can dynamically call the SDK code according to the specified loading sequence at runtime, which has higher compatibility.
  • the embodiment of the present application provides a non-volatile computer storage medium, the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the method of embedding code in the application in any of the foregoing method embodiments .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

Disclosed are a method and apparatus for embedding codes in an application, and an electronic device. The method comprises: integrating an SDK into an application, and according to a pre-set loading sequence, embedding loading information of the SDK in a dynamic library information list of an executable file of the application; according to file information of the SDK, modifying offset information and length information of dynamic library loading information included in the executable file; modifying loading serial number information, of an original dynamic library, included in the executable file, and offset address information, in the executable file, of a code corresponding to the original dynamic library, and modifying serial number information of position information, of the original dynamic library, in a code segment; and generating an updated application file according to the modified executable file. The method can embed, without a source code, the SDK for any application according to a specified loading sequence, such that when the application to which the SDK is added runs, SDK codes can be dynamically called according to the specified loading sequence, and the compatibility thereof is higher.

Description

在应用中嵌入代码的方法、装置及电子设备Method, device and electronic equipment for embedding code in application 技术领域Technical field
本发明涉及代码集成技术领域,具体涉及一种在应用中嵌入代码的方法、装置及电子设备。The present invention relates to the technical field of code integration, in particular to a method, device and electronic equipment for embedding codes in applications.
背景技术Background technique
SDK(Software Development Kit,软件开发工具包)通常指软件工程师为特定的软件包、软件框架、硬件平台或者操作系统等建立应用软件时的开发工具的集合。技术人员在开发应用程序时,可以将SDK接入应用中,直接使用SDK提供的功能。因此,在应用中嵌入SDK有助于丰富应用程序的功能,满足用户多方面的需求。SDK (Software Development Kit, software development kit) usually refers to a collection of development tools used by software engineers to build application software for a specific software package, software framework, hardware platform, or operating system. When developing an application, a technician can connect the SDK to the application and directly use the functions provided by the SDK. Therefore, embedding the SDK in the application helps to enrich the functions of the application and meet the various needs of users.
现有技术(CN 107463359A)公开了一种在iOS ipa包中植入代码的便捷方法,具体地:(1)添加SDK的钩子脚本:在iOS工程源码中将钩子脚本加入到工程代码中,通过打包工具生成ipa(iPhone Application)发布包;(2)植入代码:将ipa包进行解压,将需要引入的代码编译成动态库,添加到Framework目录中;(3)重签名,并重新打包成新ipa;(4)动态调用,新ipa包运行时,通过钩子脚本与动态库动态衔接,调用植入代码的功能。该方式能够减少SDK接入的工作量。The prior art (CN 107463359A) discloses a convenient method for embedding code in the iOS ipa package. Specifically: (1) Adding the hook script of the SDK: Add the hook script to the project code in the iOS project source code. The packaging tool generates the ipa (iPhone Application) release package; (2) Implant code: decompress the ipa package, compile the code that needs to be imported into a dynamic library, and add it to the Framework directory; (3) Resign and repackage it into New ipa; (4) Dynamic call, when the new ipa package is running, it dynamically connects with the dynamic library through the hook script to call the function of the embedded code. This method can reduce the workload of SDK access.
然而,发明人在实现本发明的过程中发现现有技术存中缺乏一种能够根据指定的加载顺序嵌入SDK,使嵌入了SDK的应用在运行时能够按照该指定的加载顺序动态调用SDK代码的方案。However, in the process of implementing the present invention, the inventor found that the prior art lacks a way to embed the SDK according to the specified loading sequence, so that the application embedded with the SDK can dynamically call the SDK code according to the specified loading sequence at runtime. Program.
发明内容Summary of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种在应用中嵌入代码的方法、装置及电子设备。In view of the above problems, the present invention is proposed to provide a method, device and electronic device for embedding codes in applications that overcome the above problems or at least partially solve the above problems.
根据本发明的一个方面,提供了一种在应用中嵌入代码的方法,包括:According to one aspect of the present invention, there is provided a method for embedding code in an application, including:
将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信 息列表中嵌入SDK的加载信息;Integrate the SDK into the application, and embed the SDK loading information in the dynamic library information list of the executable file of the application according to the preset loading sequence;
根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;According to the SDK file information, modify the offset information and length information of the dynamic library loading information contained in the executable file;
对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改;Modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, and modify the sequence number information of the location information of the original dynamic library in the code segment;
根据已修改的可执行文件生成更新应用文件。Generate an update application file based on the modified executable file.
可选地,SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息;动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。Optionally, the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information; the dynamic library loading information specifically includes at least one of the following: redirection information, static Binding information.
可选地,对代码段中原始动态库的位置信息的序号信息进行修改具体包括:Optionally, modifying the sequence number information of the location information of the original dynamic library in the code segment specifically includes:
根据动态库的段落号信息以及偏移信息计算符号指针信息,根据符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, and determine the starting position information of the original dynamic library and call code position information according to the symbol pointer information;
对原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Modify the starting position information of the original dynamic library and the serial number information of the calling code position information.
可选地,SDK的加载信息具体包括以下中的至少一个:文件路径信息、名称信息。Optionally, the loading information of the SDK specifically includes at least one of the following: file path information and name information.
可选地,方法进一步包括:Optionally, the method further includes:
对更新应用文件进行重签名认证处理。Perform re-signature authentication processing on the updated application file.
可选地,方法应用于IOS应用,则方法执行之前,进一步包括:Optionally, if the method is applied to IOS applications, before the method is executed, it further includes:
将IOS应用的程序应用文件进行解压,提取IOS应用的可执行文件;Decompress the program application file of the IOS application and extract the executable file of the IOS application;
方法进一步包括:对更新应用文件进行重签名认证处理。The method further includes: performing re-signature authentication processing on the updated application file.
根据本发明的另一方面,提供了一种在应用中嵌入代码的装置,包括:According to another aspect of the present invention, there is provided a device for embedding code in an application, including:
集成模块,适于将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信息列表中嵌入SDK的加载信息;The integration module is suitable for integrating the SDK into the application, and embeds the loading information of the SDK in the dynamic library information list of the executable file of the application according to the preset loading sequence;
第一修改模块,适于根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;The first modification module is adapted to modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK;
第二修改模块,适于对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改;The second modification module is suitable for modifying the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, as well as the position of the original dynamic library in the code segment The serial number of the information is modified;
应用文件生成模块,适于根据已修改的可执行文件生成更新应用文件。The application file generating module is suitable for generating an updated application file according to the modified executable file.
可选地,SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息;动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。Optionally, the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information; the dynamic library loading information specifically includes at least one of the following: redirection information, static Binding information.
可选地,第二修改模块进一步适于:Optionally, the second modification module is further adapted to:
根据动态库的段落号信息以及偏移信息计算符号指针信息,根据符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, and determine the starting position information of the original dynamic library and call code position information according to the symbol pointer information;
对原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Modify the starting position information of the original dynamic library and the serial number information of the calling code position information.
可选地,SDK的加载信息具体包括以下中的至少一个:文件路径信息、名称信息。Optionally, the loading information of the SDK specifically includes at least one of the following: file path information and name information.
可选地,其中,装置进一步包括:Optionally, wherein, the device further includes:
提取模块,适于将IOS应用的程序应用文件进行解压,提取IOS应用的可执行文件;The extraction module is suitable for decompressing program application files of IOS applications and extracting executable files of IOS applications;
重签名模块,适于对更新应用文件进行重签名认证处理。The re-signature module is suitable for performing re-signature authentication processing on the updated application file.
根据本发明的又一方面,提供了一种电子设备,包括:处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;According to another aspect of the present invention, there is provided an electronic device, including: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete mutual communication through the communication bus. Communication
所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行上述在应用中嵌入代码的方法对应的操作。The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform the operation corresponding to the method of embedding code in the application.
根据本发明的再一方面,提供了一种计算机存储介质,所述存储介质中存储有至少一可执行指令,所述可执行指令使处理器执行如上述在应用中嵌入代码的方法对应的操作。According to another aspect of the present invention, a computer storage medium is provided, the storage medium stores at least one executable instruction, and the executable instruction causes a processor to perform operations corresponding to the above method of embedding code in an application. .
根据本发明提供的在应用中嵌入代码的方法、装置及电子设备,方法包括:将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信息列 表中嵌入SDK的加载信息;根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改;根据已修改的可执行文件生成更新应用文件。该方式能够脱离源码针对任一应用按照指定的加载顺序嵌入SDK,使得新添加了SDK的应用在运行时能够按照指定的加载顺序动态调用SDK代码,兼容性更高。The method, device and electronic device for embedding code in an application according to the present invention include: integrating the SDK into the application, and embedding the loading information of the SDK in the dynamic library information list of the executable file of the application according to a preset loading sequence ; According to the file information of the SDK, modify the offset information and length information of the dynamic library loading information contained in the executable file; modify the loading sequence number information of the original dynamic library contained in the executable file and the code corresponding to the original dynamic library. The offset address information in the executable file is modified, and the serial number information of the original dynamic library location information in the code segment is modified; the updated application file is generated according to the modified executable file. This method can separate the source code and embed the SDK according to the specified loading sequence for any application, so that the newly added SDK can dynamically call the SDK code according to the specified loading sequence at runtime, which has higher compatibility.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented in accordance with the content of the description, and in order to make the above and other objectives, features and advantages of the present invention more obvious and understandable. In the following, specific embodiments of the present invention are specifically cited.
附图说明Description of the drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only used for the purpose of illustrating the preferred embodiments, and are not considered as a limitation to the present invention. Also, throughout the drawings, the same reference symbols are used to denote the same components. In the attached picture:
图1示出了根据本发明一个实施例的在应用中嵌入代码的方法的流程示意图;Fig. 1 shows a schematic flowchart of a method for embedding code in an application according to an embodiment of the present invention;
图2示出了根据本发明另一个实施例的在应用中嵌入代码的方法的流程示意图;FIG. 2 shows a schematic flowchart of a method for embedding code in an application according to another embodiment of the present invention;
图3示出了根据本发明另一个实施例的在应用中嵌入代码的装置的结构示意图;Figure 3 shows a schematic structural diagram of an apparatus for embedding codes in an application according to another embodiment of the present invention;
图4示出了根据本发明实施例的一种电子设备的结构示意图。Fig. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
图1示出了根据本发明一个实施例的在应用中嵌入代码的方法的流程示意图,如图1所示,该方法包括:Fig. 1 shows a schematic flow chart of a method for embedding code in an application according to an embodiment of the present invention. As shown in Fig. 1, the method includes:
步骤S101,将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信息列表中嵌入SDK的加载信息。In step S101, the SDK is integrated into the application, and the loading information of the SDK is embedded in the dynamic library information list of the executable file of the application according to the preset loading sequence.
将SDK集成到应用中,在应用的可执行文件的加载命令中查找动态库信息列表,根据预设加载顺序,在动态库信息列表中插入SDK的加载信息,例如SDK的文件路径和名称等等。其中,预设加载顺序也就是嵌入的代码的运行顺序,例如可以让嵌入的代码最先运行或者按照其他指定的顺序运行,本领域技术人员可以根据实际需要对预设加载顺序进行设置。Integrate the SDK into the application, find the dynamic library information list in the loading command of the application executable file, and insert the SDK loading information in the dynamic library information list according to the preset loading sequence, such as the file path and name of the SDK, etc. . Among them, the preset loading sequence is the running sequence of the embedded code. For example, the embedded code can be run first or in other specified sequences. Those skilled in the art can set the preset loading sequence according to actual needs.
步骤S102,根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改。Step S102: Modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK.
首先,读取可执行文件中的动态库加载信息,例如重定向信息、静态绑定信息等等;然后,根据嵌入的SDK的文件信息,例如动态库名称、文件存放路径、文件大小信息以及结构信息等,修改动态库加载信息的偏移量和长度。First, read the dynamic library loading information in the executable file, such as redirection information, static binding information, etc.; then, according to the embedded SDK file information, such as the dynamic library name, file storage path, file size information, and structure Information, etc., modify the offset and length of the dynamic library loading information.
步骤S103,对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改。Step S103: Modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, and modify the sequence number information of the location information of the original dynamic library in the code segment to modify.
由于新添加了SDK,需要修改可执行文件中的动态库绑定信息,具体修改原始动态库的加载序号信息和原始动态库对应的代码在文件中的偏移地址信息。同时,还需要修改代码段中原始动态库的位置信息的序号。Due to the newly added SDK, it is necessary to modify the dynamic library binding information in the executable file, specifically modify the loading sequence number information of the original dynamic library and the offset address information of the code corresponding to the original dynamic library in the file. At the same time, it is also necessary to modify the serial number of the original dynamic library location information in the code segment.
步骤S104,根据已修改的可执行文件生成更新应用文件。Step S104: Generate an update application file according to the modified executable file.
利用已修改的可执行文件对原始可执行文件进行替换,并根据已修改的可执行文件重新打包生成更新应用文件。在后续过程中,启动该更新应用时,根据已修改的动态库信息列表,新添加的SDK会按照上述预设加载顺序植入的代码。Use the modified executable file to replace the original executable file, and repackage the modified executable file to generate an updated application file. In the subsequent process, when starting the update application, according to the modified dynamic library information list, the newly added SDK will implant the code according to the aforementioned preset loading sequence.
根据本实施例所提供的在应用中嵌入代码,首先将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信息列表中嵌入SDK的加载信息;然后,根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;其次,对可执行文件包含的原始动态库的加载序 号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改;最后根据已修改的可执行文件生成更新应用文件。该方式能够脱离源码针对任一应用按照指定的加载顺序嵌入SDK,使得新添加了SDK的应用运行时能够按照指定的加载顺序动态调用SDK代码,兼容性更高。According to the embedding code in the application provided by this embodiment, the SDK is first integrated into the application, and the loading information of the SDK is embedded in the dynamic library information list of the executable file of the application according to the preset loading sequence; then, according to the SDK file Information, modify the offset information and length information of the dynamic library loading information contained in the executable file; secondly, modify the loading sequence number information of the original dynamic library contained in the executable file and the code corresponding to the original dynamic library in the executable file Modify the offset address information of the code segment, and modify the serial number information of the original dynamic library location information in the code segment; finally, generate an updated application file based on the modified executable file. This method can separate the source code and embed the SDK according to the specified loading sequence for any application, so that the newly added SDK can dynamically call the SDK code according to the specified loading sequence during runtime, which has higher compatibility.
图2示出了根据本发明另一个实施例的在应用中嵌入代码的方法的流程示意图,本实施例中以IOS应用为例进行说明,如图2所示,该方法包括:Fig. 2 shows a schematic flow chart of a method for embedding code in an application according to another embodiment of the present invention. In this embodiment, an IOS application is taken as an example for description. As shown in Fig. 2, the method includes:
步骤S201,将IOS应用的程序应用文件进行解压,提取IOS应用的可执行文件,将SDK集成到应用中。Step S201: Decompress the program application file of the IOS application, extract the executable file of the IOS application, and integrate the SDK into the application.
将IOS应用的ipa安装包进行解压,提取Mach-o文件(可执行文件),并将SDK集成在应用中。Decompress the ipa installation package of the IOS application, extract the Mach-o file (executable file), and integrate the SDK into the application.
步骤S202,按照预设加载顺序在应用的可执行文件的动态库信息列表中嵌入SDK的加载信息。Step S202: Embed the SDK loading information in the dynamic library information list of the executable file of the application according to the preset loading sequence.
将SDK集成到应用中,在应用的可执行文件的加载命令中查找动态库信息列表,根据预设加载顺序,在动态库信息列表中插入SDK的加载信息,例如SDK的文件路径和名称等等。其中,预设加载顺序也就是嵌入的代码的运行顺序,例如可以让嵌入的代码最先运行或者按照其他指定的顺序运行,本领域技术人员可以根据实际需要对预设加载顺序进行设置。Integrate the SDK into the application, find the dynamic library information list in the loading command of the application executable file, and insert the SDK loading information in the dynamic library information list according to the preset loading sequence, such as the file path and name of the SDK, etc. . Among them, the preset loading sequence is the running sequence of the embedded code. For example, the embedded code can be run first or in other specified sequences. Those skilled in the art can set the preset loading sequence according to actual needs.
需要特别指出的是:现有技术将SDK插入到系统库之后,由于优先加载了系统库以及应用本身的所添加的第三方库,可能会导致新添加的SDK部分功能不能正常加载而导致闪退。因此,现有技术中缺乏一种能够优先加载新添加的SDK的技术方案。本实施例所提供的方法能够使新添加的SDK按照任意的加载顺序加载,其中,当预设加载顺序具体为首位加载顺序(即最先加载)时,就能够解决上述因系统库以及应用本身所添加的第三方库优先加载导致的错误崩溃问题。It is important to point out that after the existing technology inserts the SDK into the system library, due to the priority loading of the system library and the added third-party library of the application itself, some functions of the newly added SDK may not be loaded normally and cause a crash. . Therefore, the prior art lacks a technical solution that can preferentially load the newly added SDK. The method provided in this embodiment enables the newly added SDK to be loaded in an arbitrary loading sequence. When the preset loading sequence is specifically the first loading sequence (that is, the first loading), the above-mentioned system library and the application itself can be solved. Errors and crashes caused by priority loading of the added third-party libraries.
具体地,在可执行文件的加载命令中查找动态库信息的列表,按照预设加载顺序,在动态库信息的列表中插入SDK的加载信息,其中,SDK的加载信息包括以下中的至少一个:文件路径信息、名称信息。Specifically, the list of dynamic library information is searched in the load command of the executable file, and the SDK loading information is inserted in the list of dynamic library information according to the preset loading sequence, where the SDK loading information includes at least one of the following: File path information, name information.
步骤S203,根据SDK的文件信息,对可执行文件包含的动态库加载信息的 偏移量信息和长度信息进行修改。Step S203: Modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK.
读取可执行文件中的动态库加载信息,然后,根据SDK的文件信息,修改动态加载信息的偏移量信息和长度信息,其中,动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息。Read the dynamic library loading information in the executable file, and then modify the offset information and length information of the dynamic loading information according to the SDK file information, where the dynamic library loading information specifically includes at least one of the following: redirection information , Static binding information. The file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information.
以添加PayegisSharkIV.framework为例,其中通过文件路径“@executable_path/Frameworks/PayegisSharkIV.framework/PayegisSharkIV”计算可得加载命令中增加的偏移长度为96,通过遍历重定向信息和静态绑定信息表中OPCODE和IMMEDIATE的值,可得重定向信息表增加为0,静态绑定信息表增加长度为6,补齐0位后得到增加长度为16。Take the addition of PayegisSharkIV.framework as an example, where the offset length added in the load command can be calculated as 96 through the file path "@executable_path/Frameworks/PayegisSharkIV.framework/PayegisSharkIV", which is calculated by traversing the redirection information and the static binding information table The OPCODE and IMMEDIATE values can be increased to 0 for the redirection information table, 6 for the static binding information table, and 16 for the added length after adding 0 bits.
步骤S204,对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改。Step S204: Modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file.
遍历可执行文件中的动态库绑定信息,由于新添加了SDK,需要修改原始动态库的加载序号和原始动态库对应的代码在可执行文件中的偏移地址。Traverse the dynamic library binding information in the executable file. Due to the newly added SDK, it is necessary to modify the loading sequence number of the original dynamic library and the offset address of the code corresponding to the original dynamic library in the executable file.
以预设加载顺序为首位加载顺序为例,简单地来讲,原始动态库共有10个,序号分别为1、2、3……10,在所有原始动态库之前加入SDK对应的动态库,那么新添加的动态库的序号为1,原始动态库的序号依次修改为2、3、4……11,同时,还需要对原始动态库对应的代码在可执行文件中的偏移地址进行修改。Take the default loading sequence as the first loading sequence as an example. Simply put, there are 10 original dynamic libraries, with serial numbers 1, 2, 3...10. Add the SDK corresponding dynamic library before all the original dynamic libraries, then The serial number of the newly added dynamic library is 1, and the serial number of the original dynamic library is sequentially modified to 2, 3, 4...11. At the same time, the offset address of the code corresponding to the original dynamic library in the executable file needs to be modified.
步骤S205,根据动态库的段落号信息以及偏移信息计算符号指针信息,根据符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;对原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Step S205: Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, determine the starting position information and calling code position information of the original dynamic library according to the symbol pointer information; check the starting position information and calling code of the original dynamic library The serial number information of the location information is modified.
根据动态库的段落号信息以及偏移信息计算出的符号指针信息,可以得到代码段下原始动态库的起始位置信息以及调用代码位置信息,然后对原始动态库的起始位置信息以及调用代码位置信息的序号进行修改。According to the symbol pointer information calculated from the paragraph number information and offset information of the dynamic library, the starting position information of the original dynamic library and the calling code position information under the code segment can be obtained, and then the starting position information and the calling code of the original dynamic library can be obtained. The serial number of the location information is modified.
步骤S206,根据已修改的可执行文件生成更新应用文件,对更新应用文件进行重签名认证处理。Step S206: Generate an updated application file according to the modified executable file, and perform re-signature authentication processing on the updated application file.
将已修改的可执行文件对原始可执行文件进行替换,并根据已修改的可执行文件重新打包生成更新应用文件,使用重签名工具进行重新签名认证。在后续过程中,启动该更新应用时,根据已修改的动态库信息的列表,添加的SDK 会按照预设加载顺序调植入的代码。The modified executable file is replaced with the original executable file, and the modified executable file is repackaged to generate an updated application file, and the resignature tool is used for resignature authentication. In the subsequent process, when the update application is started, the added SDK will adjust the embedded code according to the preset loading order according to the list of modified dynamic library information.
由此可知,本实施例的方法可总结为以下几个处理阶段:(1)解压提取阶段。(2)可执行文件修改处理阶段,具体修改可执行文件的加载信息以及绑定信息等。(3)重打包阶段,具体用已修改的可执行文件替换原始可执行文件生成新的应用文件,并对新的应用文件进行重签名形成新的ipa包。It can be seen that the method of this embodiment can be summarized into the following processing stages: (1) Decompression and extraction stage. (2) Executable file modification processing stage, specifically modifying the loading information and binding information of the executable file. (3) In the repackaging stage, the modified executable file is used to replace the original executable file to generate a new application file, and the new application file is resigned to form a new ipa package.
由此可知,根据本实施例的方法能够脱离源码,针对任一应用按照指定的加载顺序嵌入SDK,例如安全组件(签名校验、二次打包检测、越狱检测、防注入等)、动态监控租金、调试模块等等,使得应用运行时能够按照指定的加载顺序调用SDK代码,应用场景广。其中当指预设加载顺序为首位加载顺序时,还能够解决现有技术中存在的SDK插入系统库以后,由于其他库信息被优先加载而导致新添加的SDK出现错误甚至崩溃,兼容性更好。It can be seen that the method according to this embodiment can break away from the source code, and embed the SDK in a specified loading sequence for any application, such as security components (signature verification, secondary packaging detection, jailbreak detection, anti-injection, etc.), dynamic rent monitoring , Debugging module, etc., so that the SDK code can be called according to the specified loading sequence when the application is running, and the application scenarios are wide. When referring to the preset loading sequence as the first loading sequence, it can also solve the problem that after the existing SDK is inserted into the system library, because other library information is loaded first, the newly added SDK has errors or even crashes, and the compatibility is better. .
图3示出了根据本发明另一个实施例的在应用中嵌入代码的装置的结构示意图,如图3所示,该装置包括:集成模块、第一修改模块、第二修改模块以及应用文件生成模块。Fig. 3 shows a schematic structural diagram of a device for embedding code in an application according to another embodiment of the present invention. As shown in Fig. 3, the device includes: an integration module, a first modification module, a second modification module, and application file generation Module.
其中,集成模块31,适于将SDK集成到应用中,按照预设加载顺序在应用的可执行文件的动态库信息列表中嵌入SDK的加载信息;Wherein, the integration module 31 is suitable for integrating the SDK into the application, and embeds the loading information of the SDK in the dynamic library information list of the executable file of the application according to a preset loading sequence;
第一修改模块32,适于根据SDK的文件信息,对可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;The first modification module 32 is adapted to modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK;
第二修改模块33,适于对可执行文件包含的原始动态库的加载序号信息和原始动态库对应的代码在可执行文件中的偏移地址信息进行修改,以及对代码段中原始动态库的位置信息的序号信息进行修改;The second modification module 33 is adapted to modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, and modify the original dynamic library in the code segment. Modify the serial number information of the location information;
应用文件生成模块34,适于根据已修改的可执行文件生成更新应用文件。The application file generating module 34 is adapted to generate an updated application file according to the modified executable file.
在一种可选的方式中,SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息;动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。In an optional manner, the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information; the dynamic library loading information specifically includes at least one of the following: Redirection information, static binding information.
在一种可选的方式中,第二修改模块32进一步适于:In an optional manner, the second modification module 32 is further adapted to:
根据动态库的段落号信息以及偏移信息计算符号指针信息,根据符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, and determine the starting position information of the original dynamic library and call code position information according to the symbol pointer information;
对原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Modify the starting position information of the original dynamic library and the serial number information of the calling code position information.
在一种可选的方式中,SDK的加载信息具体包括以下中的至少一个:文件路径信息、名称信息。In an optional manner, the loading information of the SDK specifically includes at least one of the following: file path information and name information.
在一种可选的方式中,上述在应用中嵌入代码的装置进一步包括:In an optional manner, the above device for embedding code in an application further includes:
提取模块,适于将IOS应用的程序应用文件进行解压,提取IOS应用的可执行文件;The extraction module is suitable for decompressing program application files of IOS applications and extracting executable files of IOS applications;
重签名模块,适于对更新应用文件进行重签名认证处理。The re-signature module is suitable for performing re-signature authentication processing on the updated application file.
上述各个模块的具体结构和工作原理可参照方法实施例中相应步骤的描述,此处不再赘述。For the specific structure and working principle of each of the above modules, please refer to the description of the corresponding steps in the method embodiment, which will not be repeated here.
本申请实施例提供了一种非易失性计算机存储介质,所述计算机存储介质存储有至少一可执行指令,该计算机可执行指令可执行上述任意方法实施例中的在应用中嵌入代码的方法。The embodiment of the present application provides a non-volatile computer storage medium, the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the method of embedding code in the application in any of the foregoing method embodiments .
图4示出了根据本发明实施例的一种电子设备的结构示意图,本发明具体实施例并不对电子设备的具体实现做限定。FIG. 4 shows a schematic structural diagram of an electronic device according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the electronic device.
如图4所示,该电子设备可以包括:处理器(processor)402、通信接口(Communications Interface)404、存储器(memory)406、以及通信总线408。As shown in FIG. 4, the electronic device may include: a processor (processor) 402, a communication interface (Communications Interface) 404, a memory (memory) 406, and a communication bus 408.
其中:among them:
处理器402、通信接口404、以及存储器406通过通信总线408完成相互间的通信。The processor 402, the communication interface 404, and the memory 406 communicate with each other through the communication bus 408.
通信接口404,用于与其它设备比如客户端或其它服务器等的网元通信。The communication interface 404 is used to communicate with network elements of other devices, such as clients or other servers.
处理器402,用于执行程序410,具体可以执行上述在应用中嵌入代码的方法实施例中的相关步骤。The processor 402 is configured to execute the program 410, and specifically can execute relevant steps in the above-mentioned method for embedding code in an application.
具体地,程序410可以包括程序代码,该程序代码包括计算机操作指令。Specifically, the program 410 may include program code, and the program code includes computer operation instructions.
处理器402可能是中央处理器CPU,或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。电子设备包括的一个或多个处理器,可以是同一类型的处理器,如一个或多个CPU;也可以是不同类型的处理器,如一个或多个CPU以及一个或多 个ASIC。The processor 402 may be a central processing unit CPU, or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be the same type of processor, such as one or more CPUs, or different types of processors, such as one or more CPUs and one or more ASICs.
存储器406,用于存放程序410。存储器406可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
程序410具体可以用于使得处理器402执行上述任意方法实施例中的在应用中嵌入代码的方法。程序410中各步骤的具体实现可以参见上述在应用中嵌入代码的方法实施例中的相应步骤和单元中对应的描述,在此不赘述。The program 410 may be specifically used to make the processor 402 execute the method of embedding code in an application in any of the foregoing method embodiments. For the specific implementation of each step in the program 410, reference may be made to the corresponding description in the corresponding steps and units in the above-mentioned method of embedding code in the application, which is not repeated here.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays provided here are not inherently related to any particular computer, virtual system or other equipment. Various general-purpose systems can also be used with the teaching based on this. From the above description, the structure required to construct this type of system is obvious. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of a specific language is to disclose the best embodiment of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the instructions provided here, a lot of specific details are explained. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and technologies are not shown in detail, so as not to obscure the understanding of this specification.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be understood that in order to simplify the present disclosure and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, Figure, or its description. However, the disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those explicitly stated in each claim. More precisely, as reflected in the following claims, the inventive aspect lies in less than all the features of a single embodiment disclosed previously. Therefore, the claims following the specific embodiment are thus explicitly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有 过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that it is possible to adaptively change the modules in the device in the embodiment and set them in one or more devices different from the embodiment. The modules or units or components in the embodiments can be combined into one module or unit or component, and in addition, they can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and/or processes or units are mutually exclusive, any combination can be used to compare all features disclosed in this specification (including the accompanying claims, abstract and drawings) and any method or methods disclosed in this manner or All the processes or units of the equipment are combined. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。In addition, those skilled in the art can understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments means that they are within the scope of the present invention. Within and form different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的电子设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented by hardware, or by software modules running on one or more processors, or by their combination. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the electronic device according to the embodiments of the present invention. The present invention can also be implemented as a device or device program (for example, a computer program and a computer program product) for executing part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may have the form of one or more signals. Such signals can be downloaded from Internet websites, or provided on carrier signals, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate the present invention rather than limit the present invention, and those skilled in the art can design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of multiple such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. do not indicate any order. These words can be interpreted as names.

Claims (12)

  1. 一种在应用中嵌入代码的方法,包括:A method of embedding code in an application, including:
    将SDK集成到应用中,按照预设加载顺序在所述应用的可执行文件的动态库信息列表中嵌入所述SDK的加载信息;Integrating the SDK into the application, and embedding the loading information of the SDK in the dynamic library information list of the executable file of the application according to a preset loading sequence;
    根据所述SDK的文件信息,对所述可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;Modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK;
    对所述可执行文件包含的原始动态库的加载序号信息和所述原始动态库对应的代码在所述可执行文件中的偏移地址信息进行修改,以及对代码段中所述原始动态库的位置信息的序号信息进行修改;Modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, and modify the original dynamic library information in the code segment Modify the serial number information of the location information;
    根据已修改的可执行文件生成更新应用文件。Generate an update application file based on the modified executable file.
  2. 根据权利要求1所述的方法,其中,所述SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息;所述动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。The method according to claim 1, wherein the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information; the dynamic library loading information specifically includes At least one of the following: redirection information, static binding information.
  3. 根据权利要求1所述的方法,其中,所述对代码段中所述原始动态库的位置信息的序号信息进行修改具体包括:The method according to claim 1, wherein said modifying the sequence number information of the location information of the original dynamic library in the code segment specifically comprises:
    根据动态库的段落号信息以及偏移信息计算符号指针信息,根据所述符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, and determine the starting position information of the original dynamic library and the calling code position information according to the symbol pointer information;
    对所述原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Modify the starting position information of the original dynamic library and the sequence number information of the calling code position information.
  4. 根据权利要求1所述的方法,其中,所述SDK的加载信息具体包括以下中的至少一个:文件路径信息、名称信息。The method according to claim 1, wherein the loading information of the SDK specifically includes at least one of the following: file path information and name information.
  5. 根据权利要求1-4中任一项所述的方法,其中,所述方法应用于IOS应用,则所述方法执行之前,进一步包括:The method according to any one of claims 1 to 4, wherein the method is applied to an IOS application, before the method is executed, further comprising:
    将IOS应用的程序应用文件进行解压,提取所述IOS应用的可执行文件;所述方法进一步包括:对所述更新应用文件进行重签名认证处理。The program application file of the IOS application is decompressed, and the executable file of the IOS application is extracted; the method further includes: performing re-signature authentication processing on the updated application file.
  6. 一种在应用中嵌入代码的装置,包括:A device for embedding code in an application, including:
    集成模块,适于将SDK集成到应用中,按照预设加载顺序在所述应用的可执行文件的动态库信息列表中嵌入所述SDK的加载信息;The integration module is adapted to integrate the SDK into the application, and embed the SDK loading information in the dynamic library information list of the executable file of the application according to a preset loading sequence;
    第一修改模块,适于根据所述SDK的文件信息,对所述可执行文件包含的动态库加载信息的偏移量信息和长度信息进行修改;The first modification module is adapted to modify the offset information and length information of the dynamic library loading information contained in the executable file according to the file information of the SDK;
    第二修改模块,适于对所述可执行文件包含的原始动态库的加载序号信息和所述原始动态库对应的代码在所述可执行文件中的偏移地址信息进行修改,以及对代码段中所述原始动态库的位置信息的序号信息进行修改;The second modification module is adapted to modify the loading sequence number information of the original dynamic library contained in the executable file and the offset address information of the code corresponding to the original dynamic library in the executable file, and modify the code segment Modify the serial number information of the location information of the original dynamic library;
    应用文件生成模块,适于根据已修改的可执行文件生成更新应用文件。The application file generating module is suitable for generating an updated application file according to the modified executable file.
  7. 根据权利要求6所述的装置,其中,所述SDK的文件信息具体包括以下中的至少一个:动态库名称信息、文件存放路径信息、文件大小信息、结构信息;所述动态库加载信息具体包括以下中的至少一个:重定向信息、静态绑定信息。The device according to claim 6, wherein the file information of the SDK specifically includes at least one of the following: dynamic library name information, file storage path information, file size information, and structure information; the dynamic library loading information specifically includes At least one of the following: redirection information, static binding information.
  8. 根据权利要求6所述的装置,其中,所述第二修改模块进一步适于:The device according to claim 6, wherein the second modification module is further adapted to:
    根据动态库的段落号信息以及偏移信息计算符号指针信息,根据所述符号指针信息确定原始动态库的起始位置信息以及调用代码位置信息;Calculate symbol pointer information according to the paragraph number information and offset information of the dynamic library, and determine the starting position information of the original dynamic library and the calling code position information according to the symbol pointer information;
    对所述原始动态库的起始位置信息以及调用代码位置信息的序号信息进行修改。Modify the starting position information of the original dynamic library and the sequence number information of the calling code position information.
  9. 根据权利要求6所述的装置,其中,所述SDK的加载信息具体包括以下中的至少一个:文件路径信息、名称信息。The device according to claim 6, wherein the loading information of the SDK specifically includes at least one of the following: file path information and name information.
  10. 根据权利要求6-9中任一项所述的装置,其中,所述装置进一步包括:The device according to any one of claims 6-9, wherein the device further comprises:
    提取模块,适于将IOS应用的程序应用文件进行解压,提取所述IOS应用的可执行文件;The extraction module is adapted to decompress the program application file of the IOS application and extract the executable file of the IOS application;
    重签名模块,适于对所述更新应用文件进行重签名认证处理。The re-signature module is adapted to perform re-signature authentication processing on the updated application file.
  11. 一种电子设备,包括:处理器、存储器、通信接口和通信总线,所述处理器、所述存储器和所述通信接口通过所述通信总线完成相互间的通信;An electronic device, comprising: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus;
    所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如权利要求1-5中任一项所述的在应用中嵌入代码的方法对应的操作。The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform an operation corresponding to the method for embedding code in an application according to any one of claims 1-5.
  12. 一种计算机存储介质,所述存储介质中存储有至少一可执行指令,所述 可执行指令使处理器执行如权利要求1-5中任一项所述的在应用中嵌入代码的方法对应的操作。A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to execute the method for embedding code in an application according to any one of claims 1-5. operating.
PCT/CN2019/123871 2019-03-07 2019-12-09 Method and apparatus for embedding codes in application, and electronic device WO2020177429A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
ZA2021/00858A ZA202100858B (en) 2019-03-07 2021-02-08 A method and apparatus for embedding codes in an application, and an electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910173264.X 2019-03-07
CN201910173264.XA CN109933350B (en) 2019-03-07 2019-03-07 Method and device for embedding codes in application and electronic equipment

Publications (1)

Publication Number Publication Date
WO2020177429A1 true WO2020177429A1 (en) 2020-09-10

Family

ID=66986651

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/123871 WO2020177429A1 (en) 2019-03-07 2019-12-09 Method and apparatus for embedding codes in application, and electronic device

Country Status (3)

Country Link
CN (1) CN109933350B (en)
WO (1) WO2020177429A1 (en)
ZA (1) ZA202100858B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109933350B (en) * 2019-03-07 2021-07-16 江苏通付盾信息安全技术有限公司 Method and device for embedding codes in application and electronic equipment
CN110750545B (en) * 2019-09-03 2023-07-25 抖音视界有限公司 Dynamic library heat updating method, device, medium and equipment
CN110674474B (en) * 2019-09-19 2021-07-20 大唐高鸿信安(浙江)信息科技有限公司 Operation control method and device for application program
US20230102816A1 (en) * 2021-09-30 2023-03-30 Vmware, Inc. Automatic updating of application functionality
CN114237742B (en) * 2021-12-10 2023-09-01 北京奇艺世纪科技有限公司 Method, device, terminal and storage medium for loading and compiling dynamic library

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511935A (en) * 2015-12-09 2016-04-20 网易(杭州)网络有限公司 Resource index value acquiring method and device
US20160132547A1 (en) * 2014-11-11 2016-05-12 SEWORKS, Inc. Apparatus and method for managing apk file in an android platform
CN108595187A (en) * 2018-03-27 2018-09-28 北京美好人生伙伴信息技术有限公司 Method, device and the storage medium of Android installation kit integrated software development kit
CN109933350A (en) * 2019-03-07 2019-06-25 江苏通付盾信息安全技术有限公司 The method, apparatus and electronic equipment of embedded code in the application

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727345B (en) * 2008-10-29 2013-09-04 国际商业机器公司 Method and system for controlling loading state of dynamic link library DLL
CN105094878B (en) * 2014-05-22 2019-02-22 阿里巴巴集团控股有限公司 A kind of method and apparatus of integrated system library file
CN107305495A (en) * 2016-04-19 2017-10-31 华为技术有限公司 Realize the method and terminal of software installation packet function modification
CN107463359A (en) * 2016-06-02 2017-12-12 深圳市慧动创想科技有限公司 A kind of convenient method in iOS ipa bag code implants
CN109376087A (en) * 2018-10-22 2019-02-22 北京奇艺世纪科技有限公司 A kind of method for testing software, device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160132547A1 (en) * 2014-11-11 2016-05-12 SEWORKS, Inc. Apparatus and method for managing apk file in an android platform
CN105511935A (en) * 2015-12-09 2016-04-20 网易(杭州)网络有限公司 Resource index value acquiring method and device
CN108595187A (en) * 2018-03-27 2018-09-28 北京美好人生伙伴信息技术有限公司 Method, device and the storage medium of Android installation kit integrated software development kit
CN109933350A (en) * 2019-03-07 2019-06-25 江苏通付盾信息安全技术有限公司 The method, apparatus and electronic equipment of embedded code in the application

Also Published As

Publication number Publication date
ZA202100858B (en) 2023-11-29
CN109933350A (en) 2019-06-25
CN109933350B (en) 2021-07-16

Similar Documents

Publication Publication Date Title
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
JP6912583B2 (en) Service processing method and equipment
JP6746156B2 (en) Software repackaging prevention method and apparatus
WO2016177341A1 (en) Interface calling method and device, and terminal
US9678767B2 (en) Unified extensible firmware interface (UEFI) driver and protocol
CN110113391B (en) Client online method and device and client operation method and device
CN109934016B (en) Application signature verification method and device and electronic equipment
KR102141749B1 (en) APP program execution method and device
WO2020233044A1 (en) Plug-in verification method and device, and server and computer-readable storage medium
CN111797270A (en) Audio playing method and device, electronic equipment and computer readable storage medium
WO2020044093A1 (en) Application program programming interface calling method and apparatus therefor
CN111045746A (en) Code expansion method and framework
CN106203087B (en) Injection protection method, system, terminal and storage medium
CN114169311A (en) Data analysis method and device
LU102412B1 (en) A Method and Apparatus for Embedding Codes in an Application, and an Electronic Device
CN111475220B (en) Cold start method and device, electronic equipment and computer storage medium
CN108959915B (en) Rootkit detection method, rootkit detection device and server
CN112068814A (en) Method, device, system and medium for generating executable file
CN107315951B (en) Program installation package anti-interception method and device
US10726109B2 (en) Method and system for identifying whether an application is genuine by means of digital watermarks
AU2019387658B2 (en) Information creation device, information creation method, and information creation program
WO2023103890A1 (en) Capacity expansion method and apparatus, and electronic device
CN112015394B (en) Android function module development method and device, computer system and storage medium
CN108932263B (en) Associated object tracking method and device
CN115705289A (en) Test method, mock frame, user equipment, service equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19917781

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19917781

Country of ref document: EP

Kind code of ref document: A1