ComputersSecurity

Reverse engineering for beginners. Protect Android applications from reverse engineering

Sometimes someone wants to look, and what is the filling in a certain program? Then he has to use reverse engineering. What it is? How does it work? How does this process happen? About all this you can learn from this article.

What is reverse-engineering programs?

This is what the application parsing process is called to understand how it works, in order to recreate the process in the future with the necessary changes. Typically, a debugger and an assembler are used for this purpose. Depending on the quality of the software used, the result will differ and the amount of time it will take to bring it to normal. Explain the reverse-engineering for beginners best by example. As this will be an application written for Android. And now let's find out what and how.

Using Android apps

To begin with, it is necessary to clarify some points. Applications use bytecode and LogCat. These are local analogues of the previously mentioned debugger and assembler. It is also necessary to understand the structure of the applications themselves. So, each program is a file with the extension apk. It is packed with zip. We are interested in its contents - application resources, classes.dex and AndroidManifest.xml. If you are programming on Android, then questions with the first and the last should not be. But classes.dex is the bytecode of the program, which is compiled specifically for the virtual machine. To extract from it the source code java represented on the Internet means does not work. But it is possible to get dalvik opcodes - a special set of commands that are used for a virtual machine. For analogy, we can say that this is the assembler of a local spill. Also classes.dex can be turned into a file with the extension jar. Already in this case, after its decompilation, you can get a java-code, which will be more or less readable. In this way we will go.

Decompilation

This process will be conducted using the Apk Manger program. Before you get started, you need to make sure that you have the right drivers for the device, and also the USB-debugging mode. Initially, we will need to move the file, which will understand the apk_manager \ place-apk-here-for-modding directive. After that, run Script.bat. If there is no problem, then start the console, which will be green inscriptions. We select item number nine - "Decompile". After the process is started, you do not need to close the console. Then you should open the apk-file of interest with the help of the archiver and extract classes.dex from it, which you need to process with dex2jar. For the result we need, we need to move it to an object with the extension .bat. A file will appear that will end with .jar. While the window is not closed.

Analyzing the data

To get information about the application, you must open its manifest. On it we determine that it acts as the main activity. It is of the greatest importance for us now. It is also desirable to look at the bottom of the program. If the information on the license manager is below, then this will significantly complicate reverse engineering. If we switch to jd-gui and expand the tree, we will see several namespaces. Suppose there are three. In the first there are files related to advertising. The second one will contain the license manager classes. In the third we have the necessary data. In it, then we go. Here you will need to find and delete the key, and then the rest of the lines that check if the licensed version is working. All this must be cleaned. Then in our Apk Manager we look for the place where the byte-code is to be placed. Now let's make a small digression and comment out the commands that potentially can cause problems. After that, we only need to compile the program.

Building an Application

This will help us all the same Apk Manager. In the console window, which we did not close, we select item # 14. Then the matter of technology. If the application is quite complicated, then at startup it can partially or completely lose its efficiency. Do not worry, it means that we are only halfway and there is still where to go. We continue to reverse engineering of Android-applications. To say that it is necessary to do in a particular case, in general words, alas, is impossible. Therefore, you will have to find the problem yourself. So, if the application window is blocked by a pop-up window, you need to view the code and delete the part that is responsible for this dialog. Help with this can jd-gui. As you can see, reverse engineering is not an easy task, and it requires a considerable amount of knowledge. Even if everything started up without problems, it will be necessary to test the working capacity of the application. That is reverse-engineering is still time-consuming action. We continue to work until all the problems are identified.

Security

What if we need to protect Android applications from reverse engineering? In this case, there are two options: the use of special programs or the creation of a code structure that will interfere with the analysis of what was written. The latter option is suitable only for experienced professionals, so we will consider only the first method of protection. As a specialized software we use ProGuard. This application is used to reduce, obfuscate and optimize the code. If the program is "run" through it, then we get a file with the extension * .apk smaller than it was. In this case, it will be much more difficult to disassemble. And the advantage of this program is that it was even introduced into the assembly system of Android applications with the update r9. Therefore, any developer can use it, which has standard tools for creating and developing.

Conclusion

It can not be said that reverse-engineering can be imagined as something uniformly bad or good. Of course, from the point of view of the developers who created the application, this is not a joyful event. But on the other hand, in many cases, the creation of the necessary files by experienced programmers can be less time consuming than the use of such tools. Although for beginners, reverse engineering can do a good job, if there is no idea how to implement something, even approximate and not entirely understandable sketches can help with the achievement of the goal.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.birmiss.com. Theme powered by WordPress.