CN111708543B - Method for reducing repetition degree of Android project codes - Google Patents
Method for reducing repetition degree of Android project codes Download PDFInfo
- Publication number
- CN111708543B CN111708543B CN202010835434.9A CN202010835434A CN111708543B CN 111708543 B CN111708543 B CN 111708543B CN 202010835434 A CN202010835434 A CN 202010835434A CN 111708543 B CN111708543 B CN 111708543B
- Authority
- CN
- China
- Prior art keywords
- project
- code
- codes
- android
- file
- 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.)
- Expired - Fee Related
Links
Classifications
-
- 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/41—Compilation
- G06F8/43—Checking; Contextual analysis
- G06F8/433—Dependency analysis; Data or control flow analysis
- G06F8/434—Pointers; Aliasing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3604—Software analysis for verifying properties of programs
- G06F11/3608—Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3604—Software analysis for verifying properties of programs
- G06F11/3616—Software analysis for verifying properties of programs using software metrics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
- G06F9/4451—User profiles; Roaming
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a method for reducing the repeatability of Android project codes, and belongs to the technical field of reducing the repeatability of project codes. The Android project code related by the invention adopts a section-oriented programming method, and non-functional codes are inserted into the compiled code; opening confusion and configuring a confusion dictionary; modifying the path of the code file which is not confused in batch by using the Java script, and modifying the naming format of the entity class and Android four-major-component folder in batch by using the Java script; writing a Java script program to add characters at the tail of all files in a project, and adding different characters to project files in different file formats; modifying the path of the project package; and when any directory of the project is located, a new signature file is newly created in the any directory, and when the App packages, the signature file is used for signature. Compared with a method for directly modifying codes, the method for reducing the repetition degree of the Android project codes has the advantages of small workload, prevention of new bug generation and the like.
Description
Technical Field
The invention belongs to the technical field of reducing the repeatability of project codes, and particularly relates to a method for reducing the repeatability of Android project codes.
Background
With the rapid development of internet technology, a great number of excellent programmers are currently performing development and application work of various software, and when a project, especially a very large project, is developed, it is faced that a code block which is written at the beginning of the project and implements a specific function is packaged with a code block of another function, and as the number of times of packaging increases, data exchange between the code of the specific function and various code blocks is increasingly close, but such an application scenario may cause unqualified review because the repeatability of the software exceeds a certain limit when the software is put on shelf, but if the repeated code is modified, instability of the whole software function may be caused, leading to increase of bugs, and even running the whole software. At present, programmers generally write codes of related functions by one person and reduce an independent functional module to be written by multiple persons as much as possible by reducing the code repetition degree. The method has the disadvantages that when the project code is very large, one person cannot independently write a certain function code, the smallest module is used for packaging, more code repetition can be caused, the condition that the code repetition is high to cause marketing failure is caused when the repetition is detected, and in addition, if the project code is directly modified, a new bug can be generated to cause program instability, even to cause project failure. The scheme provides a method for solving the problem that the software code repetition degree is high and the auditing is not passed due to excessive packaging times in the process of software on-shelf auditing, and has the advantages of simple method and no bug introduction.
Disclosure of Invention
The invention aims to solve the problems and provides a method for reducing the repetition degree of Android project codes.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for reducing the repetition degree of Android project codes comprises the following steps:
s1: inserting a non-functional code into the compiled code by adopting a section-oriented programming method for the project code;
s2: and (3) opening confusion, configuring a confusion dictionary: after confusion is started, Android projects are compiled through a Java compiler, and folder names, class names, method names, parameter names and variable names of compiled project codes are replaced by a plurality of characters without specific significance respectively;
s3: modifying the path of the code file which is not confused in batch by using the Java script, and modifying the naming format of the entity class and Android four-major-component folder in batch by using the Java script;
s4: writing a Java script program to add characters at the tail of all files in a project, and adding different characters to project files in different file formats;
s5: modifying the path of the project package;
s6: and when any directory of the project is located, a new signature file is newly created in the any directory, and when the App packages, the signature file is used for signature.
In the method for reducing the repetition degree of the Android project code, the section programming method in step S1 adopts an AspectJ framework to newly insert different code classes, and writes a program segment for inserting different codes into the project file in the inserted different code classes.
In the method for reducing the repetition degree of the Android project code, the program segments of different codes comprise non-functional codes which realize non-printed log, non-content Boolean judgment and meaningless variable assignment.
In the method for reducing the repetition degree of the Android project code, the different code inserting classes are modified by the aid of the round key words of AspectJ, and the processing targets are all the function codes of the main project.
In the method for reducing the repetition rate of the Android project code, the obfuscation dictionary described in step S2 changes the characters in the project code into the designated characters.
In the method for reducing the repetition rate of the Android project code, the folder naming format in step S3 is modified to be a uniform prefix.
Detailed Description
A method for reducing the repetition degree of Android project codes enables all compiled class files md5 and code contents to be changed; the name of the compiled class file and the name of the internal method name variable are modified into names which are difficult to identify; all un-obfuscated code file names are uniformly modified, and the names in the referenced places are also modified synchronously; modifying the content and the project path of all files in the project, creating a new unique signature file, and packaging the file, specifically comprising the following steps:
1: inserting a non-functional code into the compiled code by adopting a section-oriented programming method for the project code;
2: and (3) opening confusion, configuring a confusion dictionary: after confusion is started, Android projects are compiled through a Java compiler, and folder names, class names, method names, parameter names and variable names of compiled project codes are replaced by a plurality of characters without specific significance respectively;
3: modifying the path of the code file which is not confused in batch by using the Java script, and modifying the naming format of the entity class and Android four-major-component folder in batch by using the Java script;
4: writing a Java script program to add characters at the tail of all files in a project, and adding different characters to project files in different file formats;
5: modifying the path of the project package;
6: and when any directory of the project is located, a new signature file is newly created in the any directory, and when the App packages, the signature file is used for signature.
The scheme of the invention creatively adopts the steps of adding non-functional codes into compiled codes and using an obfuscating and obfuscating dictionary, wherein the added non-functional codes enable all compiled class files md5 and code content to be changed, so that each file and method have uniqueness; using obfuscation and obfuscation dictionaries, the compiled class file name, internal method name variable name, are modified to be a hard-to-recognize name, each file and method being unique.
Aop is a technique for realizing the unified maintenance of program functions by a precompilation mode and a dynamic proxy during running. In the scheme, an AspectJ frame is selected, a MarketAAp class is newly built, a method for inserting different codes is written in the MarketAAp class, and the different codes comprise non-functional codes such as unprinted log logs, content-free Boolean judgment, meaningless variable assignment and the like; modifying the method by using the Around keyword of AspectJ, and designating a processing target as all functional codes of the main project, wherein the configuration of the codes is completed at the moment; the next time the project is compiled, a certain amount of designated meaningless codes are inserted before and after the target method during compiling, all compiled class files md5 and code contents are changed, and each file and method has uniqueness.
Obfuscation is a configuration in the Android project that transforms the code of a computer program into a functionally equivalent, but difficult to read and understand, form of behavior. In android development, a development tool (android studio) provides a simple set of obfuscation tools by default, which is started by enabling a minienabled tree under a build. After the project is opened, in the process of packaging the project into an installation package, all files in the project are automatically traversed, all folder names, class names, method names and variable names are modified into characters without practical significance, for example, "StudentInfo" is replaced by "abc".
Configuring the obfuscating dictionary is an advanced use of code obfuscation. The starting method is that three user-defined obfuscation configurations, namely, obfuscationdictionary, classfusfuscationdictionary and packageofusdictionary are added in an obfuscation configuration file proguard-rule. Default code obfuscation converts the name in the code to a form of a lower case letter in english, such as "abc", which, when configured with an obfuscation dictionary, may convert the name to a random word in the corresponding txt. For example, where a class name dictionary classbustationdictionary is configured and references a txt file containing multiple scrambled words, a class named "StudentInfo" will, when packaged, change a random word "籲 蠶 鱅 矡" in the txt file.
Opening confusion: setting minifyEnabled to true in build.gram of the project main module, and setting entity classes which do not need to be confused in a program-rule.pro file; then, continuously adding three custom confusion configurations of obfuscationpart, classlofucationpart and packageobfuscationpart in the program-rule.pro to cover the confusion of the method name, the class name and the package name; the contents of the confusing dictionary file in the item root directory are nonsensical English words, Chinese characters and messy code characters.
The duplication degree of project codes is reduced, and the method mainly comprises the steps of modifying names of all un-confused files, modifying contents of all files in a project, modifying a project package path and generating a new signature file.
Modify all un-obfuscated file names in bulk: files which are not added with different codes are used for modifying the names of all un-confused files in batches by using a Java script, the Java script realizes compiling of modified file names and reference position names, and all paths which are not subjected to confusing codes are configured and comprise file folders of four large components, namely an entity class and an Android class; configuring naming formats of all new files, such as uniform prefixes; executing code, all un-obfuscated files will automatically modify the file name, and the names of the places referenced in Manifest, xml, other java, kotlin files will also be modified synchronously.
Modifying all file contents in the project: writing scripts for adding characters to the tail of all files, and adding different characters according to different file formats, such as a java file adding non-execution method, a kt file adding non-execution method, an xml file adding empty line, and png and webp file adding meaningless English characters; the code is executed, all files are modified, and md5 is changed completely, but the script program does not confuse xml, pictures, project part configuration files, and the part files have not much relevance to the specific function code segments packaged by the project.
And (3) modifying the path of the project package: opening a project in the android studio, clicking a folder of a project main project by a right button, selecting Refactor → Rename, selecting a Rename package in a bullet frame, inputting a new folder name, clicking ok, starting to search all problems to be modified on a page at the moment, clicking the Refactor at the lower left corner of a screen to complete modification after the search is completed, and enabling file paths of the specified folder and file names to be changed.
And generating a new signature file: creating a new unique signature file, opening a command line tool and positioning to a current directory; the method comprises the steps of inputting keytool-alias android, key-key RSA-validity 20000-key-algorithm android, creating a new signature file under a current directory, and sequentially inputting a secret key library password, a confirmation password, a surname, a unit name, an organization name, a city name, a provincial name, a country name, a confirmation password and a password. When App packages, signature is carried out by using the newly created signature file.
It should be noted that all the functional codes of the main project refer to codes written by programmers themselves, and do not include codes of introduced third-party companies, such as third-party statistics, third-party payment, third-party sharing, and the like; and the Android system source code and the Linux source code are not included.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.
Claims (6)
1. A method for reducing the repetition degree of Android project codes is characterized by comprising the following steps:
s1: inserting a non-functional code into the compiled code by adopting a section-oriented programming method for the project code;
s2: and (3) opening confusion, configuring a confusion dictionary: after confusion is started, Android projects are compiled through a Java compiler, and folder names, class names, method names, parameter names and variable names of compiled project codes are replaced by a plurality of characters without specific significance respectively;
s3: modifying the path of the code file which is not confused in batch by using the Java script, and modifying the naming format of the entity class and Android four-major-component folder in batch by using the Java script;
s4: writing a Java script program to add characters at the tail of all files in a project, and adding different characters to project files in different file formats;
s5: modifying the path of the project package;
s6: and when any directory of the project is located, a new signature file is newly created in the any directory, and when the App packages, the signature file is used for signature.
2. The method for reducing the repeatability of the Android project code of claim 1, wherein the tangent plane programming method of step S1 adopts an AspectJ framework to newly insert different code classes, and a program segment for inserting different codes into the project file is written in the inserted different code classes.
3. The method for reducing the Android project code repetition degree of claim 2, characterized in that the program segments of different codes contain non-functional codes which realize non-printed log, no-content Boolean judgment and no-meaning variable assignment.
4. The method for reducing the Android project code repetition degree of claim 2, characterized in that the different code class is inserted and decorated by an Around key word of AspectJ, and all function codes of a main project are designated as processing targets.
5. The method for reducing Android project code repetition of claim 1, characterized in that the obfuscation dictionary of step S2 changes characters in the project codes to designated characters.
6. The method for reducing the Android project code repetition degree of claim 1, characterized in that the folder naming format of step S3 is modified to be a uniform prefix.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010835434.9A CN111708543B (en) | 2020-08-19 | 2020-08-19 | Method for reducing repetition degree of Android project codes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010835434.9A CN111708543B (en) | 2020-08-19 | 2020-08-19 | Method for reducing repetition degree of Android project codes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111708543A CN111708543A (en) | 2020-09-25 |
CN111708543B true CN111708543B (en) | 2021-04-06 |
Family
ID=72547136
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010835434.9A Expired - Fee Related CN111708543B (en) | 2020-08-19 | 2020-08-19 | Method for reducing repetition degree of Android project codes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111708543B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115794174A (en) * | 2023-02-01 | 2023-03-14 | 北京乐研科技股份有限公司 | Project program import updating method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105915623A (en) * | 2016-05-20 | 2016-08-31 | 努比亚技术有限公司 | Device and method of processing application installation package |
CN109189374A (en) * | 2018-06-22 | 2019-01-11 | 北京大学 | Object formation code generating method and system based on object reference chain |
CN111274556A (en) * | 2020-02-27 | 2020-06-12 | 北京小米移动软件有限公司 | Code obfuscation method, device and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB201703864D0 (en) * | 2017-03-10 | 2017-04-26 | Irdeto Bv | Secured system operation |
-
2020
- 2020-08-19 CN CN202010835434.9A patent/CN111708543B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105915623A (en) * | 2016-05-20 | 2016-08-31 | 努比亚技术有限公司 | Device and method of processing application installation package |
CN109189374A (en) * | 2018-06-22 | 2019-01-11 | 北京大学 | Object formation code generating method and system based on object reference chain |
CN111274556A (en) * | 2020-02-27 | 2020-06-12 | 北京小米移动软件有限公司 | Code obfuscation method, device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111708543A (en) | 2020-09-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107861728B (en) | Method and system for converting traditional program language into modern program language | |
Arlow et al. | Enterprise patterns and MDA: building better software with archetype patterns and UML | |
Schwartz et al. | Incremental compilation in Magpie | |
US8615735B2 (en) | System and method for blurring instructions and data via binary obfuscation | |
CN108932406A (en) | Virtualization software guard method and device | |
CN106778288A (en) | A kind of method and system of data desensitization | |
BRPI0614089A2 (en) | method to prevent software reverse engineering, unauthorized modification and interception of runtime data | |
CN104298534B (en) | Programmed method and device based on Lua language | |
CN103678961B (en) | The method that code dynamically generates | |
CN110059456B (en) | Code protection method, code protection device, storage medium and electronic equipment | |
WO2014051608A1 (en) | Application randomization | |
CN107967415B (en) | Resource confusion protection method, system and terminal device | |
US20070061797A1 (en) | Bulk loading system and method | |
CN113704706B (en) | Code reinforcement method and device | |
CN111708543B (en) | Method for reducing repetition degree of Android project codes | |
CN115756451A (en) | Method, device, equipment and storage medium for reusing multi-project code file | |
KR102439778B1 (en) | Application converting apparatus and method for improving security | |
KR20180131009A (en) | System and method for converting large scale application | |
CN116243923A (en) | Applet processing method and device and electronic equipment | |
Brown | Perl: the complete reference | |
CN112114809B (en) | Program code safety protection method, device and storage medium | |
CN112527320A (en) | Method, device and storage medium for deploying application system based on browser | |
Keogh et al. | OOP demystified | |
Horstmann | Core Java for the impatient | |
Mailund | Pointers in C Programming |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20210406 Termination date: 20210819 |
|
CF01 | Termination of patent right due to non-payment of annual fee |