Shell for the PC end plus decryption experience is not unfamiliar, the Android world Shell is the same existence (why should have shell here is not described). Look (exe = DEX):
The concept is clear, we will say: Shell the most essential function is to implement the loader. After you look at the Packers, the system executes the shell code first. But what we want is to execute the original DEX, but the system is not automatically executed at this time to load the original Dex into the system. OK, Shell is here, look at the Android apk Shell:
Android apk Shell Technology Solution "1"
Android apk Shell Technology Solution "2"
APK Shell "1" implementation of the preliminary scheme of the detailed
After reading the above several articles, I believe that the apk shell should have a certain understanding (in fact, the APK shell and the PC side of the same, only in the processing of different file formats: Dex and EXE will be different, resulting in various shell, shell steps. Of course, we need to know the format of the file to be targeted OH). Take a look at the processing method in Android APK Shell:
1: Write the shell apk, get the shell file: unshelldex;
2: Write a script or code (you're Happy), encode the original Dex into Encodedex, and insert it (there are several poses oh, see you like it) to the Unshelldex file; Notice that the modified Unshelldex must conform to the DEX format, Otherwise android does not execute AI (in the above article on the modified unshelldex of the checksum, signature and file_size values are corrected);
To unpack the shell step:
1 Execute Shell apk code, decode Endcodedex for the original Dex;
2 simulate Android system to load Dex, let it execute smoothly;
Here is a point to mention: Shell absolutely can not change the original code execution flow, not hook, you change is what meaning Ah! The idea of the APK shell is finished, but it's just an armchair, and there's a lot of detail that we need to consider. The shell step is nothing to consider, but to deal with the file format (of course, you have to do the sophisticated encode is another said). In the case of the shell, Decode also have no good analysis (mainly with the encode correspondence, and each person's processing way is not the same); It is the key to put the Dex load, before the shell is the essence of the loader. The idea of the above article is in the process of unpacking, the decode after the Dex directly exist directory, and then call ClassLoader ( here do not understand, and so I read Dalvik source code to analyze ). What the! Dex directly in the directory, other people can not be directly acquired, the shell what to do ah. Do you think the shell and the egg. OK, I'm not taking Dex out of the directory and loading it directly in memory:
Android4.0 Memory dex Data Dynamic Loading technology
APK Shell "2" Memory load DEX implementation detailed
Information:
1 Android apk Shell Technology Solution "1"
2 Android apk Shell Technology Solution "2"
3 apk plus Shell "1" implementation of the preliminary plan
4 Android4.0 memory dex Data Dynamic loading technology
5 apk Shell "2" Memory load DEX implementation
Android APK Shell