CN111198690A - Modification method and device for installation package - Google Patents

Modification method and device for installation package Download PDF

Info

Publication number
CN111198690A
CN111198690A CN201811369304.XA CN201811369304A CN111198690A CN 111198690 A CN111198690 A CN 111198690A CN 201811369304 A CN201811369304 A CN 201811369304A CN 111198690 A CN111198690 A CN 111198690A
Authority
CN
China
Prior art keywords
file
code
modified
installation package
added
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811369304.XA
Other languages
Chinese (zh)
Inventor
樊维
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201811369304.XA priority Critical patent/CN111198690A/en
Publication of CN111198690A publication Critical patent/CN111198690A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/53Decompilation; Disassembly
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a device for modifying an installation package. According to the modification method of the installation package, the decompiling is carried out on the installation package to be modified, so that a decompiled file is obtained; acquiring a code to be added, and generating a disassembling code according to the code to be added; modifying the disassembled file according to the disassembled code to obtain a modified disassembled file; and generating a modified installation package according to the modified disassembly file. According to the technical scheme, the installation package to be modified and the code to be added are decompiled to form a uniform language file format, so that the installation package can be modified by the code to be added, and the installation package has corresponding functions or the functions of the installation package are improved.

Description

Modification method and device for installation package
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for modifying an installation package.
Background
In the prior art, when a developer needs to make functional improvement on an existing application, the developer needs to edit and develop again on an editable development source file of the application. However, a common developer can only directly obtain the installation package of the application, and cannot obtain the original development file of the application. The installation package of the application is compiled and compressed, so that ordinary developers cannot directly edit and modify the installation package in functions, and certain difficulty is brought to redevelopment.
On the other hand, when a common developer develops a new function of an application, the adopted programming language may not be consistent with the programming language of the application, and the application cannot be edited and modified.
Disclosure of Invention
In view of the above, the present invention has been made to provide a modification method, apparatus, electronic device and computer-readable storage medium for an installation package that overcome or at least partially solve the above problems.
According to an aspect of the present invention, there is provided a method for modifying an installation package, including:
decompiling the installation package to be modified to obtain a decompiled file;
acquiring a code to be added, and generating a disassembling code according to the code to be added;
modifying the disassembled file according to the disassembled code to obtain a modified disassembled file;
and generating a modified installation package according to the modified disassembly file.
Optionally, the to-be-modified installation package is an apk file, and the decompiling the to-be-modified installation package to obtain a decompiled file includes:
and performing decompiling on the apk file to obtain one or more smali files.
Optionally, the code is a Java code, and the generating a disassembling code according to the code to be added includes:
and respectively converting each line of Java codes into corresponding smali codes.
Optionally, the modifying the disassembly file according to the disassembly code to obtain a modified disassembly file includes:
and adding the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
Optionally, the adding the disassembling code to the specified position in the disassembling file comprises:
and determining the designated position according to the submitted configuration information.
Optionally, the modifying the disassembled file according to the disassembled code includes:
and modifying the code line number and the register information according to the disassembled code.
Optionally, the generating a modified installation package according to the modified disassembly file includes:
and generating a modified installation package according to the modified disassembling file and the newly added file.
Optionally, the newly added file includes one or more of:
jar package, class file, resource file.
Optionally, the generating a modified installation package according to the modified disassembled file and the newly added file includes:
and converting the class file into a corresponding smali file, and generating a modified installation package according to the modified disassembly file and the converted smali file.
According to another aspect of the present invention, there is provided an installation package modification apparatus, including:
the decompiling unit is suitable for decompiling the installation package to be modified to obtain a decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added;
the modifying unit is suitable for modifying the disassembling file according to the disassembling code to obtain a modified disassembling file;
and the installation package generating unit is suitable for generating a modified installation package according to the modified disassembly file.
Optionally, the installation package to be modified is an apk file,
and the decompiling unit is suitable for decompiling the apk file to obtain one or more smali files.
Alternatively, the code is Java code,
and the decompiling unit is suitable for converting each row of Java codes into corresponding smali codes respectively.
Optionally, the modifying unit is adapted to add the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
Optionally, the modifying unit is adapted to determine the designated location according to the submitted configuration information.
Optionally, the modifying unit is adapted to modify the code line number and the register information according to the disassembled code.
Optionally, the installation package generating unit is adapted to generate a modified installation package according to the modified disassembled file and the newly added file.
Optionally, the newly added file includes one or more of:
jar package, class file, resource file.
Optionally, the installation package generating unit is adapted to convert the class file into a corresponding smali file, and generate a modified installation package according to the modified disassembly file and the converted smali file.
In accordance with still another aspect of the present invention, there is provided an electronic apparatus including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform a method as any one of the above.
According to a further aspect of the invention, there is provided a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement a method as any one of the above.
According to the technical scheme, the installation package to be modified is decompiled to obtain the decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added; modifying the disassembled file according to the disassembled code to obtain a modified disassembled file; and generating a modified installation package according to the modified disassembly file. According to the technical scheme, the installation package to be modified and the code to be added are decompiled to form a uniform language file format, so that the installation package can be modified by the code to be added, and the installation package has corresponding functions or the functions of the installation package are improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow diagram illustrating a method for modifying an installation package according to one embodiment of the invention;
FIG. 2 is a schematic diagram of a modification apparatus for an installation package according to an embodiment of the present invention;
FIG. 3 shows a schematic structural diagram of an electronic device according to one embodiment of the invention;
fig. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 is a flow chart illustrating a modification method of an installation package according to an embodiment of the present invention. As shown in fig. 1, the method includes:
and step S110, performing decompiling on the installation package to be modified to obtain a decompiled file.
The installation package to be modified is compiled, and if the functional improvement is required, the installation package can not be directly edited to modify the installation package. Therefore, the installation package to be modified needs to be decompiled and converted into an editable file, so that the installation package can be modified conveniently. The disassembling file is a file of the installation package after decompiling and is an editable file.
And step S120, acquiring a code to be added, and generating a disassembling code according to the code to be added.
The code to be added is the code which needs to be added into the installation package to be modified, and the code needs to be converted into the code which is consistent with the language of the installation package to be modified, so that the code can be added into the installation package to be modified. For example, the code to be added is decompiled and converted into the disassembling code, and the disassembling code is consistent with the disassembling file of the installation package to be modified.
In a specific example, after the installation package to be modified is decompiled, the obtained decompilated file is a smali file. And the code to be added is java code which cannot be directly added into the smali file, so that the java code is decompiled, converted into the smali code and added into the smali file.
And S130, modifying the disassembling file according to the disassembling code to obtain a modified disassembling file.
In the step, the disassembly file is modified according to the disassembly code, or the disassembly code is directly added into the disassembly file, so that a new function is added into the installation package; or replacing a certain section of corresponding code in the disassembled file with the disassembled code to improve specific functions in the installation package.
And step S140, generating a modified installation package according to the modified disassembly file.
The modified disassembly file is an original development file, generally cannot be directly operated, and needs to be converted back to an operable format to generate a new installation package. For example, the modified disassembly file may be compiled again and packaged to generate a modified installation package. At this time, the modified installation package has the new function represented by the code to be added.
In the embodiment, a decompiling file is obtained by decompiling the installation package to be modified; acquiring a code to be added, and generating a disassembling code according to the code to be added; modifying the disassembled file according to the disassembled code to obtain a modified disassembled file; and generating a modified installation package according to the modified disassembly file. According to the technical scheme, the installation package to be modified and the code to be added are decompiled to form a uniform language file format, so that the installation package can be modified by the code to be added, and the installation package has corresponding functions or the functions of the installation package are improved.
In one embodiment of the present invention, in the method shown in fig. 1, the installation package to be modified is an apk file. Decompiling the installation package to be modified in the step S110 to obtain a decompiled file, including: and performing decompiling on the apk file to obtain one or more smali files.
The embodiment provides a specific operation object of an installation package to be modified in a modification method of the installation package. The apk file is an installation package file of the android system, that is, a specific operation object of the method for modifying the installation package of the embodiment is the installation package file based on the android system. The apk file is a compressed file, which contains executable files and can run in the android system, but generally cannot be edited and modified directly. And performing decompiling on the apk file, namely decompressing the apk file, and converting the file into an editable file, wherein the smali file is the editable file corresponding to the apk file.
In one embodiment of the invention, the code is Java code, as in the method shown in FIG. 1. The step S120 of generating a disassembled code according to the code to be added includes: and respectively converting each line of Java codes into corresponding smali codes.
The embodiment provides a specific operation object to be added with codes in the modification method of the installation package. The code to be added is java code, but may be other language code, such as C language code or C + + language code.
The java code also needs to be reversely compiled into a smali code, and is corresponding to the apk file which is reversely compiled into a smali file, and the two are unified into the same format and the same compiling language. In this way, the decompiled smali code can be directly added to the smali file or replaced with the corresponding code therein.
In an embodiment of the present invention, in the method shown in fig. 1, the modifying the disassembled file according to the disassembling code in step S130 to obtain a modified disassembled file includes: and adding the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
The specified position is the position where the disassembling code needs to be added, namely the position of the disassembling code in the disassembling file, and the specified position is related to the function represented by the code to be added and writing logic in the disassembling file. For example, the installation package to be modified is an installation package of a customs clearance game, and the function represented by the code to be added shows a piece of celebration music after customs clearance is completed. Thus, it is necessary to add the disassembly code at the last position of the disassembly file, which is the designated position in the disassembly code and disassembly file.
In an embodiment of the present invention, the method, wherein adding the disassembling code to a specified position in the disassembling file comprises: and determining the designated position according to the submitted configuration information.
The designated location is determined by the configuration information. The configuration information is determined during modification and development of the installation package, specifically determined according to the modification content of the installation package, and submitted together with the code to be added. For example, the installation package to be modified is a racing game of racing cars, and the code to be added is a function code for increasing the speed of each level of racing car therein. That is, the adding position of the code to be added should be in the area defining the speed of racing, for example, a position between the 55 th line code and the 56 th line code in the disassembling file where the disassembling code needs to be added.
In one embodiment of the present invention, in the method shown in fig. 1, the modifying the disassembled file according to the disassembled code in step S130 includes: and modifying the code line number and the register information according to the disassembled codes.
The number of lines of code and register information are related to the running of the code, and each line of code typically has a corresponding storage location in a register. After the disassembled code is added to the disassembled file, the number of lines and the position of the code are changed, and the information stored in the register needs to be updated accordingly. For example, a line of disassembling code is added at a position between the 55 th line code and the 56 th line code in the disassembling file, the original 56 th line code is changed into the 57 th line code, and the position stored by the 56 th line code in the register also needs to be updated to the added disassembling code.
In one embodiment of the present invention, in the method shown in fig. 1, the generating a modified installation package according to the modified disassembly file in step S140 includes: and generating a modified installation package according to the modified disassembling file and the newly added file.
The new file may be a file that needs to be used in the function executed by the code to be added, and therefore, the new file needs to be compiled and packaged again together with the modified disassembly file to generate a new installation package.
Taking the above customs clearance game as an example, in the customs clearance game, the function represented by the code to be added is to show a section of celebration music after the customs clearance is completed. The celebration music is the newly added file, and the music is called and played when the added code is executed.
In an embodiment of the present invention, in the method, the newly added file includes one or more of the following: jar package, class file, resource file.
The new file can be any file that can be compressed in the installation package. Jar package, class file, or other resource file.
For example, a new function is executed by the code to be added, the function is defined in the jar package, the jar package is placed into the modified installation package as a new file, and the function can be directly executed by directly calling the jar package when the code to be added is executed, so that the method is simpler and more convenient.
Or, the code to be added shows an advertisement propaganda picture, the advertisement propaganda picture is put into the modified installation package as a resource file, and the advertisement propaganda picture is called to be displayed when the advertisement propaganda picture is executed.
In an embodiment of the present invention, the generating the modified installation package according to the modified disassembled file and the newly added file in the method includes: and converting the class file into a corresponding smali file, and generating a modified installation package according to the modified disassembly file and the converted smali file.
In the files of the apk installation package, the class files are class files, and can be compiled and packaged again together with the disassembly files only if the class files are converted into corresponding smali files, so that the modified installation package is generated.
Fig. 2 is a schematic structural diagram of a modification apparatus for an installation package according to an embodiment of the present invention. As shown in fig. 2, the apparatus 200 includes:
the decompiling unit 210 is adapted to decompile the installation package to be modified to obtain a decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added;
the installation package to be modified is compiled, and if the functional improvement is required, the installation package can not be directly edited to modify the installation package. Therefore, the installation package to be modified needs to be decompiled and converted into an editable file, so that the installation package can be modified conveniently. The disassembling file is a file of the installation package after decompiling and is an editable file.
The code to be added is the code which needs to be added into the installation package to be modified, and can realize specific functions, such as modifying certain characteristics in the installation package. The code to be added is required to be converted to be consistent with the language of the installation package to be modified, and the code to be added can be added into the installation package to be modified. For example, the code to be added is decompiled and converted into the disassembling code, and the disassembling code is consistent with the disassembling file of the installation package to be modified.
In a specific example, after the installation package to be modified is decompiled, the obtained decompilated file is a smali file. And the code to be added is java code which cannot be directly added into the smali file, so that the java code is decompiled, converted into the smali code and added into the smali file.
A modifying unit 220, adapted to modify the disassembled file according to the disassembled code to obtain a modified disassembled file;
in the step, the disassembly file is modified according to the disassembly code, or the disassembly code is directly added into the disassembly file, so that a new function is added into the installation package; or replacing a certain section of corresponding code in the disassembled file with the disassembled code to improve specific functions in the installation package.
An installation package generating unit 230 adapted to generate a modified installation package from the modified disassembled file.
The modified disassembly file is a development file, generally cannot be directly operated, and needs to be converted back to an operable format to generate a new installation package. For example, the modified disassembly file may be compiled again and packaged to generate a modified installation package. At this time, the modified installation package has the new function represented by the code to be added.
In the embodiment, a decompiling file is obtained by decompiling the installation package to be modified; acquiring a code to be added, and generating a disassembling code according to the code to be added; modifying the disassembled file according to the disassembled code to obtain a modified disassembled file; and generating a modified installation package according to the modified disassembly file. According to the technical scheme, the installation package to be modified and the code to be added are decompiled to form a uniform language file format, so that the installation package can be modified by the code to be added, and the installation package has corresponding functions or the functions of the installation package are improved.
In an embodiment of the present invention, in the apparatus shown in fig. 2, the to-be-modified installation package is an apk file, and the decompilation unit 210 is adapted to decompilate the apk file to obtain one or more smali files.
The embodiment provides a specific operation installation package for decompiling by the decompilation unit 210, and a specific method for decompilating the installation package to be modified. The apk file is an installation package file of the android system, that is, a specific operation object of the method for modifying the installation package of the embodiment is the installation package file based on the android system. The apk file is a compressed file, which contains executable files and can run in the android system, but generally cannot be directly edited and modified when functional improvement is carried out. And performing decompiling on the apk file, namely decompressing the apk file, and converting the file into an editable file, wherein the smali file is the editable file corresponding to the apk file.
In an embodiment of the present invention, in the apparatus shown in fig. 2, the codes are Java codes, and the decompilation unit 210 is adapted to convert each line of Java codes into corresponding smali codes respectively.
The embodiment provides a specific operation code for decompiling by the decompilation unit 210 and a specific method for decompilating the code to be added. The code to be added is java code, but may be other language code, such as C language code or C + + language code.
The java code also needs to be reversely compiled into a smali code, and is corresponding to the apk file which is reversely compiled into a smali file, and the two are unified into the same format and the same compiling language. In this way, the decompiled smali code can be directly added to the smali file or replaced with the corresponding code therein.
In one embodiment of the invention, the modifying unit 220 is adapted to add the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file, as in the apparatus shown in fig. 2.
The embodiment provides a specific method for modifying the disassembled file by the modifying unit 220 by utilizing the disassembled code. The specified position is the position where the disassembling code needs to be added, namely the position of the disassembling code in the disassembling file, and the specified position is related to the function represented by the code to be added and writing logic in the disassembling file. For example, the installation package to be modified is an installation package of a customs clearance game, and the function represented by the code to be added shows a piece of celebration music after customs clearance is completed. Thus, it is necessary to add the disassembly code at the last position of the disassembly file, which is the designated position in the disassembly code and disassembly file.
In an embodiment of the present invention, in the above apparatus, the modifying unit 220 is adapted to determine the specified location according to the submitted configuration information.
The designated location is determined by the configuration information. The configuration information is determined during modification and development of the installation package, specifically determined according to the modification content of the installation package, and submitted together with the code to be added. For example, the installation package to be modified is a racing game of racing cars, and the code to be added is a function code for increasing the speed of each level of racing car therein. That is, the adding position of the code to be added should be in the area defining the speed of racing, for example, a position between the 55 th line code and the 56 th line code in the disassembling file where the disassembling code needs to be added.
In an embodiment of the invention, the modifying unit 220, in the apparatus shown in fig. 2, is adapted to modify the code line number and the register information according to the disassembled code.
Modification unit 220, in addition to modifying the disassembled file according to the disassembled code, also needs to modify the code line number and register information. The number of lines of code and register information are related to the running of the code, and each line of code typically has a corresponding storage location in a register. After the disassembled code is added to the disassembled file, the number of lines and the position of the code are changed, and the information stored in the register needs to be updated accordingly. For example, a line of disassembling code is added at a position between the 55 th line code and the 56 th line code in the disassembling file, the original 56 th line code is changed into the 57 th line code, and the position stored by the 56 th line code in the register also needs to be updated to the added disassembling code.
In an embodiment of the present invention, in the apparatus shown in fig. 2, the installation package generating unit 230 is adapted to generate a modified installation package according to the modified disassembled file and the newly added file.
The new file may be a file that needs to be used in the function executed by the code to be added, and therefore, the new file needs to be compiled and packaged again together with the modified disassembly file to generate a new installation package.
Taking the above customs clearance game as an example, in the customs clearance game, the function represented by the code to be added is to show a section of celebration music after the customs clearance is completed. The celebration music is the newly added file, and the music is called and played when the added code is executed.
In an embodiment of the present invention, in the above apparatus, the newly added file includes one or more of the following: jar package, class file, resource file.
The new file can be any file that can be compressed in the installation package. Jar package, class file, or other resource file.
For example, a new function is executed by the code to be added, the function is defined in the jar package, the jar package is placed into the modified installation package as a new file, and the function can be directly executed by directly calling the jar package when the code to be added is executed, so that the method is simpler and more convenient.
Or, the code to be added shows an advertisement propaganda picture, the advertisement propaganda picture is put into the modified installation package as a resource file, and the advertisement propaganda picture is called to be displayed when the advertisement propaganda picture is executed.
In an embodiment of the present invention, in the apparatus shown in fig. 2, the installation package generating unit 230 is adapted to convert the class file into a corresponding smali file, and generate a modified installation package according to the modified disassembly file and the converted smali file.
In the files of the apk installation package, the class files are class files, and can be compiled and packaged again together with the disassembly files only if the class files are converted into corresponding smali files, so that the modified installation package is generated.
In summary, according to the technical scheme of the invention, the installation package to be modified is decompiled to obtain a decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added; modifying the disassembled file according to the disassembled code to obtain a modified disassembled file; and generating a modified installation package according to the modified disassembly file. According to the technical scheme, the installation package to be modified and the code to be added are decompiled to form a uniform language file format, so that the installation package can be modified by the code to be added, and the installation package has corresponding functions or the functions of the installation package are improved.
It should be noted that:
the algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose devices may be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or 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 a modification apparatus of an installation package according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
For example, fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the invention. The electronic device comprises a processor 310 and a memory 320 arranged to store computer executable instructions (computer readable program code). The memory 320 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. The memory 320 has a storage space 330 storing computer readable program code 331 for performing any of the method steps described above. For example, the storage space 330 for storing the computer readable program code may comprise respective computer readable program codes 331 for respectively implementing various steps in the above method. The computer readable program code 331 may be read from or written to one or more computer program products. These computer program products comprise a program code carrier such as a hard disk, a Compact Disc (CD), a memory card or a floppy disk. Such a computer program product is typically a computer readable storage medium such as described in fig. 4. Fig. 4 shows a schematic structural diagram of a computer-readable storage medium according to an embodiment of the present invention. The computer readable storage medium 400 has stored thereon a computer readable program code 331 for performing the steps of the method according to the invention, readable by a processor 310 of the electronic device 300, which computer readable program code 331, when executed by the electronic device 300, causes the electronic device 300 to perform the steps of the method described above, in particular the computer readable program code 331 stored on the computer readable storage medium may perform the method shown in any of the embodiments described above. The computer readable program code 331 may be compressed in a suitable form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
The invention discloses A1 and a modification method of an installation package, which comprises the following steps:
decompiling the installation package to be modified to obtain a decompiled file;
acquiring a code to be added, and generating a disassembling code according to the code to be added;
modifying the disassembled file according to the disassembled code to obtain a modified disassembled file;
and generating a modified installation package according to the modified disassembly file.
The method of A2, as in A1, wherein the installation package to be modified is an apk file, and the decompiling the installation package to be modified to obtain a decompiled file includes:
and performing decompiling on the apk file to obtain one or more smali files.
A3, the method of A1, wherein the code is Java code, and the generating disassembling code according to the code to be added comprises:
and respectively converting each line of Java codes into corresponding smali codes.
A4, the method as in a1, wherein the modifying the disassembled file according to the disassembled code to obtain the modified disassembled file comprises:
and adding the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
A5, the method of A4, wherein the adding the disassembled code to a specified location in the disassembled file comprises:
and determining the designated position according to the submitted configuration information.
A6, the method of A1, wherein the modifying the disassembled file according to the disassembled code comprises:
and modifying the code line number and the register information according to the disassembled code.
A7, the method of A1, wherein the generating a modified installation package from the modified disassembled file comprises:
and generating a modified installation package according to the modified disassembling file and the newly added file.
A8, the method of A7, wherein the newly added file includes one or more of:
jar package, class file, resource file.
A9, the method of A8, wherein the generating the modified installation package according to the modified disassembled file and the added file comprises:
and converting the class file into a corresponding smali file, and generating a modified installation package according to the modified disassembly file and the converted smali file.
The invention also discloses B10, a modification device of the installation package, comprising:
the decompiling unit is suitable for decompiling the installation package to be modified to obtain a decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added;
the modifying unit is suitable for modifying the disassembling file according to the disassembling code to obtain a modified disassembling file;
and the installation package generating unit is suitable for generating a modified installation package according to the modified disassembly file.
B11, the apparatus according to B10, wherein the installation package to be modified is an apk file,
and the decompiling unit is suitable for decompiling the apk file to obtain one or more smali files.
B12, the apparatus according to B10, wherein the code is Java code,
and the decompiling unit is suitable for converting each row of Java codes into corresponding smali codes respectively.
B13, the device of B10, wherein,
and the modifying unit is suitable for adding the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
B14, the device of B13, wherein,
the modification unit is suitable for determining the designated position according to the submitted configuration information.
B15, the device of B10, wherein,
and the modifying unit is suitable for modifying the code line number and the register information according to the disassembled codes.
B16, the device of B10, wherein,
and the installation package generating unit is suitable for generating the modified installation package according to the modified disassembling file and the newly added file.
B17, the apparatus as in B16, wherein the newly added file includes one or more of the following:
jar package, class file, resource file.
B18, the device of B17, wherein,
and the installation package generation unit is suitable for converting the class file into a corresponding smali file and generating a modified installation package according to the modified disassembly file and the converted smali file.
The invention also discloses C19 and an electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the method of any one of a1-a 9.
The invention also discloses D20, a computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method as described in any of a1-a 9.

