20145331 summary and code analysis of "Information Security System Design Basics" in week 5th

Source: Internet
Author: User
Chapter 3 practical content and code analysis:

I. Process:

Disassembly: objdump-d wsc. o

1. Create a c file of wsc1.c and convert it into assembly code:

WSC. C:

WSC. O :( view od xxx)

 

2. Enter the command to obtain the binary format code, and enter od wsc. O to view the Code:

Iii. disassembly: objdump-d wsc. O to obtain the disassembly code:

Iv. disassembly code analysis:

1. The disassembly Code has no suffix after the operation instruction compared with the general assembly code.

2. code analysis: the code logic is that the G function calls the f function, and the main function calls the G function. The first function is used as an example to analyze the stack frame through code:

G function: Call F in G. First save % EBP, set % EBP to the starting position of the stack frame, and subtract 8 from the stack pointer, it means that the stack is divided into eight more bytes (but only four bytes are used, and four bytes are useless ). Pass the value (y) relative to % EBP at the offset of-4 to % eax, transfer from % eax to % EDI, call f, and then the return address is pushed into the stack. F function: press a % EBP, set the % EBP position, and pass the % EDI value (y) to the position relative to the % EBP offset of-4, and then to % eax, overwrite the value of Y + 7 to % eax and pass it as the return value. % EBP is displayed, which controls the transfer back to G.


20145331 summary and code analysis of "Information Security System Design Basics" in week 5th

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.