Old hacker tells about reverse analysis: reverse analysis technology reveals all secrets

Source: Internet
Author: User

After the previous lessons, we now officially begin to talk about reverse analysis. Reverse Analysis refers to understanding the code functions by analyzing the disassembly code, such as the data structure of each interface, re-describing the code in advanced languages, and introducing the idea of the original software in reverse order. The following is an analysis of function calls, loops, and control statements.

In advanced languages, subroutines are too lazy to PASS Parameters on stacks.
For example, test1 (Par1, Par2, Par3: integer), the Assembly Code is as follows according to the call conventions of C, Psacal, and StdCall:

498) this. style. width = 498; "border = 0>

Function call

Call the test2 (par1, par2) function according to StdCall. The stack creation is as follows:
Push ebp to protect the original EBP pointer on site
Mov ebp, esp; set a new EBP pointer to the top of the stack
Sub esp, xxx; set aside space for local variables in the stack
... ...
Add esp, xxx; release the stack occupied by local variables
Pop ebp; recovery site ebp pointer
Ret 8; Return

498) this. style. width = 498; "border = 0>

Loop

If it is determined that a piece of code is a loop, you can analyze its counter. Generally, it uses the ecx register as the counter.

The following assembly code:

Xor ecx, ecx; ecx cleared: 0044366inc ecx; count... ... Cmp ecx, 05; loop 4 times jbe 00440000; repeat

The above assembly code is described in C language in the following three forms:

Bytes◆While (I <5 ){... ...} Bytes◆For (I = 0; I <5; I ++ ){... ...} Bytes◆I = 0 Repeati ++ ;... Unitl (I> = 5)

Control statement

If... Else statement:
Cmp byte prt [00221450], bl
Jne 1, 00221590
Case statement:

Assembly Code

Advanced statements

Mov eax, edi;

Sub eax, 00000002 ;

Je00401;

Sub eax, 0000000E ;

Jne 0040114E

...

Swith (K)

{

Case '0x2 ':...; Break;

Case '0x10 ':...; Break;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.