TWI530874B - Method and apparatus for generating application installation packages and running applications - Google Patents

Method and apparatus for generating application installation packages and running applications Download PDF

Info

Publication number
TWI530874B
TWI530874B TW103126982A TW103126982A TWI530874B TW I530874 B TWI530874 B TW I530874B TW 103126982 A TW103126982 A TW 103126982A TW 103126982 A TW103126982 A TW 103126982A TW I530874 B TWI530874 B TW I530874B
Authority
TW
Taiwan
Prior art keywords
application
code
file
executable file
function
Prior art date
Application number
TW103126982A
Other languages
Chinese (zh)
Other versions
TW201516871A (en
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 TW201516871A publication Critical patent/TW201516871A/en
Application granted granted Critical
Publication of TWI530874B publication Critical patent/TWI530874B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/14Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Storage Device Security (AREA)

Description

生成應用程式安裝封包、執行應用程式的方法及裝置 Method and device for generating application installation package and executing application

本發明係關係於一種生成應用程式安裝封包、執行應用程式的方法及裝置。 The present invention relates to a method and apparatus for generating an application installation package and executing an application.

隨著Android操作系統以及應用技術的發展,在Android操作系統中出現了各類應用以滿足用戶的各種需求。在開發應用的過程中,為了防止應用程式安裝封包中的檔案被修改,並重新打包發佈的惡意行為,需要提供一種對應用的安裝封包中檔案的代碼進行保護的方法。 With the development of the Android operating system and application technology, various applications have appeared in the Android operating system to meet various needs of users. In the process of developing the application, in order to prevent the files in the application installation package from being modified and repackaging the malicious behavior of the distribution, it is necessary to provide a method for protecting the code of the file in the installation package of the application.

現有技術中,提供了一種代碼混淆的方式來保護應用的安裝封包中檔案的代碼,其原理是將代碼中類信息名稱、函式名稱、變量名稱修改為不易看懂的與原名稱不相同的代號,以增加其他開發人員理解該應用的代碼的難度,以達到保護應用的安裝檔案的代碼的效果。例如將某函式名為display(),將安裝檔案的代碼中所有該函式名修改為D(),此時其他開發人員無法通過該函式名確定該函式的具體意義。 In the prior art, a code obfuscation method is provided to protect the code of the file in the installation package of the application, and the principle is to modify the class information name, the function name, and the variable name in the code to be incomprehensible and different from the original name. Codename to increase the difficulty of other developers to understand the code of the application to achieve the effect of protecting the code of the application's installation file. For example, if a function is called display(), all the functions in the code of the installation file are changed to D(). At this time, other developers cannot determine the specific meaning of the function through the function name.

在執行本發明的過程中,發明人發現現有技術至 少存在以下問題:通過代碼混淆的方式,僅是增加了識別代碼的難度,無法保護該應用的安裝封包中檔案的代碼的邏輯和數據,因此應用程式安裝封包中的檔案還會有被修改的可能。 In the process of carrying out the invention, the inventors discovered that the prior art There are few problems: the confusion of code is only the difficulty of identifying the code, the logic and data of the code in the installation package of the application cannot be protected, so the file in the application installation package will be modified. may.

為了解決現有技術的問題,本發明實施例提供了一種生成應用程式安裝封包、執行應用程式的方法及裝置。所述技術方案如下:一方面,提供了一種生成應用程式安裝封包的方法,所述方法包括:通過對應用程式安裝封包解壓縮處理,獲取所述應用程式安裝封包中包含有所述應用的邏輯的可執行檔以及除所述可執行檔以外的第一檔案;在所述可執行檔的代碼中,修改執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行加密;將所述第一檔案,修改後的所述可執行檔以及預設的動態連結程式庫,重新打包生成所述應用對應的應用程式安裝封包,其中所述動態連結程式庫用於還原執行所述應用邏輯的函式對應的宣告類型,並對執行所述應用邏輯的函式對應的代碼進行解密。 In order to solve the problem of the prior art, an embodiment of the present invention provides a method and an apparatus for generating an application installation package and executing an application. The technical solution is as follows: In one aspect, a method for generating an application installation package is provided, the method comprising: obtaining, by using an application package decompression process, a logic that includes the application in the application installation package. An executable file and a first file other than the executable file; in the code of the executable file, modifying a declaration type of a function executing the application logic, and executing a function of the application logic Corresponding code is encrypted; the first file, the modified executable file, and the preset dynamic link library are repackaged to generate an application installation package corresponding to the application, wherein the dynamic link library And a method for restoring a declaration type corresponding to a function executing the application logic, and decrypting a code corresponding to a function executing the application logic.

另一方面,提供了一種執行應用程式的方法,所述方法包括:在系統運行應用程式安裝封包時,獲取所述應用程式安裝封包中的包含有所述應用的邏輯的可執行檔,除所 述可執行檔以外的第一檔案以及預設的動態連結程式庫;調用所述動態連結程式庫,在所述可執行檔的代碼中還原執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行解密;根據所述第一檔案,修改後的所述可執行檔執行所述應用。 In another aspect, a method for executing an application is provided, the method comprising: acquiring, when the system runs an application installation package, an executable file of the application installation package that includes logic of the application, Determining a first file other than the executable file and a preset dynamic link library; calling the dynamic link library, restoring the type of the declaration of the function executing the application logic in the code of the executable file, and Executing a code corresponding to a function of the application logic to perform decryption; and according to the first file, the modified executable file executes the application.

另一方面,提供了一種生成應用程式安裝封包的裝置,所述裝置包括:第一獲取模塊,用於通過對應用程式安裝封包解壓縮處理,獲取所述應用程式安裝封包中包含有所述應用的邏輯的可執行檔以及除所述可執行檔以外的第一檔案;第一修改模塊,用於在所述可執行檔的代碼中,修改執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行加密;打包模塊,用於將所述第一檔案,修改後的所述可執行檔以及預設的動態連結程式庫,重新打包生成所述應用對應的應用程式安裝封包,其中所述動態連結程式庫用於還原執行所述應用邏輯的函式對應的宣告類型,並對執行所述應用邏輯的函式對應的代碼進行解密。 In another aspect, an apparatus for generating an application installation package is provided, the apparatus comprising: a first acquisition module, configured to obtain, by using an application installation package decompression process, the application installation package to include the application a logical executable file and a first file other than the executable file; a first modifying module, configured to modify, in code of the executable file, a type of declaration of a function executing the application logic, and Encrypting the code corresponding to the function of the application logic; the packaging module, configured to repackage the first file, the modified executable file, and the preset dynamic link library to generate the application Corresponding application installation package, wherein the dynamic link library is used to restore the declaration type corresponding to the function executing the application logic, and decrypt the code corresponding to the function executing the application logic.

另一方面,提供了一種執行應用程式的裝置,所述裝置包括:第三獲取模塊,用於在系統運行應用程式安裝封包時,獲取所述應用程式安裝封包中的包含有所述應用的邏輯的可執行檔,除所述可執行檔以外的第一檔案以及預設的動態連結程式庫;第二修改模塊,用於調用所述動態連結程式庫, 在所述可執行檔的代碼中還原執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行解密;執行模塊,用於根據所述第一檔案,修改後的所述可執行檔執行所述應用。 In another aspect, an apparatus for executing an application is provided, the apparatus comprising: a third obtaining module, configured to acquire, when the system runs an application installation package, the logic that includes the application in the application installation package The executable file, the first file except the executable file and the preset dynamic link library; the second modification module is configured to invoke the dynamic link library, Reducing, in the code of the executable file, a declaration type of a function executing the application logic, and decrypting a code corresponding to a function executing the application logic; and executing an module, according to the first file, The modified executable file executes the application.

本發明實施例提供的技術方案帶來的有益效果是:通過修改應用程式安裝封包中包含有應用的邏輯的可執行檔執行應用程式邏輯的函式的宣告類型並加密該函式對應的代碼,以重新生成該應用程式安裝封包。可以隱藏應用程式安裝封包中的執行該應用的邏輯,無法被其他人員修改,提高了應用的安全性。 The technical solution provided by the embodiment of the present invention has the beneficial effects of: executing the declaration type of the function of the application logic by modifying the executable file of the application containing the logic of the application in the package installation package, and encrypting the code corresponding to the function, To regenerate the application to install the package. The logic for executing the application in the application installation package can be hidden and cannot be modified by other people, which improves the security of the application.

為讓本發明之上述和其他目的、特徵和優點能更明顯易懂,下文特舉較佳實施例,並配合所附圖式,作詳細說明如下。 The above and other objects, features and advantages of the present invention will become more <RTIgt;

101~103‧‧‧步驟 101~103‧‧‧Steps

201~205‧‧‧步驟 201~205‧‧‧Steps

2021~2025‧‧‧步驟 2021~2025‧‧‧Steps

2041~2043‧‧‧步驟 2041~2043‧‧‧Steps

301~303‧‧‧步驟 301~303‧‧‧Steps

401~403‧‧‧步驟 401~403‧‧‧Steps

4021~4027‧‧‧步驟 4021~4027‧‧‧Steps

501‧‧‧第一獲取模塊 501‧‧‧First acquisition module

502‧‧‧第一修改模塊 502‧‧‧First Modification Module

503‧‧‧打包模塊 503‧‧‧Packing module

504‧‧‧第二獲取模塊 504‧‧‧Second acquisition module

505‧‧‧添加模塊 505‧‧‧Add module

601‧‧‧第三獲取模塊 601‧‧‧ third acquisition module

602‧‧‧第二修改模塊 602‧‧‧Second Modification Module

603‧‧‧執行模塊 603‧‧‧Execution module

圖1是本發明之第一實施例的生成應用程式安裝封包的方法流程圖;圖2是本發明之第二實施例的生成應用程式安裝封包的方法流程圖;圖3是本發明之第三實施例的執行應用程式的方法流程圖;圖4是本發明之第四實施例的執行應用程式的方法流程圖;圖5是本發明之第五實施例的生成應用程式安裝封包的 裝置結構示意圖;圖6是本發明之第六實施例的執行應用程式的裝置結構示意圖。 1 is a flow chart of a method for generating an application installation package according to a first embodiment of the present invention; FIG. 2 is a flow chart of a method for generating an application installation package according to a second embodiment of the present invention; FIG. 3 is a third embodiment of the present invention; FIG. 4 is a flowchart of a method for executing an application according to a fourth embodiment of the present invention; FIG. 5 is a flowchart for generating an application installation package according to a fifth embodiment of the present invention; FIG. 6 is a schematic structural diagram of an apparatus for executing an application according to a sixth embodiment of the present invention.

有關本發明之前述及其他技術內容、特點與功效,在以下配合參考圖式之一較佳實施例的詳細說明中,將可清楚的呈現。以下實施例中所提到的方向用語,例如:上、下、左、右、前或後等,僅是參考附加圖式的方向。因此,使用的方向用語是用來說明並非用來限制本發明。 The above and other technical contents, features and advantages of the present invention will be apparent from the following detailed description of the preferred embodiments. The directional terms mentioned in the following embodiments, such as up, down, left, right, front or back, etc., are only directions referring to the additional drawings. Therefore, the directional terminology used is for the purpose of illustration and not limitation.

為了使本發明的目的、技術方案及優點更加清楚明白,以下結合附圖及實施例,對本發明進行進一步詳細說明。應當理解,此處所描述的具體實施例僅僅用以解釋本發明,並不用於限定本發明。 The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

在本發明實施例中所述的網路支付方法及相關設備、系統,能夠簡化支付操作,提高網路支付效率,以及確保支付安全性。以下分別進行詳細說明。 The network payment method and related device and system described in the embodiments of the present invention can simplify payment operations, improve network payment efficiency, and ensure payment security. The details are described below separately.

參見圖1,本發明之第一實施例的生成應用程式安裝封包的方法流程圖;該方法流程包括以下步驟:101:通過對應用程式安裝封包解壓縮處理,獲取應用程式安裝封包中包含有應用的邏輯的可執行檔以及除可執行檔以外的第一檔案;102:在可執行檔的代碼中,修改執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行加密;103:將第一檔案,修改後的可執行檔以及預設 的動態連結程式庫,重新打包生成應用對應的應用程式安裝封包,其中動態連結程式庫用於還原執行應用程式邏輯的函式對應的宣告類型,並對執行應用程式邏輯的函式對應的代碼進行解密。 1 is a flowchart of a method for generating an application installation package according to a first embodiment of the present invention; the method process includes the following steps: 101: obtaining an application installation package by using an application package decompression process Logic executable file and a first file other than the executable file; 102: in the code of the executable file, modifying the declaration type of the function executing the application logic, and corresponding to the function executing the application logic The code is encrypted; 103: the first file, the modified executable file and the preset The dynamic link library is repackaged to generate an application installation package corresponding to the application, wherein the dynamic link library is used to restore the declaration type corresponding to the function executing the application logic, and the code corresponding to the function executing the application logic is performed. Decrypt.

本發明實施例通過修改應用程式安裝封包中包含有應用的邏輯的可執行檔執行應用程式邏輯的函式的宣告類型並加密該函式對應的代碼,以重新生成該應用程式安裝封包。可以隱藏應用程式安裝封包中的執行該應用的邏輯,無法被其他人員修改,提高了應用的安全性。 The embodiment of the present invention regenerates the application installation package by modifying the declaration type of the function of the application logic by modifying the executable file of the application containing the logic of the application and encrypting the code corresponding to the function. The logic for executing the application in the application installation package can be hidden and cannot be modified by other people, which improves the security of the application.

參見圖2,本發明之第二實施例的生成應用程式安裝封包的方法流程圖;該方法流程包括以下步驟: Referring to FIG. 2, a flowchart of a method for generating an application installation package according to a second embodiment of the present invention; the method flow includes the following steps:

201:通過對應用程式安裝封包解壓縮處理,獲取應用程式安裝封包中包含有應用的邏輯的可執行檔以及除可執行檔以外的第一檔案。 201: Obtain an executable file containing the logic of the application in the application installation package and a first file other than the executable file by decapsulating the application installation package.

其中,Android應用的安裝封包通常是使用ZIP壓縮檔案格式,因此可以按照正常ZIP解壓縮處理方式對該應用的安裝封包進行解壓縮,得到應用程式安裝封包中的各種檔案。 The installation package of the Android application usually uses the ZIP compression file format, so the installation package of the application can be decompressed according to the normal ZIP decompression processing method, and various files in the application installation package are obtained.

其中,應用程式安裝封包中的檔案中必須要包含符合Android規定的必要檔案,還可以包含通過其他程式語言(例如:C++程式語言)編寫的動態連結程式庫檔案。Android應用主要由JAVA程式語言來進行編寫,但是由於JAVA程式語言不能夠完成一些與系統結合的功能,因此提供了通過其他語言來執行的方案,並通過Native方法進行宣告,用以宣告該方法不是JAVA程式語言執行,並需要調用動態連結程式庫檔案來調用加載動態連結程式庫對應的方法。 Among them, the files in the application installation package must contain the necessary files that meet the Android rules, and can also include dynamic link library files written in other programming languages (for example, C++ programming language). Android applications are mainly written by the JAVA programming language, but because the JAVA programming language can not complete some functions combined with the system, it provides a solution implemented by other languages, and is declared by the Native method to declare that the method is not The JAVA programming language executes and needs to call the dynamic link library file to call the method corresponding to loading the dynamic link library.

202:在可執行檔的代碼中,修改執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行加密。 202: In the code of the executable file, modify the declaration type of the function that executes the application logic, and encrypt the code corresponding to the function that executes the application logic.

其中,對於修改函式的宣告類型,需要預先根據不同類型的應用會對應設置不同的需要修改的函式列表。例如:對於通信類應用,則選取通信類的函式作為該類應用對應設置的需要修改的函式列表中的函式。 For the declaration type of the modification function, it is necessary to set different function lists to be modified according to different types of applications in advance. For example, for a communication application, the function of the communication class is selected as a function in the function list that needs to be modified correspondingly set by the application.

其中,步驟202可以包括下列步驟: Wherein, step 202 can include the following steps:

2021:反編譯可執行檔,得到可執行檔的代碼。 2021: Decompile the executable file to get the code for the executable file.

其中,可執行檔為安裝封包中的classes.dex檔案。 Among them, the executable file is the classes.dex file in the installation package.

2022:在可執行檔的代碼中,將執行應用程式邏輯的函式的宣告類型修改為調用動態連結程式庫中函式的宣告類型。 2022: In the code of the executable file, the declaration type of the function executing the application logic is modified to call the declaration type of the function in the dynamic link library.

其中,為了保護應用的安裝封包中檔案的代碼不被其他開發人員修改,本發明實施例通過將應用中執行應用程式邏輯的函式進行重新宣告並加密,以使其他開發人員無法識別並修改代碼。在本發明實施例中,通過方法步驟202的方式將宣告類型被修改後,該應用如果再被其他開發人員修改並重新打包後,是無法根據該修改後的宣告類型找到對應的函式,因此無法正常被系統執行。 In order to protect the code of the archive in the installation package of the application from being modified by other developers, the embodiment of the present invention re-advertises and encrypts the function of executing the application logic in the application, so that other developers cannot identify and modify the code. . In the embodiment of the present invention, after the announcement type is modified by the method step 202, if the application is modified and repackaged by other developers, the corresponding function cannot be found according to the modified announcement type. Cannot be executed by the system normally.

其中,修改宣告類型的方式為:將正常的JAVA中函式對應的宣告類型修改為Native方法對應的宣告類型,其中Native方法對應的宣告類型即為調用動態連結程式庫中的函式對應的宣告類型。 The manner of modifying the declaration type is: modifying the declaration type corresponding to the function in the normal JAVA to the declaration type corresponding to the Native method, wherein the declaration type corresponding to the Native method is the declaration corresponding to the function in the dynamic link library. Types of.

舉例說明:在類HelloWorld中有一個函式 displayHello World。 For example: there is a function in the class HelloWorld displayHello World.

原始宣告為:(public void displayHello World);修改為:(public native void displayHello World)。 The original declaration is: (public void displayHello World); modified to: (public native void displayHello World).

如果該應用的安裝檔案中的代碼被修改後,無法進行還原正確的宣告類型時,系統則會根據Native方法去查找對應的動態連結程式庫檔案,而在無法找到並加載動態連結程式庫時,則會無法正常運行該應用。 If the code in the installation file of the application is modified and the correct declaration type cannot be restored, the system will search for the corresponding dynamic link library file according to the Native method, and when the dynamic link library cannot be found and loaded, The app will not run properly.

2023:根據預設的加密算法,將執行應用程式邏輯的函式對應的代碼進行加密。 2023: Encrypt the code corresponding to the function executing the application logic according to a preset encryption algorithm.

2024:記錄被修改的執行應用程式邏輯的函式對應的宣告類型的位置信息,並將位置信息存儲於可執行檔的代碼中的預設存儲位置。 2024: Record the location information of the declared type corresponding to the function of the modified execution application logic, and store the location information in a preset storage location in the code of the executable file.

對於步驟2022中修改的函式的修改位置進行記錄並保存為位置信息,其中修改位置可以為在代碼中的行數,該位置信息並不進行限定。保存了位置信息後,將該位置信息存儲於代碼的預設存儲位置,以在執行該應用時通過查找位置信息進行宣告類型的還原。 The modified position of the function modified in step 2022 is recorded and saved as position information, wherein the modified position may be the number of lines in the code, and the position information is not limited. After the location information is saved, the location information is stored in a preset storage location of the code to restore the announcement type by searching for the location information when the application is executed.

2025:編譯可執行檔的代碼生成被修改的可執行檔,此為重新生成修改後的classes.dex的步驟。 2025: The code that compiles the executable file generates the modified executable file, which is the step of regenerating the modified classes.dex.

203:獲取第一檔案中的安裝配置檔案。 203: Obtain an installation configuration file in the first file.

204:在安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼。 204: Add the code for calling the preset dynamic link library in the preset field of the installation configuration file.

其中,步驟204中添加的動態連結程式庫對應的檔案,在本發明實施例中以使執行應用程式時預先調用動態連結程式庫還原函式對應的宣告類型並對函式對應的代碼進行解密。 The file corresponding to the dynamic link library added in step 204 is used in the embodiment of the present invention to pre-call the declaration type corresponding to the dynamic link library restore function and decrypt the code corresponding to the function.

其中,步驟204中在安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼的過程,可以具體為: The process of adding the code of the preset dynamic link library in the preset field of the installation configuration file in step 204 may be specifically as follows:

2041:判斷安裝配置檔案中是否存在有預設字段。 2041: Determine whether there is a preset field in the installation configuration file.

其中,判斷是否存在預設字段,即為在AndroidManifest.xml(安裝配置檔案)檔案中查找是否存在application節,以及在該字段中是否存在android:name屬性字段。 Wherein, it is determined whether there is a preset field, that is, whether the application section exists in the AndroidManifest.xml (installation configuration file) file, and whether the android:name attribute field exists in the field.

2042:如果存在預設字段,則在預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼。 2042: If there is a preset field, the code that calls the preset dynamic link library is added to the class information specified in the preset field.

其中,安裝配置信息中的預設字段是應用在被執行在Android操作系統中的運行入口,該預設字段中設置的內容會在應用執行時首先被調用,因此將調用預設的動態連結程式庫的代碼加入指定的類信息中,該動態連結程式庫也會在應用執行時會被首先調用的該指定的類信息中進行調用。 The preset field in the installation configuration information is an operation entry that is executed in the Android operating system, and the content set in the preset field is first called when the application is executed, so the preset dynamic link program is called. The code of the library is added to the specified class information, and the dynamic link library is also called in the specified class information that is first called when the application is executed.

2043:如果未存在預設字段,則在安裝配置檔案中指定位置添加入預設字段並預設字段中加入指定的類信息,在預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼。 2043: If the preset field does not exist, add the specified field in the specified location in the installation configuration file and add the specified class information in the preset field, and add the dynamic of the calling preset to the class information specified in the preset field. The code to link the library.

205:將第一檔案,修改後的可執行檔以及預設的動態連結程式庫,重新打包生成應用對應的應用程式安裝封包。 205: Repackage the first file, the modified executable file, and the preset dynamic link library to generate an application installation package corresponding to the application.

其中動態連結程式庫用於還原執行應用程式邏輯的函式對應的宣告類型,並對執行應用程式邏輯的函式對應的代碼進行解密。 The dynamic link library is used to restore the declaration type corresponding to the function executing the application logic, and decrypt the code corresponding to the function executing the application logic.

將修改後的classes.dex檔案、AndroidManifest.xml、添加的動態連結程式庫對應的檔案以及其他未修改的檔案重新打包生成該應用的應用程式安裝封包。 The modified classes.dex file, AndroidManifest.xml, the files corresponding to the added dynamic link library, and other unmodified files are repackaged to generate the application installation package of the application.

本發明實施例通過修改應用程式安裝封包中包含有應用的邏輯的可執行檔執行應用程式邏輯的函式的宣告類型並加密該函式對應的代碼,以重新生成該應用程式安裝封包。可以隱藏應用程式安裝封包中的執行該應用的邏輯,無法被其他人員修改,提高了應用的安全性。 The embodiment of the present invention regenerates the application installation package by modifying the declaration type of the function of the application logic by modifying the executable file of the application containing the logic of the application and encrypting the code corresponding to the function. The logic for executing the application in the application installation package can be hidden and cannot be modified by other people, which improves the security of the application.

參見圖3,本發明之第三實施例的執行應用程式的方法流程圖,該方法流程包括以下步驟:301:在系統運行應用程式安裝封包時,獲取應用程式安裝封包中的包含有應用的邏輯的可執行檔,除可執行檔以外的第一檔案以及預設的動態連結程式庫;302:調用動態連結程式庫,在可執行檔的代碼中還原執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行解密;303:根據第一檔案,修改後的可執行檔執行應用程式。 Referring to FIG. 3, a flowchart of a method for executing an application according to a third embodiment of the present invention includes the following steps: 301: Obtaining an application-containing logic in an application installation package when the system runs an application installation package. The executable file, the first file except the executable file and the preset dynamic link library; 302: calling the dynamic link library, and restoring the declaration type of the function executing the application logic in the code of the executable file, And decrypting the code corresponding to the function executing the application logic; 303: executing the application according to the modified file in the first file.

本發明實施例執行重新打包的應用程式安裝封包時,通過預設的動態連結程式庫將原有被修改過宣告類型的包含有應用的邏輯的可執行檔執行應用程式邏輯的函式進行還原,並進行解密還原出原始的應用程式安裝封包,以執行經過安全加密的應用,提高了應用的安全性。 When the repackaged application installation package is executed, the embodiment of the present invention restores the function of executing the application logic of the executable file containing the application logic by using the preset dynamic link library. And decrypting and restoring the original application installation package to execute the securely encrypted application, improving the security of the application.

參見圖4,本發明之第四實施例的執行應用程式的方法流程圖,該方法流程包括以下步驟: Referring to FIG. 4, a flowchart of a method for executing an application according to a fourth embodiment of the present invention includes the following steps:

401:在系統運行應用程式安裝封包時,獲取應用程式安裝封包中的包含有應用的邏輯的可執行檔,除可執行檔以外的第一檔案以及預設的動態連結程式庫。 401: When the system runs the application installation package, obtain an executable file containing the logic of the application in the application installation package, and the first file other than the executable file and the preset dynamic link library.

402:調用動態連結程式庫,在可執行檔的代碼中還原執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行解密。 402: Calling the dynamic link library, restoring the declaration type of the function executing the application logic in the code of the executable file, and decrypting the code corresponding to the function executing the application logic.

其中,步驟402中調用動態連結程式庫的過程包括以下步驟: The process of calling the dynamic link library in step 402 includes the following steps:

4021:在第一檔案中獲取安裝配置檔案,並根據安裝配置檔案中預設字段中的內容調用指定的類信息。 4021: Obtain the installation configuration file in the first file, and invoke the specified class information according to the content in the preset field in the installation configuration file.

在執行應用程式時,會根據應用程式安裝封包中的安裝配置檔案中預先配置的內容來執行該應用。 When the application is executed, the application is executed based on the pre-configured content in the installation configuration file in the application installation package.

在該應用程式安裝封包中的安裝配置檔案的預設字段中已經設置了指定的類信息,因此在執行應用程式時,會首先調用該指定的類信息。 The specified class information has been set in the preset field of the installation configuration file in the application installation package, so the specified class information is first called when the application is executed.

其中,安裝配置檔案中的預設字段中設置的內容,用於在應用執行時首先被調用,因此會首先調用類信息。 The content set in the preset field in the installation configuration file is used to be called first when the application is executed, so the class information is first called.

4022:根據類信息中預先添加的調用預設的動態連結程式庫的代碼,調用動態連結程式庫。 4022: Call the dynamic link library according to the code of the dynamic link library preset in the class information.

由於在生成該引用安裝封包時,在安裝配置檔案中已經添加入了調用預設的動態連結程式庫的代碼,因此在調用指定的類信息時,則會執行調用預設的動態連結程式庫的代碼,從而調用了該動態連結程式庫。 Since the code for calling the preset dynamic link library has been added to the installation configuration file when the reference installation package is generated, when the specified class information is called, the preset dynamic link library is called. The code, thus calling the dynamic link library.

其中,調用預設的動態連結程式庫的代碼中會有該動態連結程式庫對應的檔案的保存路徑,因此會根據該路徑找到該動態連結程式庫對應的檔案並進行調用。 The code that calls the preset dynamic link library has a save path of the file corresponding to the dynamic link library, so the file corresponding to the dynamic link library is found and called according to the path.

該動態連結程式庫用於在步驟402中還原執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行解密。其中,該過程即為實施例二中步驟202對應的反向執行過程,通過還原函式對應的宣告類型,並對加密的函式對應的代碼進行解密得到正確的應用的可執行檔。 The dynamic link library is used to restore the declaration type of the function executing the application logic in step 402, and decrypt the code corresponding to the function executing the application logic. The process is the reverse execution process corresponding to step 202 in the second embodiment. The type of the declaration corresponding to the function is restored, and the code corresponding to the encrypted function is decrypted to obtain the executable file of the correct application.

其中,步驟402中還原執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行解密的過程具體為: The process of restoring the declaration type of the function executing the application logic in step 402 and decrypting the code corresponding to the function executing the application logic is as follows:

4023:反編譯可執行檔,得到可執行檔的代碼,該可執行檔為claesses.dex檔案。 4023: Decompile the executable file to get the code of the executable file, which is the claesses.dex file.

4024:在可執行檔的代碼中的預設存儲位置,查找到被修改的執行應用程式邏輯的函式對應的宣告類型的位置信息; 4024: In the preset storage location in the code of the executable file, find the location information of the declaration type corresponding to the function of the modified execution application logic;

4025:根據位置信息查找到被修改的執行應用程式邏輯的函式,並將函式對應的宣告類型修改為調用JAVA函式的宣告類型。 4025: Find the function of the executed execution application logic according to the location information, and modify the declaration type corresponding to the function to the declaration type of the JAVA function.

4026:根據預設的解密算法,將執行應用程式邏輯的函式對應的代碼進行解密。 4026: Decrypt the code corresponding to the function executing the application logic according to a preset decryption algorithm.

4027:編譯被修改的可執行檔的代碼重新生成修改後的可執行檔。 4027: Compile the code of the modified executable file to regenerate the modified executable file.

403:根據第一檔案,修改後的可執行檔執行應用程式。在步驟402執行完畢後,該應用程式安裝封包中的可執行檔classes.dex已經被還原為初始未被修改的內容,因此可以通過該可執行檔以及該應用程式安裝封包中其他的檔案正常的執行該應用。 403: Execute the application according to the modified file in the first file. After the execution of step 402, the executable file classes.dex in the application installation package has been restored to the original unmodified content, so that the executable file and other files in the application installation package are normal. Execute the app.

本發明實施例執行重新打包的應用程式安裝封包時,通過預設的動態連結程式庫將原有被修改過宣告類型的包含有應用的邏輯的可執行檔執行應用程式邏輯的函式進行還原,並進行解密還原出原始的應用程式安裝封包,以執行經過安全加密的應用,提高了應用的安全性。 When the repackaged application installation package is executed, the embodiment of the present invention restores the function of executing the application logic of the executable file containing the application logic by using the preset dynamic link library. And decrypting and restoring the original application installation package to execute the securely encrypted application, improving the security of the application.

參見圖5,本發明之第五實施例的生成應用程式安裝封包的裝置結構示意圖。該裝置包括:第一獲取模塊501,用於通過對應用程式安裝封包解壓縮處理,獲取應用程式安裝封包中包含有應用的邏輯的可執行檔以及除可執行檔以外的第一檔案;第一修改模塊502,用於在可執行檔的代碼中,修改執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行加密;打包模塊503,用於將第一檔案,修改後的可執行檔以及預設的動態連結程式庫,重新打包生成應用對應的應用程式安裝封包,其中動態連結程式庫用於還原執行應用程式邏輯的函式對應的宣告類型,並對執行應用程式邏輯的函式對應的代碼進行解密。 Referring to FIG. 5, a schematic structural diagram of an apparatus for generating an application installation package according to a fifth embodiment of the present invention is shown. The device includes: a first obtaining module 501, configured to obtain, by using an application installation package decompression process, an executable file that includes logic of the application in the application installation package and a first file other than the executable file; The modifying module 502 is configured to: in the code of the executable file, modify the declaration type of the function that executes the application logic, and encrypt the code corresponding to the function that executes the application logic; the packaging module 503 is configured to be the first The file, the modified executable file, and the preset dynamic link library are repackaged to generate an application installation package corresponding to the application, wherein the dynamic link library is used to restore the declaration type corresponding to the function executing the application logic, and The code corresponding to the function executing the application logic is decrypted.

該第一修改模塊502,包括:第一反編譯單元,用於反編譯可執行檔,得到可執行檔的代碼;第一修改單元,用於在可執行檔的代碼中,將執行應用程式邏輯的函式的宣告類型修改為調用動態連結程式庫中函式的宣告類型;加密單元,用於根據預設的加密算法,將執行應用程式邏輯的函式對應的代碼進行加密;存儲單元,用於記錄被修改的執行應用程式邏輯的函式對應的宣告類型的位置信息,並將位置信息存儲於可執行檔的代碼中的預設存儲位置;第一編譯單元,用於編譯可執行檔的代碼生成被修改的可執行檔。 The first modification module 502 includes: a first decompilation unit, configured to decompile the executable file, to obtain code of the executable file; and a first modification unit, configured to execute the application logic in the code of the executable file The declaration type of the function is modified to call the declaration type of the function in the dynamic link library; the encryption unit is configured to encrypt the code corresponding to the function executing the application logic according to the preset encryption algorithm; Recording the location information of the declaration type corresponding to the function of the modified execution application logic, and storing the location information in a preset storage location in the code of the executable file; the first compilation unit is configured to compile the executable file The code generates a modified executable file.

其中,該裝置還包括:第二獲取模塊504,用於 獲取第一檔案中的安裝配置檔案;添加模塊505,用於在安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼。 The device further includes: a second obtaining module 504, configured to: Obtaining the installation configuration file in the first file; the adding module 505 is configured to add a code for calling the preset dynamic link library in the preset field of the installation configuration file.

其中,添加模塊505,包括:判斷單元,用於判斷安裝配置檔案中是否存在有預設字段;第一添加單元,用於如果存在預設字段,則在預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼;第二添加單元,用於如果未存在預設字段,則在安裝配置檔案中指定位置添加入預設字段並預設字段中加入指定的類信息,在預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼。 The adding module 505 includes: a determining unit, configured to determine whether a preset field exists in the installation configuration file; and a first adding unit, if the preset field exists, adding in the class information specified in the preset field Enter the code of the preset dynamic link library; the second add unit is used to add the preset field to the preset field in the installation configuration file and add the specified class information to the preset field if the preset field does not exist, Add the code that calls the default dynamic link library to the class information specified in the preset field.

本發明實施例通過修改應用程式安裝封包中包含有應用的邏輯的可執行檔執行應用程式邏輯的函式的宣告類型並加密該函式對應的代碼,以重新生成該應用程式安裝封包。可以隱藏應用程式安裝封包中的執行該應用的邏輯,無法被其他人員修改,提高了應用的安全性。 The embodiment of the present invention regenerates the application installation package by modifying the declaration type of the function of the application logic by modifying the executable file of the application containing the logic of the application and encrypting the code corresponding to the function. The logic for executing the application in the application installation package can be hidden and cannot be modified by other people, which improves the security of the application.

參見圖6,圖6是本發明之第六實施例的執行應用程式的裝置結構示意圖。該裝置包括:第三獲取模塊601,用於在系統運行應用程式安裝封包時,獲取應用程式安裝封包中的包含有應用的邏輯的可執行檔,除可執行檔以外的第一檔案以及預設的動態連結程式庫;第二修改模塊602,用於調用動態連結程式庫,在可執行檔的代碼中還原執行應用程式邏輯的函式的宣告類型,並將執行應用程式邏輯的函式對應的代碼進行解密;執行模塊603,用於根據第一檔案,修改後的可執行檔執行應用程式。 Referring to FIG. 6, FIG. 6 is a schematic structural diagram of an apparatus for executing an application according to a sixth embodiment of the present invention. The device includes: a third obtaining module 601, configured to acquire, when the system runs the application installation package, an executable file containing the logic of the application in the application installation package, the first file and the preset other than the executable file The dynamic link library; the second modification module 602 is configured to invoke the dynamic link library, restore the declaration type of the function executing the application logic in the code of the executable file, and corresponding to the function of executing the application logic The code is decrypted; the executing module 603 is configured to execute the application according to the modified file of the first file.

其中,第二修改模塊602,包括:第一調用單元,用於在第一檔案中獲取安裝配置檔案,並根據安裝配置檔案 中預設字段中的內容調用指定的類信息;第二調用單元,用於根據類信息中預先添加的調用預設的動態連結程式庫的代碼,調用動態連結程式庫。 The second modification module 602 includes: a first calling unit, configured to obtain an installation configuration file in the first file, and according to the installation configuration file The content in the preset field calls the specified class information; the second calling unit is configured to invoke the dynamic link library according to the code of the dynamic link library preset by the pre-added in the class information.

其中,第二修改模塊602,還包括:第二反編譯單元,用於反編譯可執行檔,得到可執行檔的代碼;查找單元,用於在可執行檔的代碼中的預設存儲位置,查找到被修改的執行應用程式邏輯的函式對應的宣告類型的位置信息;第二修改單元,用於根據位置信息查找到被修改的執行應用程式邏輯的函式,並將函式對應的宣告類型修改為調用JAVA函式的宣告類型;解密單元,用於根據預設的解密算法,將執行應用程式邏輯的函式對應的代碼進行解密;第二編譯單元,用於編譯被修改的可執行檔的代碼重新生成修改後的可執行檔。 The second modification module 602 further includes: a second decompilation unit, configured to decompile the executable file to obtain a code of the executable file; and a searching unit, configured to preset the storage location in the code of the executable file, Finding the location information of the declaration type corresponding to the function of the modified execution application logic; the second modification unit is configured to find the function of the modified execution execution logic according to the location information, and announce the function corresponding to the function The type is modified to call the declaration type of the JAVA function; the decryption unit is configured to decrypt the code corresponding to the function executing the application logic according to the preset decryption algorithm; and the second compilation unit is configured to compile the modified executable The code of the file regenerates the modified executable file.

本發明實施例執行重新打包的應用程式安裝封包時,通過預設的動態連結程式庫將原有被修改過宣告類型的包含有應用的邏輯的可執行檔執行應用程式邏輯的函式進行還原,並進行解密還原出原始的應用程式安裝封包,以執行經過安全加密的應用,提高了應用的安全性。 When the repackaged application installation package is executed, the embodiment of the present invention restores the function of executing the application logic of the executable file containing the application logic by using the preset dynamic link library. And decrypting and restoring the original application installation package to execute the securely encrypted application, improving the security of the application.

上述本發明實施例序號僅僅為了描述,不代表實施例的優劣。 The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.

本領域普通技術人員可以理解執行上述實施例的全部或部分步驟可以通過硬體來完成,也可以通過程序來指令相關的硬體完成,所述的程序可以儲存於一種電腦可讀存儲介質中,上述提到的存儲介質可以是唯讀存儲器,磁碟或光碟等。 A person skilled in the art can understand that all or part of the steps of performing the above embodiments may be completed by hardware, or may be instructed to complete the related hardware by a program, and the program may be stored in a computer readable storage medium. The above mentioned storage medium may be a read only memory, a magnetic disk or a compact disk or the like.

為了使本發明的目的:技術方案及優點更加清楚 明白,以下結合附圖及實施例,對本發明進行進一步詳細說明。應當理解,此處所描述的具體實施例僅僅用以解釋本發明,並不用於限定本發明。 In order to make the object of the present invention: technical solutions and advantages are more clear The invention will be further described in detail below with reference to the drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

說明書中各個實施例採用遞進的方式描述,每個實施例重點說明的都是與其他實施例的不同之處,各個實施例之間相同相似部分互相參見即可。對於實施例公開的系統或裝置而言,由於其與實施例公開的方法相對應,所以描述的比較簡單,相關之處參見方法部分說明即可。 The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same similar parts between the various embodiments may be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

在本文中,諸如第一和第二等之類的關係術語僅僅用來將一個實體或者操作與另一個實體或操作區分開來,而不一定要求或者暗示這些實體或操作之間存在任何這種實際的關係或者順序。而且,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程:方法:物品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括一個……”限定的要素,並不排除在包括所述要素的過程、方法、物品或者設備中還存在另外的相同要素。 In this document, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such. The actual relationship or order. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements of the process are also included in this process: methods: the elements inherent in the item or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.

雖然本發明已以較佳實施例揭露如上,然其並非用以限定本發明,任何熟習此技藝者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。另外本發明的任一實施例或申請專利範圍不須達成本發明所揭露之全部目的或優點或特點。此外,摘要部分和標題僅是用來輔助專利檔案搜尋之用,並非用來限制本發明之權利範圍。 While the present invention has been described in its preferred embodiments, the present invention is not intended to limit the invention, and the present invention may be modified and modified without departing from the spirit and scope of the invention. The scope of protection is subject to the definition of the scope of the patent application. In addition, any of the objects or advantages or features of the present invention are not required to be achieved by any embodiment or application of the invention. In addition, the abstract sections and headings are only used to assist in the search of patent files and are not intended to limit the scope of the invention.

101~103‧‧‧步驟 101~103‧‧‧Steps

Claims (14)

一種生成應用程式安裝封包的方法,所述方法包括:通過對應用程式安裝封包解壓縮處理,獲取所述應用程式安裝封包中包含有所述應用的邏輯的可執行檔以及除所述可執行檔以外的第一檔案;在所述可執行檔的代碼中,修改執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行加密;將所述第一檔案,修改後的所述可執行檔以及預設的動態連結程式庫,重新打包生成所述應用對應的應用程式安裝封包,其中所述動態連結程式庫用於還原執行所述應用邏輯的函式對應的宣告類型,並對執行所述應用邏輯的函式對應的代碼進行解密。 A method for generating an application installation package, the method comprising: obtaining, by an application installation package decompression process, an executable file of the application installation package containing the logic of the application, and the executable file a first file other than the first file; in the code of the executable file, modifying a declaration type of a function executing the application logic, and encrypting a code corresponding to a function executing the application logic; The file, the modified executable file, and the preset dynamic link library are repackaged to generate an application installation package corresponding to the application, wherein the dynamic link library is used to restore a function executing the application logic Corresponding declaration type, and decrypting the code corresponding to the function executing the application logic. 如申請專利範圍第1項所述的方法,其特徵在於,所述在所述可執行檔的代碼中,修改執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行加密,包括:反編譯所述可執行檔,得到所述可執行檔的代碼;在所述可執行檔的代碼中,將執行所述應用邏輯的函式的宣告類型修改為調用動態連結程式庫中函式的宣告類型;根據預設的加密算法,將執行所述應用邏輯的函式對應的代碼進行加密;記錄被修改的執行所述應用邏輯的函式對應的宣告類 型的位置信息,並將所述位置信息存儲於所述可執行檔的代碼中的預設存儲位置;編譯所述可執行檔的代碼生成被修改的所述可執行檔。 The method of claim 1, wherein in the code of the executable file, modifying a declaration type of a function executing the application logic, and executing a function of the application logic The code corresponding to the code is encrypted, including: decompiling the executable file to obtain code of the executable file; in the code of the executable file, modifying the declaration type of the function executing the application logic to Calling the declaration type of the function in the dynamic link library; encrypting the code corresponding to the function executing the application logic according to a preset encryption algorithm; recording the declaration class corresponding to the modified function executing the application logic Type location information, and storing the location information in a preset storage location in the code of the executable file; compiling the code of the executable file generates the executable file that is modified. 如申請專利範圍第1項所述的方法,其特徵在於,所述獲取所述應用程式安裝封包中包含有所述應用的邏輯的可執行檔以及除所述可執行檔以外的第一檔案之後,所述方法還包括:獲取所述第一檔案中的安裝配置檔案;在所述安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼。 The method of claim 1, wherein the acquiring the application installation package includes an executable file of the logic of the application and a first file other than the executable file. The method further includes: acquiring an installation configuration file in the first file; adding a code for calling a preset dynamic link library in a preset field of the installation configuration file. 如申請專利範圍第3項所述的方法,其特徵在於,所述在所述安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼,包括:判斷所述安裝配置檔案中是否存在有預設字段;如果存在所述預設字段,則在所述預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼;如果未存在所述預設字段,則在所述安裝配置檔案中指定位置添加入預設字段並所述預設字段中加入指定的類信息,在所述預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼。 The method of claim 3, wherein the adding the code of the preset dynamic link library to the preset field of the installation configuration file comprises: determining the installation configuration file. Whether there is a preset field; if the preset field exists, adding a code for calling the preset dynamic link library in the class information specified in the preset field; if the preset field does not exist Adding a preset field to the specified location in the installation configuration file, adding the specified class information to the preset field, and adding a dynamic link program to the preset preset in the class information specified in the preset field. The code for the library. 一種執行應用程式的方法,所述方法包括:在系統運行應用程式安裝封包時,獲取所述應用程式安裝封包中的包含有所述應用的邏輯的可執行檔,除所述可 執行檔以外的第一檔案以及預設的動態連結程式庫;調用所述動態連結程式庫,在所述可執行檔的代碼中還原執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行解密;根據所述第一檔案,修改後的所述可執行檔執行所述應用。 A method for executing an application, the method comprising: acquiring, when the system runs an application installation package, an executable file of the application installation package that includes logic of the application, except Executing a first file other than the file and a preset dynamic link library; calling the dynamic link library, restoring the declaration type of the function executing the application logic in the code of the executable file, and executing the Decoding the code corresponding to the function of the application logic; according to the first file, the modified executable file executes the application. 如申請專利範圍第5項所述的方法,其特徵在於,所述調用所述動態連結程式庫,包括:在所述第一檔案中獲取安裝配置檔案,並根據所述安裝配置檔案中預設字段中的內容調用指定的類信息;根據所述類信息中預先添加的調用預設的動態連結程式庫的代碼,調用所述動態連結程式庫。 The method of claim 5, wherein the calling the dynamic link library comprises: obtaining an installation configuration file in the first file, and preset according to the installation configuration file The content in the field invokes the specified class information; the dynamic link library is invoked according to the code of the dynamic link library preset in the class information that is preset to be called. 如申請專利範圍第5項所述的方法,其特徵在於,所述在所述可執行檔的代碼中還原執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行解密,包括:反編譯所述可執行檔,得到所述可執行檔的代碼;在所述可執行檔的代碼中的預設存儲位置,查找到被修改的執行所述應用邏輯的函式對應的宣告類型的位置信息;根據所述位置信息查找到被修改的執行所述應用邏輯的函式,並將所述函式對應的宣告類型修改為調用JAVA函式的宣告類型;根據預設的解密算法,將執行所述應用邏輯的函式對應的代碼進行解密; 編譯被修改的所述可執行檔的代碼重新生成修改後的所述可執行檔。 The method of claim 5, wherein the method of restoring a function of executing a function of the application logic in a code of the executable file, and executing a function of the application logic Decrypting the corresponding code, comprising: decompiling the executable file, obtaining code of the executable file; searching for the modified execution of the application logic in a preset storage location in the code of the executable file a function corresponding to the location type of the declaration type; searching for the modified function of executing the application logic according to the location information, and modifying the declaration type corresponding to the function to the declaration type of calling the JAVA function; Decrypting a code corresponding to a function executing the application logic according to a preset decryption algorithm; Compiling the code of the executable file that is modified regenerates the modified executable file. 一種生成應用程式安裝封包的裝置,所述裝置包括:第一獲取模塊,用於通過對應用程式安裝封包解壓縮處理,獲取所述應用程式安裝封包中包含有所述應用的邏輯的可執行檔以及除所述可執行檔以外的第一檔案;第一修改模塊,用於在所述可執行檔的代碼中,修改執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行加密;打包模塊,用於將所述第一檔案,修改後的所述可執行檔以及預設的動態連結程式庫,重新打包生成所述應用對應的應用程式安裝封包,其中所述動態連結程式庫用於還原執行所述應用邏輯的函式對應的宣告類型,並對執行所述應用邏輯的函式對應的代碼進行解密。 An apparatus for generating an application installation package, the apparatus comprising: a first acquisition module, configured to acquire, by using an application package encapsulation decompression process, an executable file of the application installation package containing the logic of the application And a first file other than the executable file; a first modifying module, configured to modify a declaration type of a function executing the application logic in the code of the executable file, and execute the application logic The code corresponding to the function is encrypted; the packaging module is configured to repackage the first file, the modified executable file, and the preset dynamic link library to generate an application installation package corresponding to the application. The dynamic link library is configured to restore a declaration type corresponding to a function executing the application logic, and decrypt a code corresponding to a function executing the application logic. 如申請專利範圍第8項所述的裝置,其特徵在於,所述第一修改模塊,包括:第一反編譯單元,用於反編譯所述可執行檔,得到所述可執行檔的代碼;第一修改單元,用於在所述可執行檔的代碼中,將執行所述應用邏輯的函式的宣告類型修改為調用動態連結程式庫中函式的宣告類型;加密單元,用於根據預設的加密算法,將執行所述應用邏輯的函式對應的代碼進行加密;存儲單元,用於記錄被修改的執行所述應用邏輯的函式 對應的宣告類型的位置信息,並將所述位置信息存儲於所述可執行檔的代碼中的預設存儲位置;第一編譯單元,用於編譯所述可執行檔的代碼生成被修改的所述可執行檔。 The device of claim 8, wherein the first modification module comprises: a first decompilation unit, configured to decompile the executable file to obtain a code of the executable file; a first modifying unit, configured to, in the code of the executable file, modify an announcement type of a function that executes the application logic to a declaration type of a function in a dynamic link library; and an encryption unit, configured to And an encryption algorithm that encrypts a code corresponding to a function that executes the application logic; and a storage unit that records the modified function that executes the application logic Position information of the corresponding announcement type, and storing the location information in a preset storage location in the code of the executable file; the first compiling unit, the code for compiling the executable file generates the modified location Executable file. 如申請專利範圍第8項所述的裝置,其特徵在於,所述裝置還包括:第二獲取模塊,用於獲取所述第一檔案中的安裝配置檔案;添加模塊,用於在所述安裝配置檔案的預設字段中添加入調用預設的動態連結程式庫的代碼。 The device of claim 8, wherein the device further comprises: a second obtaining module, configured to acquire an installation configuration file in the first file; and an adding module, configured to be in the installation The preset field of the configuration file is added to the code that calls the preset dynamic link library. 如申請專利範圍第10項所述的裝置,其特徵在於,所述添加模塊,包括:判斷單元,用於判斷所述安裝配置檔案中是否存在有預設字段;第一添加單元,用於如果存在所述預設字段,則在所述預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼;第二添加單元,用於如果未存在所述預設字段,則在所述安裝配置檔案中指定位置添加入預設字段並所述預設字段中加入指定的類信息,在所述預設字段中指定的類信息中添加入調用預設的動態連結程式庫的代碼。 The device of claim 10, wherein the adding module comprises: a determining unit, configured to determine whether a preset field exists in the installation configuration file; and the first adding unit is configured to: If the preset field is present, the code that is used to call the preset dynamic link library is added to the class information specified in the preset field; and the second adding unit is configured to: if the preset field does not exist, Adding a preset field to the specified location in the installation configuration file, adding the specified class information to the preset field, and adding the class information specified in the preset field to the preset dynamic link library. Code. 一種執行應用程式的裝置,所述裝置包括:第三獲取模塊,用於在系統運行應用程式安裝封包時, 獲取所述應用程式安裝封包中的包含有所述應用的邏輯的可執行檔,除所述可執行檔以外的第一檔案以及預設的動態連結程式庫;第二修改模塊,用於調用所述動態連結程式庫,在所述可執行檔的代碼中還原執行所述應用邏輯的函式的宣告類型,並將執行所述應用邏輯的函式對應的代碼進行解密;執行模塊,用於根據所述第一檔案,修改後的所述可執行檔執行所述應用。 An apparatus for executing an application, the apparatus comprising: a third obtaining module, when the system runs an application installation package, Obtaining, in the application installation package, an executable file containing logic of the application, a first file other than the executable file, and a preset dynamic link library; and a second modification module, configured to invoke the a dynamic link library, in the code of the executable file, restoring a declaration type of a function executing the application logic, and decrypting a code corresponding to a function executing the application logic; and executing a module for The first file, the modified executable file, executes the application. 如申請專利範圍第12項所述的裝置,其中所述第二修改模塊,包括:第一調用單元,用於在所述第一檔案中獲取安裝配置檔案,並根據所述安裝配置檔案中預設字段中的內容調用指定的類信息;第二調用單元,用於根據所述類信息中預先添加的調用預設的動態連結程式庫的代碼,調用所述動態連結程式庫。 The device of claim 12, wherein the second modifying module comprises: a first calling unit, configured to obtain an installation configuration file in the first file, and according to the installation configuration file The content of the field is used to invoke the specified class information; the second calling unit is configured to invoke the dynamic link library according to the code of the dynamic link library preset in the class information. 如申請專利範圍第12項所述的裝置,其中所述第二修改模塊,包括:第二反編譯單元,用於反編譯所述可執行檔,得到所述可執行檔的代碼;查找單元,用於在所述可執行檔的代碼中的預設存儲位置,查找到被修改的執行所述應用邏輯的函式對應的宣告類型的位置信息; 第二修改單元,用於根據所述位置信息查找到被修改的執行所述應用邏輯的函式,並將所述函式對應的宣告類型修改為調用JAVA函式的宣告類型;解密單元,用於根據預設的解密算法,將執行所述應用邏輯的函式對應的代碼進行解密;第二編譯單元,用於編譯被修改的所述可執行檔的代碼重新生成修改後的所述可執行檔。 The device of claim 12, wherein the second modification module comprises: a second decompilation unit, configured to decompile the executable file to obtain a code of the executable file; a search unit, Locating, in a preset storage location in the code of the executable file, finding location information of a declared type corresponding to a function of the modified execution application logic; a second modifying unit, configured to search, according to the location information, a modified function that executes the application logic, and modify an announcement type corresponding to the function to a declaration type that invokes a JAVA function; Decrypting a code corresponding to a function executing the application logic according to a preset decryption algorithm; and a second compiling unit, configured to compile the code of the modified executable file to regenerate the modified executable files.
TW103126982A 2013-10-25 2014-08-06 Method and apparatus for generating application installation packages and running applications TWI530874B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310512425.6A CN104573416B (en) 2013-10-25 2013-10-25 A kind of method and device for generating application installation package, executing application

Publications (2)

Publication Number Publication Date
TW201516871A TW201516871A (en) 2015-05-01
TWI530874B true TWI530874B (en) 2016-04-21

Family

ID=52992242

Family Applications (1)

Application Number Title Priority Date Filing Date
TW103126982A TWI530874B (en) 2013-10-25 2014-08-06 Method and apparatus for generating application installation packages and running applications

Country Status (3)

Country Link
CN (1) CN104573416B (en)
TW (1) TWI530874B (en)
WO (1) WO2015058620A1 (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106203007B (en) * 2015-05-08 2020-03-03 腾讯科技(深圳)有限公司 Code processing method and device and computing equipment
CN105068832B (en) * 2015-07-30 2018-06-01 北京奇虎科技有限公司 A kind of method and apparatus for generating executable file
CN105260184B (en) * 2015-10-15 2019-02-19 Oppo广东移动通信有限公司 A kind of adjustment method and device for restoring image file
CN107766096A (en) * 2016-08-19 2018-03-06 阿里巴巴集团控股有限公司 The generation method of application program installation kit, the operation method of application program and device
CN108228196A (en) * 2016-12-12 2018-06-29 腾讯科技(深圳)有限公司 The packaging method and device of application program
CN108279941B (en) * 2016-12-31 2021-06-15 阿里巴巴集团控股有限公司 Application program compression method and device
CN107292135A (en) * 2017-06-06 2017-10-24 网易(杭州)网络有限公司 A kind of program code guard method and device
CN108388432A (en) * 2018-05-29 2018-08-10 浪潮软件股份有限公司 A kind of Android system Compilation Method and miniature compiling system
CN109062582B (en) * 2018-07-23 2022-02-01 北京云测信息技术有限公司 Encryption method and device for application installation package
CN109033765A (en) * 2018-08-07 2018-12-18 麒麟合盛网络技术股份有限公司 The treating method and apparatus of application installation package
CN109408073B (en) * 2018-09-21 2021-10-08 北京大学 Android non-invasive application repacking method
CN109857454B (en) * 2018-12-15 2023-07-18 中国平安人寿保险股份有限公司 Method, device, electronic equipment and storage medium for generating and caching installation package
FR3094515B1 (en) * 2019-03-28 2021-09-10 Ingenico Group secure code execution process, corresponding devices, system and programs
CN110309630B (en) * 2019-06-28 2023-05-30 南京冰鉴信息科技有限公司 Java code encryption method and device
CN110837630B (en) * 2019-11-11 2022-02-08 维沃移动通信有限公司 Login method, image processing method and electronic device
CN113110841A (en) * 2020-01-13 2021-07-13 奇安信科技集团股份有限公司 Mobile application program generation method and device, electronic equipment and storage medium
CN114020278B (en) * 2020-07-19 2024-06-18 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN112083930B (en) * 2020-09-14 2024-06-14 华帝股份有限公司 Optimization method for android project compiling process

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101256612B (en) * 2008-04-01 2010-11-03 北京飞天诚信科技有限公司 Program protection method and system based on .Net card
JP5948680B2 (en) * 2011-09-13 2016-07-06 パナソニックIpマネジメント株式会社 Content playback system, information processing terminal, media server, secure device and server / secure device
CN102760219B (en) * 2011-12-20 2015-12-16 北京安天电子设备有限公司 A kind of Android platform software protection system, method and apparatus
CN102609284A (en) * 2012-02-01 2012-07-25 上海游安网络科技有限公司 Method for safely loading executable file
CN103246848B (en) * 2013-03-26 2016-05-18 北京深思数盾科技股份有限公司 The method and apparatus of protection software security

Also Published As

Publication number Publication date
TW201516871A (en) 2015-05-01
CN104573416A (en) 2015-04-29
CN104573416B (en) 2018-07-17
WO2015058620A1 (en) 2015-04-30

Similar Documents

Publication Publication Date Title
TWI530874B (en) Method and apparatus for generating application installation packages and running applications
KR101518420B1 (en) Apparatus and method for managing apk file in a android platform
CN108229112B (en) Protection application program, and running method and device of application program
US8892876B1 (en) Secured application package files for mobile computing devices
CN103413076B (en) A kind of Android application program divides the method for block protection
WO2016078130A1 (en) Dynamic loading method for preventing reverse of apk file
US20160203087A1 (en) Method for providing security for common intermediate language-based program
US20150095653A1 (en) Method and apparatus of creating application package, method and apparatus of executing application package, and recording medium storing application package
CN107070656B (en) Method and system for encrypting and decrypting so file in application program
US20080270806A1 (en) Execution Device
EP3552093B1 (en) Application piracy prevention with secure enclave protection of automatically modularized functions
CN109062582A (en) A kind of encryption method and device of application installation package
CN103745141A (en) Method for preventing application program in intelligent terminal android system from being decompiled
WO2011134207A1 (en) Method for protecting software
CN107430650A (en) Computer program is protected to resist reverse-engineering
CN110309630B (en) Java code encryption method and device
WO2016206393A1 (en) Method and apparatus for managing application and method and apparatus for implementing read-write operation
CN107871066B (en) Code compiling method and device based on android system
US20150026483A1 (en) Systems and Methods for Mobile Application Protection
CN114692134A (en) System and method for protecting codes and data based on linux kernel process monitoring
CN107257282A (en) A kind of full bag encryption method of code based on RC4 algorithms
CN117150515B (en) Safety protection method for EDA secondary development source code, electronic equipment and storage medium
CN112559980B (en) Applet runtime capable of embedding a plurality of random APP
KR101749209B1 (en) Method and apparatus for hiding information of application, and method and apparatus for executing application
CN111813460A (en) Access method, device, equipment and storage medium for application program matching file