CN105574000B - Extend the method and device of APK file application - Google Patents

Extend the method and device of APK file application Download PDF

Info

Publication number
CN105574000B
CN105574000B CN201410529570.XA CN201410529570A CN105574000B CN 105574000 B CN105574000 B CN 105574000B CN 201410529570 A CN201410529570 A CN 201410529570A CN 105574000 B CN105574000 B CN 105574000B
Authority
CN
China
Prior art keywords
file
apk
apk file
initial
document
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.)
Active
Application number
CN201410529570.XA
Other languages
Chinese (zh)
Other versions
CN105574000A (en
Inventor
范韬
张金昕
付光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201410529570.XA priority Critical patent/CN105574000B/en
Priority to PCT/CN2015/071471 priority patent/WO2016054880A1/en
Priority to PCT/CN2015/074404 priority patent/WO2015154612A1/en
Publication of CN105574000A publication Critical patent/CN105574000A/en
Application granted granted Critical
Publication of CN105574000B publication Critical patent/CN105574000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of methods of extension APK file application, and the method for extension APK file application is the following steps are included: obtain initial APK file and shelf document;Decompiling processing is carried out to initial APK file;File destination identical with the file type of shelf document is extracted from decompiling treated file;File destination and shelf document are merged into processing;By after merging treatment file and initial APK file store to profile press from both sides, and be packaged building profile folder be target APK file.The invention also discloses a kind of devices of extension APK file application.The present invention passes through after carrying out decompiling to initial APK file, shelf document and the file after decompiling are handled, under the premise of having no need to change the source code of initial APK file, also not needing to modify the file structure of dex, so that increasing to existing mobile application flexible and convenient when new function.

Description

Extend the method and device of APK file application
Technical field
The present invention relates to APK file field more particularly to a kind of method and devices of extension APK file application.
Background technique
With the development of society, enterprise mobile application is rapidly progressed, but since enterprise mobile application develops it The planning that just do not seek unity of standard becomes the isolated mobile application left so that many enterprise mobile application functions are not complete.By In mobile application, relevant developer has been difficult to find, and code maintenance is also seldom, so that being increased by remodifying source code Add certain functions, become extremely difficult, while high development cost can be brought to enterprise.Android is as emerging platform, APK The difference of file structure and executable file does not occur the shell adding solution shell tool of standard also.The full name of shell adding is executable program Resource compression, this concept source are one section of codes of implantation in binary program, are running in the executable program at the end PC When preferentially obtain the control of program, do some extra works.The APK shell adding mode spread on the net now is using conjunction And the mode of dex file carries out, will solution shell dex file mergences on the head or tail portion of former dex file, then modify dex Relevant item in file header.What such shell adding mode was also carried out just for the encryption of dex file itself, original can not be increased The ability of first APK itself, and need to modify the file structure of dex, shell adding mode is complicated.Existing technology makes it difficult for enterprise clever It is living easily to customize and be transformed original enterprise mobile application.
Above content is only used to facilitate the understanding of the technical scheme, and is not represented and is recognized that above content is existing skill Art.
Summary of the invention
It is a primary object of the present invention to solve the technical problem to existing mobile application shell adding difficulty.
To achieve the above object, the method for a kind of extension APK file application provided by the invention, the extension APK file The method of application the following steps are included:
Obtain initial APK file and shelf document;
Decompiling processing is carried out to the initial APK file;
File destination identical with the file type of the shelf document is extracted from decompiling treated file;
The file destination and the shelf document are merged into processing;
By after merging treatment file and the initial APK file store to profile press from both sides, and be packaged building it is described pre- Setting file is target APK file.
Preferably, the file destination includes the first xml document and first resource file, and the shelf document includes second Xml document and Secondary resource file;
It is described processing is merged to the file destination and the shelf document to include:
Parse first xml document and second xml document;
First xml document and the identical content of the second xml document interior joint type are merged, and by institute The identical file of file type for stating subfile in first resource file and the Secondary resource file merges;
File after merging treatment is stored to profile folder and includes:
First xml document and the identical content of the second xml document interior joint type are merged and handled To file store with the file for not merging processing to the profile and presss from both sides;
The identical file of the file type of subfile in the first resource file and the Secondary resource file is carried out The file that merging treatment obtains stores with the file for not merging processing into profile folder.
Preferably, the file by after merging treatment and the initial APK file are stored to profile and are pressed from both sides, and are packaged Before constructing the step of profile folder is target APK file further include:
Preset mark information is added in the xml document of profile folder.
Preferably, after described the step of carrying out decompiling processing to initial APK file further include:
The file type for obtaining the initial APK file judges whether the type of the APK file is APK type;
If the type of the initial APK file is APK type, the xml document of the initial APK file is obtained, judges institute It states in xml document with the presence or absence of preset mark information;
When preset mark information is not present in the xml document, execute described from decompiling treated file Extract file destination identical with the file type of the shelf document.
Preferably, the file by after merging treatment and the initial APK file are stored to profile and are pressed from both sides, and are packaged Before constructing the step of profile folder is target APK file further include:
The filename that the profile presss from both sides is revised as consistent with the filename of the initial APK file.
In addition, to achieve the above object, the present invention also provides a kind of device of extension APK file application, the extension APK File application device include:
Module is obtained, for obtaining initial APK file and shelf document;
Decompilation module, for carrying out decompiling processing to the initial APK file;
Extraction module, for extracting mesh identical with the file type of the shelf document from decompiling treated file Mark file;
Merging module, for the file destination and the shelf document to be merged processing;
Be packaged building module: for by after merging treatment file and the initial APK file store to profile press from both sides, And being packaged the building profile folder is target APK file.
Preferably, the merging module includes:
Resolution unit, for parsing first xml document and second xml document;
Combining unit, for by first xml document and the identical content of the second xml document interior joint type into Row merges, and the identical file of the file type of subfile in the first resource file and the Secondary resource file is carried out Merge;
The packing building module is specifically used for first xml document and the second xml document interior joint type Identical content merges the file that processing obtains and stores with the file for not merging processing to profile folder In;
The identical file of the file type of subfile in the first resource file and the Secondary resource file is carried out The file that merging treatment obtains stores with the file for not merging processing into profile folder.
Preferably, the device of the extension APK file application further include:
Mark module, for adding preset mark information in the xml document that the profile presss from both sides.
Preferably, the device of the extension APK file application further include:
First judgment module judges the type of the APK file for obtaining the file type of the initial APK file It whether is APK type;
Second judgment module obtains the initial APK file if the type for the initial APK file is APK type Xml document, judge in the xml document with the presence or absence of preset mark information;
Second judgment module is also used to, when preset mark information is not present in the xml document, extraction module File destination identical with the file type of the shelf document is extracted from decompiling treated file.
Preferably, which is characterized in that the device of the extension APK file application further include:
Replacement module, the filename for pressing from both sides the profile are revised as the filename with the initial APK file Unanimously.
The present embodiment obtains the first xml document and first resource file by first carrying out decompiling to initial APK file, so The second xml document to the first xml document and to shell adding the processing such as merges, to first resource file and Secondary resource text afterwards Part merge etc. handle and will treated that file is stored into profile folder, finally profile folder is packaged and is built into mesh APK file is marked, the function to shell adding is attached to the purpose in initial APK file to realize, is had no need to change in the process The source code of initial APK file, the file structure for also not needing modification dex, so that increasing new function to existing mobile application When it is flexible and convenient, it is simple and easy, be conducive to the more simple and efficient customization of enterprise and the original enterprise mobile application of transformation.
Detailed description of the invention
Fig. 1 is the flow diagram of the method first embodiment of present invention extension APK file application;
Fig. 2 is the flow diagram of the method second embodiment of present invention extension APK file application;
Fig. 3 is the flow diagram of the method 3rd embodiment of present invention extension APK file application;
Fig. 4 is the flow diagram of the method fourth embodiment of present invention extension APK file application;
Fig. 5 is the flow diagram of the 5th embodiment of method of present invention extension APK file application;
Fig. 6 is the functional block diagram of the device first embodiment of present invention extension APK file application;
Fig. 7 is the functional block diagram of the device second embodiment of present invention extension APK file application;
Fig. 8 is the functional block diagram of the device 3rd embodiment of present invention extension APK file application;
Fig. 9 is the functional block diagram of the device fourth embodiment of present invention extension APK file application;
Figure 10 is the functional block diagram of the 5th embodiment of device of present invention extension APK file application.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present invention provides a kind of method of extension APK file application, and referring to Figures 1 and 2, Fig. 1 is present invention extension APK text The flow diagram of the method first embodiment of part application;Fig. 2 is the method second embodiment of present invention extension APK file application Flow diagram.
The present invention is by existing initial APK file, in addition the shell of pre-expansion function, to realize the initial APK of extension The function of file, specific step is as follows for method, and wherein APK file is the executable file under android system.
In one embodiment, extension APK file application method the following steps are included:
S10: initial APK file and shelf document are obtained;
The initial APK file that user prepares shell adding is received, receives the instruction that user selects shelf document, according to the user's choice Instruction, extracts required shelf document from shelf document library.
S20: decompiling is carried out to initial APK file;
S30: file destination identical with the file type of shelf document is extracted from decompiling treated file;
Decompiling is also referred to as computer software reduction engineering, refers to through the target program (executable program) to other people softwares Carry out " conversed analysis, research " work.In the present embodiment, the initial APK file of decompiling only obtains readable first AndroidManifest.xml file and first resource file, without decompiling java code, the dex in initial APK file is literary Part is also without decompiling, in subsequent steps it is recognised that do not need to be compiled the code of initial APK file can Increase function to be embodied as initial APK file.First AndroidManifest.xml file and first resource file and shelf document In the 2nd AndroidManifest.xml file and Secondary resource file it is corresponding.It is utilized during decompiling just Beginning APKtool (APKTool be GOOGLE provide APK compilation tool, can decompiling and return compiling apk) provide file. By the initial APK file of decompiling, necessary constituent instruments are provided to be packaged the new APK file of building.
In the present embodiment, for shelf document by taking SSL VPN as an example, SSL VPN is to solve remote user access sensitivity company data Most simple safest solution technology.Wherein, SSL (Secure Socket Layer) agreement is that one kind guarantees to send information on internet The puppy parc of safety, using B/S structure (Browser/Server, Browser/Server Mode);The full name in English of VPN is " Virtual Private Network ", is exactly " Virtual Private Network ".Known SSL VPN shell to be added is parsed, and Obtain the 2nd AndroidManifest.xml file and Secondary resource file of shell.Certainly, in other embodiments, shelf document It is not limited only to SSL VPN.By parsing SSL VPN shell, necessary text substantially is provided to be packaged the new initial APK file of building Part.
S40: file destination and shelf document are merged into processing;
File destination includes the first xml document and first resource file of initial APK file, and shelf document includes the 2nd xml File and Secondary resource file;
File destination and shelf document are merged processing to specifically include:
S41: the first xml document of parsing and the second xml document;
In the present embodiment, the first xml document is the first AndroidManifest.xml file, and the second xml document is second AndroidManifest.xml file;Initial APK file can be obtained after parsing the first AndroidManifest.xml file First MainActivity information, the first Application information and the first AndroidManifest.xml file its Its information, wherein further including the packet name of initial APK file;After parsing the 2nd AndroidManifest.xml file, it can obtain The 2nd MainActivity information, the 2nd Application information and second of SSL VPN shell The other information of AndroidManifest.xml file.
S42: the first xml document and the identical content of the second xml document interior joint type are merged, and first is provided The identical file of file type of subfile merges in source file and Secondary resource file;
By the 2nd MainActivity information of the first MainActivity information of initial APK file and SSL VPN shell It merges, during merging, the first MainActivity information and the 2nd MainActivity is ranked up, are The shell side sequence for first carrying out SSL VPN, the 2nd MainActivity is arranged in front of the first MainActivity, and it will It is set as starting activity, i.e. setting " android.intent.action.MAIN " and " android.intent.categ Ory.LAUNCHER ", so that first carrying out SSL VPN before executing initial APK file;By the first of initial APK file Others activity node merges one in Application information and the 2nd Application information of SSL VPN shell It rises, during merging, android:name is appointed as shell engineering and inherits the complete of android.app.Application Class name.
In the present embodiment, first resource file includes the first strings.xml file, and Secondary resource file includes second Strings.xml file merges the first strings.xml file and the 2nd strings.xml file, and will be after merging File store to profile folder in.File after merging not only contains the first strings.xml file and second The information such as the packet name of original apk file, and starting activity are also recorded in strings.xml file full content.
S50: by after merging treatment file and initial APK file store to profile and press from both sides, and be packaged the preset text of building Part folder is target APK file;
File after merging treatment is stored to profile folder and includes:
First xml document and the identical content of the second xml document interior joint type are merged and handled To file store to the profile folder in;By subfile in the first resource file and the Secondary resource file The identical file of file type merges the file that processing obtains and stores with the file for not merging processing to described pre- It sets in file.
The content not merged in first resource file is stored to profile and is pressed from both sides.In the present embodiment, by first resource text File in part in addition to the first strings.xml file is copied in Secondary resource file and is saved under corresponding catalogue, then will The first resource file and Secondary resource file being combined are stored into profile folder.
Merge the item not merged in the first xml document and the second xml document.First will be parsed The other information in the first AndroidManifest.xml file obtained after AndroidManifest.xml file and parsing Other information in the 2nd AndroidManifest.xml file obtained after 2nd AndroidManifest.xml file closes Together, and by the file after being combined store into profile folder.By by the file destination of initial APK file and SSL VPN shelf document merges, and provides important component part to be packaged the new target APK file of building, is new mesh It marks APK starting and driving is provided.
It is merged by the file destination of initial APK file and SSL VPN shelf document, and stores to profile and press from both sides After, it is also necessary to initial APK file is copied under profile folder.Initial APK file provides initially for target APK file The function that APK file possessed originally.During being packaged profile folder, needs to call apktool and (Ant is using ant A kind of build tool based on Java).
Above-mentioned is the process for adding a shell to an initial APK file of mobile application, when initial APK file needs to increase it When the shell of its function, using target APK file as original document, select other shelf documents, then according to above-mentioned method and Step carries out.
The present embodiment obtains the first xml document and first resource file by first carrying out decompiling to initial APK file, so The second xml document to the first xml document and to shell adding the processing such as merges, to first resource file and Secondary resource text afterwards Part merge etc. handle and will treated that file is stored into profile folder, finally profile folder is packaged and is built into mesh APK file is marked, the function to shell adding is attached to the purpose in initial APK file to realize, is had no need to change in the process The source code of initial APK file, the file structure for also not needing modification dex, so that increasing new function to existing mobile application When it is flexible and convenient, it is simple and easy, be conducive to the more simple and efficient customization of enterprise and the original enterprise mobile application of transformation.
Referring to the flow diagram for the method 3rd embodiment that Fig. 3, Fig. 3 are present invention extension APK file application.
On the basis of the above embodiments, before executing step S50, the present invention extends the method for APK file application also Include:
S60: preset mark information is added in the xml document of profile folder;
In the present embodiment, before the file preferably not merged in merging the first xml document and the second xml document, generate The icon icon of target Apk.Icon generation is the modification to initial APK file icon icon.In the figure for handling initial APK file During target, using the icon of initial APK file as the icon main body of target APK file, and the addition pair in icon main body Shell adding is answered to mark.In the present embodiment, xml document is preferably AndroidManifest.xml file, by the label of corresponding function shell Information is added in AndroidManifest.xml file.To a kind of mark information, the type of mark information can for a kind of function shell To preset according to the demand of user.
The mark information that function shell is represented by being added in initial APK file AndroidManifest.xml file, makes It obtains target APK file and is different from initial APK file, and make it possible to from target APK file AndroidManifest.xml file In identify function shell added by this APK file, to be conducive to avoid carrying out same APK file to repeat shell adding.
Referring to the flow diagram for the method fourth embodiment that Fig. 4, Fig. 4 are present invention extension APK file application.
On the basis of the above embodiments, before executing step S20, the present invention extends the method for APK file application also Include:
S70: obtaining the file type of initial APK file, judges whether the type of APK file is APK type;
S80: if the type of initial APK file is APK type, the xml document of initial APK file is obtained, judges xml document It is interior to whether there is preset mark information;When preset mark information is not present in xml document, extraction module is from decompiling place File destination identical with the file type of shelf document is extracted in file after reason.
In the present embodiment, xml document is preferably AndroidManifest.xml file, is carried out instead to initial APK file Before compiling, it is also necessary to be detected to initial APK file, to judge whether the initial APK file for being intended to decompiling meets anti-volume The requirement translated.Specifically, judge whether initial APK file meets decompiling and require to include the following aspects:
First, it is determined that whether this file is genuine initial APK file, whether a file is qualified initial APK file, Cannot only it judge from suffix name, after suffix name is changed to initial APK by other files, this file also will be displayed as initial APK text Part.For example, word document just becomes initial APK in form after the suffix name doc of word document is modified as initial APK File.This part judgement be first to obtain the file type of initial APK file, then judge APK file type whether be APK type then continues following judgement if it is APK type, if not APK type, then exits cryptor.Certainly, sentence Whether disconnected APK file is that genuine APK file can also be carried out by decompiling, by will not be that the suffix name of apk file changes For .apk, decompiling instrument can provide related prompt.
Then, judge to be intended in the initial APK file of shell adding whether include shelf document function, be to pass through inspection in the present embodiment Whether survey in initial APK file includes the corresponding identification information of shelf document to complete judgement.Whether one initial APK file accords with Shell adding requirement is closed, other than determining that this file is very initial APK file, also needs to judge whether this initial APK file needs to increase The function of shelf document no longer needs if detecting that initial APK file has been provided with the function of shelf document to same initial APK file increases same shelf document and adds if not detecting the identification information of shelf document to initial APK file Shell processing.Specifically, the AndroidManifest.xml file for obtaining APK file first, then judges It whether include presetting mark information corresponding with shelf document in AndroidManifest.xml file, if it is present no longer right Initial APK file carries out shell adding, if it does not exist, then carrying out subsequent processing to the initial APK file after decompiling.
By judging the legitimacy of initial APK file, effectively before extracting the initial APK file after decompiling The file for eliminating non-APK type, avoid and extra processing carried out to the file of non-APK type;Initial APK file is added The necessity of shell is judged, has been effectively prevented the operation for carrying out weight shell adding to initial APK file, has been improved to mobile application The efficiency of shell adding.
Referring to the flow diagram for the 5th embodiment of method that Fig. 5, Fig. 5 are present invention extension APK file application.
On the basis of the above embodiments, before executing step S50, the present invention extends the method for APK file application also Include:
S90: the filename that profile presss from both sides is revised as consistent with the filename of initial APK file;
In the present embodiment, the file preferably not merged in merging the first xml document and the second xml document that has it Before, define the filename of the entitled initial APK file of file of profile folder.When defining the filename of profile folder, it is The filename of profile folder before being packaged building is defined as initial APK by better identification and performance objective APK file The filename of file.When parsing an AndroidManifest.xml, the raw filename of initial APK file is obtained, and will The filename of profile folder is substituted for the filename of initial APK file.It is defined as just by the filename for pressing from both sides profile The filename of beginning APK file, so that the filename for being packaged the target APK file of building is identical as the filename of initial APK file, Be conducive to identification of the user to target APK file.
During target APK operation, due to having modified AndroidManifest file, target APK can start first The attachBaseContext method in specified Application subclass is executed, in the method will MClassLoader in android.app.LoadApk is directed toward initial APK file.Then, initial APK file if there is Application subclass then executes the Application of itself.First Activity of starting plus the application of SSL VPN shell, Show the login interface of VPN.After inputting correct username and password, SSL VPN is successfully logged in, is started later First Activity of the initial APK file that mClassLoader is directed toward.Then, initial APK can begin to use, only former The network interaction of application can all walk encrypted SSL vpn tunneling.
The present invention further provides a kind of devices of extension APK file application.
Referring to figure 6 and figure 7, Fig. 6 is the functional module signal of the device first embodiment of present invention extension APK file application Figure;Fig. 7 is the functional block diagram of the device second embodiment of present invention extension APK file application.
In one embodiment, the device of extension APK file application includes:
Module 10 is obtained, for obtaining initial APK file and shelf document;
The initial APK file that user prepares shell adding is received, receives the instruction that user selects shelf document, according to the user's choice Instruction, shelf document needed for being extracted from shelf document library.
Decompilation module 20 is used for the initial APK file of decompiling, and obtains the file destination of the initial APK file;
Extraction module 30, for extracting target identical with the file type of shelf document from decompiling treated file File;
Decompiling is also referred to as computer software reduction engineering, refers to through the target program (executable program) to other people softwares Carry out " conversed analysis, research " work.In the present embodiment, the initial APK file of decompiling only obtains readable first AndroidManifest.xml file and first resource file, without decompiling java code, the dex in initial APK file is literary Part is also without decompiling, in subsequent steps it is recognised that do not need to be compiled the code of initial APK file can Increase function to be embodied as initial APK file.First AndroidManifest.xml file and first resource file and shelf document In the 2nd AndroidManifest.xml file and Secondary resource file it is corresponding.It is utilized during decompiling just The file that beginning APKtool provides.By the initial APK file of decompiling, provided for the new initial APK file of packing building necessary Constituent instruments.
In the present embodiment, for shelf document by taking SSL VPN as an example, SSL VPN is to solve remote user access sensitivity company data Most simple safest solution technology.Wherein, SSL (Secure Socket Layer) agreement is that one kind guarantees to send information on internet The puppy parc of safety, using B/S structure (Browser/Server, Browser/Server Mode);The full name in English of VPN is " Virtual Private Network ", is exactly " Virtual Private Network ".Known SSL VPN shell to be added is parsed, and Obtain the 2nd AndroidManifest.xml file and Secondary resource file of shell.Certainly, in other embodiments, shelf document It is not limited only to SSL VPN.By parsing SSL VPN shell, necessary text substantially is provided to be packaged the new initial APK file of building Part.
File destination and shelf document are merged processing by merging module 40;
File destination includes the first xml document and first resource file of initial APK file, and shelf document includes the 2nd xml File and Secondary resource file;
File destination and shelf document are merged processing to specifically include:
Resolution unit 41: for parsing the first xml document and the second xml document;
In the present embodiment, the first xml document is the first AndroidManifest.xml file, and the second xml document is second AndroidManifest.xml file;Initial APK file can be obtained after parsing the first AndroidManifest.xml file First MainActivity information, the first Application information and the first AndroidManifest.xml file its Its information, wherein further including the packet name of initial APK file;After parsing the 2nd AndroidManifest.xml file, it can obtain The 2nd MainActivity information, the 2nd Application information and second of SSL VPN shell The other information of AndroidManifest.xml file.
Combining unit 42: the first xml document and the identical content of the second xml document interior joint type are merged, and The identical file of file type of subfile in first resource file and Secondary resource file is merged;
By the 2nd MainActivity information of the first MainActivity information of initial APK file and SSL VPN shell It merges, during merging, the first MainActivity information and the 2nd MainActivity is ranked up, are The shell side sequence for first carrying out SSL VPN, the 2nd MainActivity is arranged in front of the first MainActivity, and it will It is set as starting activity, i.e. setting " android.intent.action.MAIN " and " android.intent.categ Ory.LAUNCHER ", so that first carrying out SSL VPN before executing initial APK file;By the first of initial APK file Activity node in Application information and the 2nd Application information of SSL VPN shell merges, and It is stored into preset file, during merging, android:name is appointed as shell engineering and is inherited The complete class name of android.app.Application.
In the present embodiment, first resource file includes the first strings.xml file, and Secondary resource file includes second Strings.xml file merges the first strings.xml file and the 2nd strings.xml file, and will be after merging File store to profile folder in.File after merging not only contains the first strings.xml file and second The information such as the packet name of original apk file, and starting activity are also recorded in strings.xml file full content.
Be packaged building module 50, for by after merging treatment file and initial APK file store to profile press from both sides, and Being packaged building profile folder is target APK file;
File after merging treatment is stored to profile folder and includes:
First xml document and the identical content of the second xml document interior joint type are merged and handled To file store with the file for not merging processing to the profile and presss from both sides;By the first resource file and institute The identical file of file type for stating subfile in Secondary resource file, which merges, to be handled obtained file and does not merge The file of processing stores into profile folder.
The content not merged in first resource file is stored to Secondary resource file, and stores to profile and presss from both sides. In the present embodiment, by the file in first resource file in addition to the first strings.xml file, Secondary resource file is copied to In save under corresponding catalogue, then the first resource file being combined and Secondary resource file are stored into profile folder In.
Merge the file not merged in the first xml document and the second xml document, and stores to profile and press from both sides.It will parsing The other information in the first AndroidManifest.xml file that is obtained after first AndroidManifest.xml file and Parse other letters in the 2nd AndroidManifest.xml file obtained after the 2nd AndroidManifest.xml file Breath is combined, and the file after being combined is stored into profile folder.By by the file destination of initial APK file It is merged with the shelf document of SSL VPN file, provides important component part to be packaged the new target APK file of building, Driving is provided for new target APK starting.
It merges, and stores to preset by the shelf document of the file destination of initial APK file and SSL VPN file After file, it is also necessary to copy initial APK file under profile folder to.Initial APK file provides for target APK file The function that initial APK file possessed originally.During being packaged profile folder, needs to call apktool and use ant (Ant is a kind of build tool based on Java).
Above-mentioned is the process for adding a shell to an initial APK file of mobile application, when initial APK file needs to increase it When the shell of its function, using target APK file as original document, select other shelf documents, then according to above-mentioned method and Step carries out.
The present embodiment obtains the first xml document and first resource file by first carrying out decompiling to initial APK file, so The second xml document to the first xml document and to shell adding the processing such as merges, to first resource file and Secondary resource text afterwards Part merge etc. handle and will treated that file is stored into profile folder, finally profile folder is packaged and is built into mesh APK file is marked, the function to shell adding is attached to the purpose in initial APK file to realize, is had no need to change in the process The source code of initial APK file, the file structure for also not needing modification dex, so that increasing new function to existing mobile application When it is flexible and convenient, it is simple and easy, be conducive to the more simple and efficient customization of enterprise and the original enterprise mobile application of transformation.
Referring to the flow diagram for the device 3rd embodiment that Fig. 8, Fig. 8 are present invention extension APK file application.
On the basis of the above embodiments, the present invention extends the device of APK file application further include:
Mark module 60 adds preset mark information in the xml document of profile folder;
In the present embodiment, before the file preferably not merged in merging the first xml document and the second xml document, generate The icon icon of target Apk.Icon generation is the modification to initial APK file icon icon.In the figure for handling initial APK file During target, using the icon of initial APK file as the icon main body of target APK file, and the addition pair in icon main body Shell adding is answered to mark.In the present embodiment, xml document is preferably AndroidManifest.xml file, by the label of corresponding function shell Information is added in AndroidManifest.xml file.To a kind of mark information, the type of mark information can for a kind of function shell To preset according to the demand of user.
The mark information that function shell is represented by being added in initial APK file AndroidManifest.xml file, makes It obtains target APK file and is different from initial APK file, and make it possible to from target APK file AndroidManifest.xml file In identify function shell added by this APK file, to be conducive to avoid carrying out same APK file to repeat shell adding.
Referring to the flow diagram for the device fourth embodiment that Fig. 9, Fig. 9 are present invention extension APK file application.
On the basis of the above embodiments, the present invention extends the device of APK file application further include:
First judgment module 70, for obtaining the file type of initial APK file, judge APK file type whether be APK type;
Second judgment module 80 obtains the xml of initial APK file if the type for initial APK file is APK type File judges in xml document with the presence or absence of preset mark information;Second judgment module 80 is also used to not deposit in xml document In preset mark information, extraction module extracts identical with the file type of shelf document from decompiling treated file File destination.
In the present embodiment, xml document is preferably AndroidManifest.xml file, is carried out instead to initial APK file Before compiling, it is also necessary to be detected to initial APK file, to judge whether the initial APK file for being intended to decompiling meets anti-volume The requirement translated.Specifically, judge whether initial APK file meets decompiling and require to include the following aspects:
First, it is determined that whether this file is genuine initial APK file, whether a file is qualified initial APK file, Cannot only it judge from suffix name, after suffix name is changed to initial APK by other files, this file also will be displayed as initial APK text Part.For example, word document just becomes initial APK in form after the suffix name doc of word document is modified as initial APK File.This part judgement be first to obtain the file type of initial APK file, then judge APK file type whether be APK type then continues following judgement if it is APK type, if not APK type, then exits cryptor.Certainly, sentence Whether disconnected APK file is that genuine APK file can also be carried out by decompiling, by will not be that the suffix name of apk file changes For .apk, decompiling instrument can provide related prompt.
Then, judge to be intended in the initial APK file of shell adding whether include shelf document function, be to pass through inspection in the present embodiment Whether survey in initial APK file includes the corresponding identification information of shelf document to complete judgement.Whether one initial APK file accords with Shell adding requirement is closed, other than determining that this file is very initial APK file, also needs to judge whether this initial APK file needs to increase The function of shelf document no longer needs if detecting that initial APK file has been provided with the function of shelf document to same initial APK file increases same shelf document and adds if not detecting the identification information of shelf document to initial APK file Shell processing.Specifically, the AndroidManifest.xml file for obtaining APK file first, then judges It whether include presetting mark information corresponding with shelf document in AndroidManifest.xml file, if it is present no longer right Initial APK file carries out shell adding, if it does not exist, then extracting to initial APK file.
By judging the legitimacy of initial APK file, effectively before extracting the initial APK file after decompiling The file for eliminating non-APK type, avoid and extra processing carried out to the file of non-APK type;Initial APK file is added The necessity of shell is judged, has been effectively prevented the operation for carrying out weight shell adding to initial APK file, has been improved to mobile application The efficiency of shell adding.
0, Figure 10 is the flow diagram of the 5th embodiment of device of present invention extension APK file application referring to Fig.1.
On the basis of the above embodiments, the present invention extends the device of APK file application further include:
Replacement module 90, the filename for pressing from both sides profile are revised as consistent with the filename of initial APK file;
In the present embodiment, the file preferably not merged in merging the first xml document and the second xml document that has it Before, define the filename of the entitled initial APK file of file of profile folder.When defining the filename of profile folder, it is The filename of profile folder before being packaged building is defined as initial APK by better identification and performance objective APK file The filename of file.When parsing an AndroidManifest.xml, the raw filename of initial APK file is obtained, and will The filename of profile folder is substituted for the filename of initial APK file.It is defined as just by the filename for pressing from both sides profile The filename of beginning APK file, so that the filename for being packaged the target APK file of building is identical as the filename of initial APK file, Be conducive to identification of the user to target APK file.
During target APK operation, due to having modified AndroidManifest file, target APK can start first The attachBaseContext method in specified Application subclass is executed, in the method will MClassLoader in android.app.LoadApk is directed toward initial APK file.Then, initial APK file if there is Application subclass then executes the Application of itself.First Activity of starting plus the application of SSL VPN shell, Show the login interface of VPN.After inputting correct username and password, SSL VPN is successfully logged in, is started later First Activity of the initial APK file that mClassLoader is directed toward.Then, initial APK can begin to use, only former The network interaction of application can all walk encrypted SSL vpn tunneling.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (8)

1. it is a kind of extension APK file application method, which is characterized in that extension APK file application method the following steps are included:
Obtain initial APK file and shelf document;
Decompiling processing is carried out to the initial APK file;
File destination identical with the file type of the shelf document is extracted from decompiling treated file;The target text Part includes the first xml document and first resource file, and the shelf document includes the second xml document and Secondary resource file;
The file destination and the shelf document are merged into processing;It is described that the file destination and the shelf document are carried out Merging treatment includes:
Parse first xml document and second xml document;
First xml document and the identical content of the second xml document interior joint type are merged, and by described The identical file of file type of subfile merges in one resource file and the Secondary resource file;
File after merging treatment is stored to profile folder and includes:
First xml document and the identical content of the second xml document interior joint type are merged what processing obtained File and the file for not merging processing store into profile folder;
The identical file of file type of subfile in the first resource file and the Secondary resource file is merged It handles obtained file and stores with the file for not merging processing into profile folder;
By after merging treatment file and the initial APK file store to profile and press from both sides, and be packaged the building preset text Part folder is target APK file.
2. the method for extension APK file application as described in claim 1, which is characterized in that the text by after merging treatment Part and the initial APK file, which are stored to profile, presss from both sides, and is packaged the step for constructing that the profile folder is target APK file Before rapid further include:
Preset mark information is added in the xml document of profile folder.
3. the method for extension APK file application as claimed in claim 2, which is characterized in that carried out to the initial APK file After the step of decompiling is handled further include:
The file type for obtaining the initial APK file judges whether the type of the APK file is APK type;
If the type of the initial APK file is APK type, the xml document of the initial APK file is obtained, judges the xml It whether there is preset mark information in file;
When preset mark information is not present in the xml document, executes and described extracted from decompiling treated file File destination identical with the file type of the shelf document.
4. the method that the extension APK file as described in any one of claims 1 to 3 is applied, which is characterized in that described to close And treated file and the initial APK file are stored to profile and are pressed from both sides, and being packaged the building profile folder is mesh Before the step of marking APK file further include:
The filename that the profile presss from both sides is revised as consistent with the filename of the initial APK file.
5. it is a kind of extension APK file application device, which is characterized in that it is described extension APK file application device include:
Module is obtained, for obtaining initial APK file and shelf document;
Decompilation module, for carrying out decompiling processing to the initial APK file;
Extraction module, for extracting target identical with the file type in the shelf document from decompiling treated file File;The file destination includes the first xml document and first resource file, and the shelf document includes the second xml document and the Two resource files;
Merging module, for the file destination and the shelf document to be merged processing;
Be packaged building module: for by after merging treatment file and the initial APK file store to profile and press from both sides, and beat It is target APK file that packet, which constructs the profile folder,;
The merging module includes:
Resolution unit, for parsing first xml document and second xml document;
Combining unit, for closing first xml document and the identical content of the second xml document interior joint type And and the identical file of file type of subfile in the first resource file and the Secondary resource file is closed And;
The packing building module is specifically used for first xml document is identical with the second xml document interior joint type Content merge the obtained file of processing and store with the file for not merging processing to the profile and press from both sides;
The identical file of file type of subfile in the first resource file and the Secondary resource file is merged It handles obtained file and stores with the file for not merging processing into profile folder.
6. the device of extension APK file application as claimed in claim 5, which is characterized in that the extension APK file application Device further include:
Mark module, for adding preset mark information in the xml document that the profile presss from both sides.
7. the device of extension APK file application as claimed in claim 6, which is characterized in that the extension APK file application Device further include:
First judgment module, for obtaining the file type of the initial APK file, judge the APK file type whether For APK type;
Second judgment module obtains the initial APK file if the type for the initial APK file is APK type Xml document judges in the xml document with the presence or absence of preset mark information;
Second judgment module is also used to, and when preset mark information is not present in the xml document, extraction module is from anti- File destination identical with the file type of the shelf document is extracted in file after process of compilation.
8. the device that the extension APK file as described in any one of claim 5 to 7 is applied, which is characterized in that the extension The device of APK file application further include:
Replacement module, the filename for pressing from both sides the profile are revised as consistent with the filename of the initial APK file.
CN201410529570.XA 2014-10-08 2014-10-08 Extend the method and device of APK file application Active CN105574000B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201410529570.XA CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application
PCT/CN2015/071471 WO2016054880A1 (en) 2014-10-08 2015-01-23 Apk file application expanding method and device
PCT/CN2015/074404 WO2015154612A1 (en) 2014-10-08 2015-03-17 Method and device for extending apk file application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410529570.XA CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application

Publications (2)

Publication Number Publication Date
CN105574000A CN105574000A (en) 2016-05-11
CN105574000B true CN105574000B (en) 2019-11-05

Family

ID=54287312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410529570.XA Active CN105574000B (en) 2014-10-08 2014-10-08 Extend the method and device of APK file application

Country Status (2)

Country Link
CN (1) CN105574000B (en)
WO (2) WO2016054880A1 (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020725B (en) * 2016-05-20 2019-07-12 努比亚技术有限公司 Application file processing unit and method
CN106325917B (en) * 2016-08-09 2019-12-06 盛趣信息技术(上海)有限公司 method and system for realizing module access by reverse program
CN107992265A (en) * 2016-10-27 2018-05-04 中兴通讯股份有限公司 A kind of method of inspection and device of the source file of application program
CN106775842B (en) * 2016-11-30 2020-02-11 北京酷我科技有限公司 Customizable dex subpackaging method
CN107908964B (en) * 2017-10-17 2021-06-08 珠海金山网络游戏科技有限公司 Security detection method and device for shell files in Android platform Unity3D game
CN108154011A (en) * 2018-01-12 2018-06-12 广州汇智通信技术有限公司 Hulling method, system, equipment and readable storage medium storing program for executing based on art patterns
CN109117175B (en) * 2018-07-31 2022-01-28 成都华栖云科技有限公司 APK decompilation-based desktop end packaging method and packaging tool for fast packaging
CN110941443B (en) * 2019-12-12 2023-03-17 支付宝(中国)网络技术有限公司 Method and device for modifying file name in SDK (software development kit) and electronic equipment
CN111045686B (en) * 2019-12-16 2023-05-30 北京智游网安科技有限公司 Method for improving decompilation speed of application, intelligent terminal and storage medium
CN112099880B (en) * 2020-08-12 2021-07-30 北京大学 Method and system for reducing application program driven by scene
US11972244B2 (en) 2020-11-13 2024-04-30 Iron Gaming Limited Method and apparatus for improving a mobile application
CN113721929A (en) * 2021-08-11 2021-11-30 安徽帕觅智能科技有限公司 Method for automatically implanting common code into Android App
CN113934460A (en) * 2021-10-12 2022-01-14 郑州阿帕斯数云信息科技有限公司 Resource providing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177077A (en) * 2013-01-08 2013-06-26 杭州米加科技有限公司 APK file storing and outputting method
CN103530535A (en) * 2013-10-25 2014-01-22 苏州通付盾信息技术有限公司 Shell adding and removing method for Android platform application program protection
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101391982B1 (en) * 2012-08-28 2014-05-07 바른소프트기술 주식회사 Encryption method for preventing decompile of andriod application
US9535674B2 (en) * 2012-12-21 2017-01-03 Bmc Software, Inc. Application wrapping system and method
WO2014142430A1 (en) * 2013-03-15 2014-09-18 주식회사 에스이웍스 Dex file binary obfuscation method in android system
CN103761457A (en) * 2013-12-27 2014-04-30 华为技术有限公司 Software protecting method, device and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177077A (en) * 2013-01-08 2013-06-26 杭州米加科技有限公司 APK file storing and outputting method
CN103530535A (en) * 2013-10-25 2014-01-22 苏州通付盾信息技术有限公司 Shell adding and removing method for Android platform application program protection
CN103886230A (en) * 2014-02-24 2014-06-25 四川长虹电器股份有限公司 Software copyright protection method of android system and system thereof

Also Published As

Publication number Publication date
WO2016054880A1 (en) 2016-04-14
CN105574000A (en) 2016-05-11
WO2015154612A1 (en) 2015-10-15

Similar Documents

Publication Publication Date Title
CN105574000B (en) Extend the method and device of APK file application
US10684943B2 (en) Generating executable test automation code automatically according to a test case
Catal et al. Practical development of an Eclipse-based software fault prediction tool using Naive Bayes algorithm
RU2497189C2 (en) System and method to detect malicious software
US9569177B2 (en) Service extraction and application composition
US20110246964A1 (en) Archiving a Build Product
CN104809056B (en) A kind of generation method and device of interface testing code
CN104134039B (en) Checking and killing virus method, client, server and checking and killing virus system
Obbink et al. An extensible approach for taming the challenges of JavaScript dead code elimination
CN106502746A (en) The packaging method and device of application program
RU2004100525A (en) METHOD AND SYSTEM FOR RECORDING MACROS IN SYNTAXIS, INDEPENDENT ON THE LANGUAGE
KR20170112171A (en) Framework supporting apparatus for developing client application under multi-platform environment, and method using the same
Fujiwara et al. Kataribe: A hosting service of historage repositories
Idani et al. B for modeling secure information systems: the b4msecure platform
Santos et al. Design annotations to improve API discoverability
CN105577720A (en) Method and system for packaging mobile application
JP2010267266A (en) Test support device and test support method
US8719766B1 (en) System and method for identifying and adding files to a project manifest
CN110287089B (en) Microkernel IPC (inter-processor communication protocol) verification method based on intermediate format and SMT (surface mount technology)
Grigera et al. Live versioning of web applications through refactoring
Yang et al. Kernelgpt: Enhanced kernel fuzzing via large language models
US20210382810A1 (en) Test data generation apparatus, test data generation method and program
Kroustek et al. Accurate retargetable decompilation using additional debugging information
Rawat et al. Listt: An investigation into unsound-incomplete yet practical result yielding static taintflow analysis
Al-Kofahi et al. Escaping AutoHell: a vision for automated analysis and migration of autotools build systems

Legal Events

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