Class C compiler C code implementation, c compiler code implementation
This is a small project last semester.
Class C Compiler
Source code and test file address https://github.com/zxt1995/ttbox.git
Overall framework: Read the file to be compiled-> Semantic Analysis and convert to command-> perform stack operations according to command-> get the result
Extended Part (I am responsible for commenting on other content in the Code)
Finished content
Do while LOOP
Switch case statement
Goto statement
Before analyzing the MBR structure, let's take a look at the computer's boot sequence)
Step 1. Enable and initialize the internal power supply, and wait for a short period of time to generate a stable current. If the motherboard chip and CPU receive an invalid current, a reset signal is automatically generated. Repeat Step 1 before the motherboard receives the power good signal from the power supply.
Step 2. ExecuteCode. There is only one JMP comm
! NtWriteVirtualMemory
01. GIF (48.97 KB)
The three functions show YES, indicating that the Address is written down by the HOOK. We can use WINDBG to check the Address.
Switch to the WINDBG menu and choose "open"> "kernel mode"> "local". Then, confirm whether to save or choose "yes ".
Menu-View-command browser we break into command uf 0xaa096314 (my Address here may be different from yours to see clearly !!)
02. GIF (116.31 KB)
Aa096314 PUSH EBPAa096315 mov ebp, ESPAa096317 add esp,-28Aa09631a
Segment, with 21st rows. A long data type is defined in the interrupt Data Segment, the value is marked with 1, which is actually the address of the 16th line code. Then the second row goes back to the current code segment, adding 1 to the vector, and then 22nd goes into the next loop of the repeating loop. Line 2: the command of Line 2 is sandwiched between the two internal and external repeating cycles. This indicates that
I read an article on IAT encryption processing. I learned how to fix IAT after arriving at OEP. If there is any error, please advise.Copyright: evilangel
Test shell is The original program kryton The Krypter [v.0.2]
I. Shell check:
PEiD shell check:Kryton 0.2-> Yado/Lockless
2. Arrive at OEP
First, load the OD, ignore all exceptions, and stop
00434000> 8B0C24 mov ecx, [esp];
Kernel32.7C81702700434003 E9 0A7C0100 jmp 0044BC1200434008 AD lods dword ptr
address for all 6F statements ). This CALL is called not only when the money and wood population changes, but even when the Organization is created or destroyed. All we need here is to HOOK the call to the change of money and wood. After all, other abnormal functions have already been written by our predecessors and there is no need to repeat the wheel. (If you are interested, you can analyze it yourself)
You only need to determine the value of edx before mov edx, dword ptr ss: [esp + 0x4] to
; I> 0; I --)
16:00cc1016 mov eax, dword ptr [count]
17:00cc1019 mov dword ptr [I], eax
18:00cc101c JMP main + 27 h (0cc1027h)
19:00cc101e mov ECx, dword ptr [I] // copy the memory value of I to the ECX register.
20:00cc1021 sub ECx, 1 // ECx minus 1
21:00cc1024 mov dword ptr [I], ECx // copy the ECX value to the memory address corresponding to I. Here I -- operation is completed.
22:00cc1027 cmp dword ptr [I], 0 // The memory value corre
segment (code segment) actually points to a TSS descriptor in the gdt table, a task switchover will occur.
Intel's design is really thoughtful and provides a very simple mechanism for task switching. However, since the system structure of i386 is basically CISCThe call (or interrupt) task completion process is actually a "complex command" execution process. The execution process is more than 300 CPU cycles (one pop command occupies 12 CPU
jump have unconditional jump: JMP. and conditional jump, JX. There are 19 instructions on X.
DATA SEGMENT
XX db 5
YY db?
DATA ENDS
Stack SEGMENT stack
DB DUP (?)
STACK ENDS
CODE SEGMENT
assume Cs:code, Ds:data, Ss:stack
START:
mov ax, DATA
mov DS, ax
; Core code segment
MOV al, XX
CMP al, 0; X-0 to establish the
Jge Biger of sign position; X>=0 jump to Biger
MOV AL,-1; X
Enter 5 and return 1. No problem 、、、
E
run
run attempt to modify 004010b2~004010d8 in the jump, when jmp 00401205 runs.
Brute Force hack
Through the above analysis,
We'll start by changing the 0040107B jnz short 0040109A to jmp short004010d8.
Parsing keys
Look at the 004010B4~004010D8 code.
First compare if the key length is greater than 10, and then run if greater than 10.
Discover 004010C1~004010D1
memory units are called 1 bytes, and the bytes are then composed of words, in 8086 times, 16 bits of the machine 1 words = 2 bytes =16bit, and 80386 after the 32-bit system, 1 words = 4 bytes. Most computer instructions operate on words, such as adding two words together. That is, the 32-bit CPU register is 32 bits, resulting in the operation of the instruction object is 32-bit word, 16-bit CPU register is 16 bits, moving, adding, subtraction and other instructions are also 16-bit characters. B
address based on the replacement of bytes. You can use the near or far prefix to replace such a jump or call, as shown in the following example:
-A0100: 05000100:0500 JMP 502; a 2-byte short jump0100:0502 JMP near 505; A 3-byte near jump0100:0505 JMP far 50a; a 5-byte far jump
You can abbreviated the near prefix as ne.
Differentiate characters and byte memory lo
automatically assembles short, near and far jumps and calls to the target address based on the replacement of bytes. You can use the near or far prefix to replace such a jump or call, as shown in the following example:
-A0100: 05000100:0500 JMP 502; a 2-byte short jump0100:0502 JMP near 505; A 3-byte near jump0100:0505 JMP far 50a; a 5-byte far jump
You can abbr
←itset Brief Introduction to the implementation of –with-abi and –with-arch in gcc →
PLT Example ExplanationPosted on May, from admin
by XMJ, Yao
First, x86 ABI Handbook original and translation
Original digest from System V application BINARY INTERFACE.
Figure 5-7: Position-independent Procedure Linkage Table
. PLT0:PUSHL 4 (%EBX)
jmp *8 (%EBX)
nop; NOP
nop; NOP
. PLT1:JMP *name1@got
int 21h
Retry:cmp al, "1"
Je speed1
CMP al, "2"
Je speed2
CMP al, "3"
Je speed3
CMP al, "4"
Je speed4
CMP al, "5"
Je speed5
CMP al, "6"
Je speed6
CMP AL,1BH
Je to_over0
JMP input
TO_OVER0:JMP over
Speed1:mov ah,01h
int 21h
CMP AL,0DH
Jne OtherKey
MOV ax,speed+2
MOV Speed,ax
JMP begin
Speed2:mov ah,01h
int 21h
CMP AL,0DH
Jne OtherKey
MOV ax,speed+4
MOV Speed,ax
This anti-debugging method is different from the previous anti-debugging method.In the past, anti-debugging was based on the determination of the debugging personnel. Currently, powerful VMP and TMD methods are also used, the disadvantage of this method is that it is ineffective for a strong-willed, curious, or shake M (that is, if you give him a slap in the face, he also feels good from the heart. At present, we can all crack the VMP, TMD's norm, and prove the bottleneck of this anti-debugging.
and sockets to achieve port multiplexing and socket multiplexing for communication, so as to hide and bypass the firewall.? Overflow has little impact on program performance. It is completely passive.? Creating an overflow vulnerability is simple and easy to implement. Even a very secure application can easily create an overflow bug, such as a package of code calls:Recv (sock, Buf, xxxx, flag). You only need to adjust the value of XXX to cause an overflow vulnerability.
II. General Overflow Vul
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.