Claims (10)

1. A method for modifying an installation package, comprising:
decompiling the installation package to be modified to obtain a decompiled file;
acquiring a code to be added, and generating a disassembling code according to the code to be added;
modifying the disassembled file according to the disassembled code to obtain a modified disassembled file;
and generating a modified installation package according to the modified disassembly file.
2. The method of claim 1, wherein the installation package to be modified is an apk file, and the decompiling the installation package to be modified to obtain a decompiled file comprises:
and performing decompiling on the apk file to obtain one or more smali files.
3. The method of claim 1, wherein the code is Java code, and the generating a disassembled code according to the code to be added comprises:
and respectively converting each line of Java codes into corresponding smali codes.
4. The method of claim 1, wherein modifying the disassembled file according to the disassembly code to obtain a modified disassembled file comprises:
and adding the disassembling code to a specified position in the disassembling file to obtain a modified disassembling file.
5. The method of claim 4, wherein the adding the disassembly code to the specified location in the disassembly file comprises:
and determining the designated position according to the submitted configuration information.
6. The method of claim 1, wherein said modifying the disassembled file according to the disassembled code comprises:
and modifying the code line number and the register information according to the disassembled code.
7. A modification apparatus of an installation package, comprising:
the decompiling unit is suitable for decompiling the installation package to be modified to obtain a decompiled file; acquiring a code to be added, and generating a disassembling code according to the code to be added;
the modifying unit is suitable for modifying the disassembling file according to the disassembling code to obtain a modified disassembling file;
and the installation package generating unit is suitable for generating a modified installation package according to the modified disassembly file.
8. The apparatus of claim 7, wherein the installation package to be modified is an apk file,
and the decompiling unit is suitable for decompiling the apk file to obtain one or more smali files.
9. An electronic device, wherein the electronic device comprises: a processor; and a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the method of any one of claims 1-6.
10. A computer readable storage medium, wherein the computer readable storage medium stores one or more programs which, when executed by a processor, implement the method of any of claims 1-6.
CN201811369304.XA 2018-11-16 2018-11-16 Modification method and device for installation package Pending CN111198690A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811369304.XA CN111198690A (en) 2018-11-16 2018-11-16 Modification method and device for installation package

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811369304.XA CN111198690A (en) 2018-11-16 2018-11-16 Modification method and device for installation package

