CN113836495A - Method for equivalently converting Java code into C + + code - Google Patents
Method for equivalently converting Java code into C + + code Download PDFInfo
- Publication number
- CN113836495A CN113836495A CN202111124659.4A CN202111124659A CN113836495A CN 113836495 A CN113836495 A CN 113836495A CN 202111124659 A CN202111124659 A CN 202111124659A CN 113836495 A CN113836495 A CN 113836495A
- Authority
- CN
- China
- Prior art keywords
- code
- codes
- app
- file
- java
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000006243 chemical reaction Methods 0.000 claims abstract description 9
- 230000003068 static effect Effects 0.000 claims abstract description 6
- 238000004806 packaging method and process Methods 0.000 claims abstract description 4
- 238000012545 processing Methods 0.000 claims abstract description 4
- 230000006870 function Effects 0.000 description 15
- 230000008569 process Effects 0.000 description 6
- 230000002787 reinforcement Effects 0.000 description 3
- 238000007596 consolidation process Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000005336 cracking Methods 0.000 description 1
- 230000006837 decompression Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 239000012634 fragment Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000003014 reinforcing effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/10—Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
- G06F21/12—Protecting executable software
- G06F21/14—Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/51—Source to source
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Technology Law (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The invention relates to the technical field of information security, in particular to a method for equivalently converting Java codes into C + + codes, which records a dex file to be unpacked by an APP as a set B; traversing all classes in the dex file in the set B, acquiring class names, function names and machine codes, and storing and recording the class names, the function names and the machine codes as a set C; converting Java machine codes into C + + codes through a custom llvm frame, writing the C + + codes into cpp files, further processing and compiling the cpp files to generate static library files, linking the static library files with preset basic library files to obtain dynamic library files F, deleting machine codes of elements in a set C, modifying function marks, and packaging the dynamic library files to obtain a set G; g, F is backfilled into the APP, and the conversion of Java codes into C + + codes is ended, compared with the prior art, the method and the device for protecting the APP codes have the advantage that the safety strength of the codes is improved through a new technical means aiming at the problem that the safety strength of the traditional APP code protection is not enough.
Description
Technical Field
The invention relates to the technical field of information security, in particular to a method for equivalently converting Java codes into C + + codes.
Background
Along with the high-speed development of the mobile internet, the mobile terminal APP becomes a necessity in the life of people, the APPs of various industries and companies form rich mobile life scenes, the life of people is greatly facilitated, a large number of safety problems emerge in the process of APP conversion of various services, source code leakage risks, core technology leakage, user fund safety, user personal information leakage and the like are involved, the mobile internet industry is always perfected and formulated by the nation in the process, the law is restricted in the mobile internet industry, and the essential needs are participated by technical means in the process of safety regulation and restriction of the industry through policy means.
The market has appeared a plurality of mobile security APP reinforcement technical schemes to protect the security of the mobile APP, wherein the confidentiality of the APP code belongs to one of the most basic protection means, the confidentiality of the code is generally ensured by integrally encrypting the code, but the code needs to be integrally decrypted and restored in the running process of the code, a plaintext code exists in a running memory, the whole plaintext code is easily intercepted by malicious personnel to obtain the whole plaintext code, a higher-level code protection means is developed later, a function in the code is independently encrypted without integrally encrypting the code, only a corresponding function is run to decrypt and restore, the technical means is greatly improved, an attacker cannot obtain a whole code file at one time, but the problem that the code is restored in the memory still exists, all function code fragments can be obtained through technical means, and then combination is carried out, so that most function codes can be obtained.
Therefore, a method for equivalently converting Java codes into C + + codes needs to be designed, which converts Java codes in APP into equivalent C + + codes, improves security, prevents APP from being statically decompiled to obtain source codes, and prevents APP from being dynamically debugged to obtain Java codes in memory; meanwhile, the APP performance, stability and compatibility of the reinforcement technology are superior to those of the original code protection means.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method for equivalently converting Java codes into C + + codes, wherein the Java codes in APP are converted into equivalent C + + codes, so that the safety is improved, the APP is prevented from being statically decompiled to obtain source codes, and the APP is prevented from being dynamically debugged to obtain Java codes in a memory; meanwhile, the APP performance, stability and compatibility of the reinforcement technology are superior to those of the original code protection means.
In order to achieve the above object, the present invention provides a method for equivalently converting Java code into C + + code, comprising the steps of:
s1, unpacking the APP to be processed, recording the APP as a set A and classifying the APP, and recording the dex file as a set B;
s2, traversing all classes in all dex files in the set B, acquiring class names, function names and machine codes, and storing and recording as a set C;
s3, traversing the class name, function name and machine code in the set C, converting the Java machine code into C + + code through a custom llvm frame, writing the C + + code into cpp file, and adding and recording the C + + code into the set D;
s4, further processing and compiling the cpp in the set D to finally generate a static library file which is marked as a file E;
s5, linking the file E with a preset basic library file to obtain a dynamic library file F;
s6, F is a final conversion result;
s7, traversing the set C, deleting the machine codes of the elements in the set C, modifying the function marks, and packaging the function marks to obtain a set G;
s8, backfilling G, F into the app, and ending the conversion from the Java code to the C + + code.
The APP is mobile terminal application software in an APK format.
And unpacking is to modify the file suffix of the APK package into ZIP and then decompress by using a decompressing tool.
Compared with the prior art, the method and the device have the advantages that aiming at the problem that the safety intensity of the traditional APP code protection is not enough, the safety intensity of the code is improved through a new technical means, and the following beneficial effects are realized:
preventing the APP from being statically decompiled;
preventing the APP from being dynamically debugged;
reducing performance consumption caused by consolidation;
the compatibility of the reinforced APP is improved;
promote the stability of reinforcing back APP.
Drawings
Fig. 1 is a schematic diagram of an APP consolidation process according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention will now be further described with reference to the accompanying drawings.
Referring to fig. 1, the present invention provides a method for equivalently converting Java code into C + + code, comprising the steps of:
s1, unpacking the APP to be processed, recording the APP as a set A and classifying the APP, and recording the dex file as a set B;
s2, traversing all classes in all dex files in the set B, acquiring class names, function names and machine codes, and storing and recording as a set C;
s3, traversing the class name, function name and machine code in the set C, converting the Java machine code into C + + code through a custom llvm frame, writing the C + + code into cpp file, and adding and recording the C + + code into the set D;
s4, further processing and compiling the cpp in the set D to finally generate a static library file which is marked as a file E;
s5, linking the file E with a preset basic library file to obtain a dynamic library file F;
s6, F is a final conversion result;
s7, traversing the set C, deleting the machine codes of the elements in the set C, modifying the function marks, and packaging the function marks to obtain a set G;
s8, backfilling G, F into the app, and ending the conversion from the Java code to the C + + code.
The APP is mobile terminal application software in an APK format.
And unpacking is to modify the file suffix of the APK package into ZIP and then decompress by using a decompressing tool.
The working principle is as follows:
in the actual operation process, firstly, a target APP is unpacked, the suffix name of the APK file is modified into a zip format, the unpacked APK file is decompressed by a decompression tool to obtain a dex file, the class name, the function name and the machine code of the dex file are obtained, the original machine code is deleted, the function mark is modified, a target so file code is added and loaded, the packed DEX file is formed into a shell dex file, the dex file with the obtained class name, function name and machine code is converted into a C + + code through an instruction, the C + + code is compiled into a static library through llvm preprocessing, the so file is linked into a so file by combining a basic library file, the so file and the shell dex file are repackaged to form a reinforced APK file, and the whole conversion process is completed.
The invention integrally solves the risk of code leakage or cracking caused by the problems that the original code protection means has shown limitation and low strength and can restore codes in the memory, prevents decompilation or memory leakage by converting Java codes into C + +, and greatly improves the stability, safety and compatibility of APP.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (3)
1. A method for equivalently converting Java code into C + + code, comprising the steps of:
s1, unpacking the APP to be processed, recording the APP as a set A and classifying the APP, and recording the dex file as a set B;
s2, traversing all classes in all dex files in the set B, acquiring class names, function names and machine codes, and storing and recording as a set C;
s3, traversing the class name, function name and machine code in the set C, converting the Java machine code into C + + code through a custom llvm frame, writing the C + + code into cpp file, and adding and recording the C + + code into the set D;
s4, further processing and compiling the cpp in the set D to finally generate a static library file which is marked as a file E;
s5, linking the file E with a preset basic library file to obtain a dynamic library file F;
s6, F is a final conversion result;
s7, traversing the set C, deleting the machine codes of the elements in the set C, modifying the function marks, and packaging the function marks to obtain a set G;
s8, backfilling G, F into the app, and ending the conversion from the Java code to the C + + code.
2. A method for equivalently converting Java code into C + + code according to claim 1, wherein: the APP is mobile terminal application software in an APK format.
3. A method for equivalently converting Java code into C + + code according to claim 1, wherein: and the unpacking step is to modify the file suffix of the APK packet into ZIP and then decompress the ZIP by using a decompressing tool.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111124659.4A CN113836495A (en) | 2021-09-25 | 2021-09-25 | Method for equivalently converting Java code into C + + code |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111124659.4A CN113836495A (en) | 2021-09-25 | 2021-09-25 | Method for equivalently converting Java code into C + + code |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113836495A true CN113836495A (en) | 2021-12-24 |
Family
ID=78970004
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111124659.4A Pending CN113836495A (en) | 2021-09-25 | 2021-09-25 | Method for equivalently converting Java code into C + + code |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113836495A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114327415A (en) * | 2022-03-17 | 2022-04-12 | 武汉天喻信息产业股份有限公司 | Compiling method and device for compiling java file |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109460237A (en) * | 2018-10-25 | 2019-03-12 | 北京顶象技术有限公司 | The Compilation Method and device of code |
CN110245467A (en) * | 2019-05-13 | 2019-09-17 | 西北大学 | Android application program guard method based on Dex2C and LLVM |
CN111597514A (en) * | 2020-04-15 | 2020-08-28 | 卓望数码技术(深圳)有限公司 | Android source code protection method and device |
-
2021
- 2021-09-25 CN CN202111124659.4A patent/CN113836495A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109460237A (en) * | 2018-10-25 | 2019-03-12 | 北京顶象技术有限公司 | The Compilation Method and device of code |
CN110245467A (en) * | 2019-05-13 | 2019-09-17 | 西北大学 | Android application program guard method based on Dex2C and LLVM |
CN111597514A (en) * | 2020-04-15 | 2020-08-28 | 卓望数码技术(深圳)有限公司 | Android source code protection method and device |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114327415A (en) * | 2022-03-17 | 2022-04-12 | 武汉天喻信息产业股份有限公司 | Compiling method and device for compiling java file |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106126981B (en) | Software security means of defence based on the replacement of virtual function table | |
CN106203006A (en) | Android application reinforcement means based on dex Yu so file Dynamic Execution | |
US20160203087A1 (en) | Method for providing security for common intermediate language-based program | |
KR101623096B1 (en) | Apparatus and method for managing apk file in a android platform | |
CN103218549B (en) | A kind of method of Java source code encryption and decryption and device | |
WO2021217980A1 (en) | Java code packing method and system | |
CN105095771B (en) | A kind of guard method of shared file destination and device | |
CN108363911B (en) | Python script obfuscating and watermarking method and device | |
CN109598107B (en) | Code conversion method and device based on application installation package file | |
CN104573416A (en) | Method and device for generating application installation package and executing application | |
CN104239757A (en) | Application program reversing-preventing method and device and operation method and terminal | |
CN112115429B (en) | Java class encryption and decryption method and computer readable storage medium | |
JPH10301774A (en) | Method for providing software package and provider station and user station for realizing the same method and basic software package | |
US20180067777A1 (en) | Application protection method, server, and terminal | |
CN111159662A (en) | Data processing method and device | |
CN109840400B (en) | Apparatus and method for providing security and apparatus and method for performing security for universal intermediate language | |
CN103258167A (en) | Method for protecting png picture in handheld device | |
WO2021022927A1 (en) | Webpage script code protection method and apparatus | |
CN113836495A (en) | Method for equivalently converting Java code into C + + code | |
CN110309630B (en) | Java code encryption method and device | |
CN104951705A (en) | Android application data encryption packaging method based on operating system interface rewriting | |
CN111523120A (en) | Python source code security protection implementation method and system | |
CN109478212B (en) | Method, computer-readable storage medium, and system for protecting code | |
KR101863325B1 (en) | Method and apparatus for preventing reverse engineering | |
CN104657635A (en) | Application processing method, device and server |
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 |