First, the outset
First written in front, this article originates from personal research and exploration, due to. NET has its own reflection mechanism. The source code can be clearly reflected. This way your software will be very easy to be cracked. Of course this article does not say how to protect your software from being cracked. Instead, borrow a software to tell how it was compromised. Some people will say this is a broken text, I actually wrote this article has been written for a very long time. Do not know in what form to send out, because after all, there are some cracked class things. But I think the opposite of this article can bring some revelation. Everyone should know reflector this anti-compilation software Another plugin is specifically used to change the Il plugin called Reflexil. Here we also need to use the front of the tool reflector. Behind the plug-in We do not use here, the next analysis of the things can allow you to go deeper. NET PE, go deep inside to see. Well, gossip less .... directly on the analysis.
Second, the specific analysis process
Assumptions do not understand. NET PE file structure of hotties female, can look at the previous article http://www.cnblogs.com/dwlsxj/p/4052871.html, here to use the knowledge of PE. First, let's look at the limitations of this program. This program has a display limit that shows the list only to display three rows.
For example, as seen in:
Now we're going to use the reflector tool to decompile The program we're trying to crack and see where it didn't jump to the Messagbox Pop-up dialog! After we have compiled the C # code, we can see that the program is a main interface, and seeing the name of the form indicates that this is a Windows window:
After the point is opened. I found the contents of the ProgressChanged method, including all the code that pops up the message box. Okay, so we're sure this is the way to get this message box to bounce!
Indeed he is the culprit. Record first.
Now that we know which method pops up the message box, we are able to find the RVA in the metadata table where the method is located. Here I'm going to talk about a table in a metadata table This table is the MethodDef table, which is very important and fun, and this table not only points out the location of the IL Code of the method, but also restricts the properties of the method. Take a look at the table structure:
size
|
offset | TD valign= "Top" width= "style=" border:1px solid silver; Border-collapse:collapse; padding:3px ">
name |
description |
|
0 |
4 |
Rva |
RVA of the method body (method Body contains: method header, IL code, exception handling definition) |
|
4 |
2 |
ImplFlags |
Defines how methods are run (such as abstract, P/invoke) |
|
6 |
2 |
flags |
Top up the call properties of the method and some other properties |
|
8 |
2 (4) |
Name |
An offset to the #string that represents the name of the method |
|
|
2 (4) |
Signature |
Offset to #blob, signature defines how methods are called (such as return value types, etc.) |
|
|
2 |
Paramlist |
Index pointing to the Param table, indicating the method's number of references |
Seeing the table above makes me happy, because I can find the location where this method is stored, that is, I need the address of this RVA. So what is the RVA of this method? With doubt in mind, we will think of a tool to help us find out how this method actually works in the first few of methods, where the CFF can also be seen without direct opening. I'm going to look for a twist.
Open the ILDASM, since. NET has metadata this one number, we will come to a small glimpse of the metadata table, the method's metadata must be inside.
It's not what we expected. It is true that there is a descriptive narrative in the metadata, because metadata is descriptive data, then we get the token: 0600001F, can go back to the previous article to find out the corresponding table is MethodDef is still what we want, The 31st position under this table is what we are looking for and open the CFF software with doubt. To confirm that we are looking for nothing wrong!
!
。
Proven to be what I'm looking for. The descriptive narrative of the ProgressChanged method in the metadata table is now able to take out the key information ProgressChanged method rva:0x3184
View the contents of the chunk through the CFF:
It is observed that the RVA of the method is stored in the. Text chunk, because the range of the block is: 2000~14a00. And 3184 just landed in this part of the address, OK. Then we can figure out the code in the physical address: 3184-2000+200=1384, OK, 0x1384 is the physical address we want to find in the file. This is the time to open the 16 binary editor and load the program into the 16 editor. Ctrl+g search 0x1384 this address. Here are the addresses we searched for:
You will wonder how I know this is the code of this method? Let me reveal the answer.
Ok. RVA We are sure of the right, that is, start position 1384 This must be true, but the length of the code is not very certain, right? OK, open ildasm Find this method to know the length of this method. Or in the head of this method we can determine the length of this method.
The time to verify the results is verified by ILDASM:
By the above conclusion we can confirm that the code of the IL is indeed stored, and we can see that there is a starting instruction, which is the IL code of this opening instruction that I marked is the ldarg.2 load method parameter 2 on the stack. There's no one here to look at his stuff! We just need to know what his opcode is. The opcode of this command is 04, so we'll search in the 16 editor above:
This means that 04 of this instruction is preceded by the initialization stack and initialization parameters, and starting from 04 is actually running the code. Well, the beginning of the command has been found, we have to look at the code we want to change, first observe this section of the comparison num--==0 here, note that the code can not be changed when the code's length and the code stack balance principle.
We want to how to let this condition never set, OK, I think of a method is not let this parameter subtraction operation, let him continue to do the addition operation! First, a little peek at his IL code. Let's talk about the implementation of the overall IL, here just the code at num--==0:
Code specific explanations such as the following:
IL_002F:LDLOC.3//Load 3 onto the stack.
Il_0030:dup//copy stack top data
il_0031:ldc.i4.1//load 1 onto the stack
Il_0032:sub the operation of the//3-1.
IL_0033:STLOC.3//Save to local variable 3 this is changed from the original 3 to 2
il_0034:ldc.i4.0//Load variable 0 to stack
The results of IL_0035:CEQ//O comparison are placed on the stack (return 0 or 1) il_0037:ldc.i4.0//Because we compare the results to 0 or 1, it is more false to press a 0 behind (ceq Eject two parameters from the stack)
Il_0038:ceq
Il_003a:brfalse il_0113//Condition set jump to message box
OK analysis here, the Sub-command of this instruction is our key, we want to change this command to add can be achieved, the corresponding sub opcode is 59, and the corresponding Addopcode is 58 so we put 59 into 58 and then put the 16 into another copy will be able to achieve full functionality.
After the change, let's see how it works!!!
Xamarin.android under Pull Refresh