Publications (1)

Publication Number Publication Date
CN111198690A true CN111198690A (en) 2020-05-26

Family

ID=70744052

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811369304.XA Pending CN111198690A (en) 2018-11-16 2018-11-16 Modification method and device for installation package

Country Status (1)

Country Link
CN (1) CN111198690A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112379890A (en) * 2020-12-04 2021-02-19 深圳麦风科技有限公司 Data copying method of Whatsapp
CN112631640A (en) * 2020-12-23 2021-04-09 苏州三六零智能安全科技有限公司 Patch generation method, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484585A (en) * 2014-11-26 2015-04-01 北京奇虎科技有限公司 Application program installation package processing method and device, and mobile apparatus
CN104866504A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android software function
CN106709286A (en) * 2016-11-30 2017-05-24 江苏神州信源***工程有限公司 Method for performing security reinforcement on apk resource package
US20170242664A1 (en) * 2016-02-18 2017-08-24 Line Corporation Method, apparatus, system, and non-transitory computer readable medium for extending at least one function of a package file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866504A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android software function
CN104484585A (en) * 2014-11-26 2015-04-01 北京奇虎科技有限公司 Application program installation package processing method and device, and mobile apparatus
US20170242664A1 (en) * 2016-02-18 2017-08-24 Line Corporation Method, apparatus, system, and non-transitory computer readable medium for extending at least one function of a package file
CN106709286A (en) * 2016-11-30 2017-05-24 江苏神州信源***工程有限公司 Method for performing security reinforcement on apk resource package

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112379890A (en) * 2020-12-04 2021-02-19 深圳麦风科技有限公司 Data copying method of Whatsapp
CN112631640A (en) * 2020-12-23 2021-04-09 苏州三六零智能安全科技有限公司 Patch generation method, device, equipment and storage medium
CN112631640B (en) * 2020-12-23 2022-11-04 苏州三六零智能安全科技有限公司 Patch generation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109697060B (en) Video special effect system, generation method, device, equipment and storage medium thereof
US20070174818A1 (en) Method and apparatus for generating application programs for multiple hardware and/or software platforms
CN107977552B (en) Android application reinforcing method and device
CN108654090B (en) Method and device for interaction between operating system and game application
CN106843842B (en) Method and device for updating application program configuration file
CN104899025A (en) Method and device for generating channel package
CN109598107A (en) A kind of code conversion method and device based on application installation package file
CN111198690A (en) Modification method and device for installation package
CN109857432B (en) Hot updating method and device for game application
CN112732345A (en) Starting method, device, equipment and storage medium of embedded system
CN103631971B (en) The recombination method and device of a kind of portable and executable file
CN106681782B (en) Method and device for compiling dynamic link library SO file of android installation package
CN108133126A (en) A kind of reinforcement means and device of Android application
JP6133409B2 (en) Method, system and apparatus for protection against reverse engineering and / or tampering of programs
CN113238760B (en) Software migration method, device, computing equipment and readable storage medium
CN107506623B (en) Application program reinforcing method and device, computing equipment and computer storage medium
US20160358356A1 (en) Asset catalog layered image support
CN107480479B (en) Application program reinforcing method and device, computing equipment and computer storage medium
JP6703114B2 (en) Application program execution method and apparatus
CN115700470A (en) File loading processing method and device, computer storage medium and electronic equipment
US9063723B2 (en) Function-based software comparison method
CN113805971B (en) Application program running method, computing device and storage medium
CN115629795A (en) Configuration method and device of executable file and electronic equipment
CN115906014A (en) Data processing method and related device
CN108958795B (en) BootLoader code reuse method and development board in embedded system

Legal Events

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