2011-11-14 5 views
0

현재 폭탄을 해체하려고하고 있으며 폭탄의 4 단계에 있지만 문제가 있습니다. 나는 코드의이 부분이 무엇을 의미하는지 모른다.이 어셈블리를 이해하려고 시도 중입니다.

0x08048f64 <phase_4+81>:  mov 0x804a20c(,%edx,4),%eax 
    0x08048f6b <phase_4+88>:  jmp *%eax 

나는이 코드 줄은 입력에 $의 EAX에 코드의 일부 라인을 의미한다고 생각하고 그것에 점프,하지만 난 어떤 값의 0x804a20c에서 모르는 생각하기 때문에 그렇게 확신하지. 나는 약간 새로운 어셈블리입니다. 지금까지 나는 입력이 두 개의 숫자로 이루어져야하고 두 번째 숫자는 126이어야한다는 것을 알고 있습니다. 첫 번째 숫자가 무엇이되어야하는지 잘 모르겠습니다. 매번 x와 126 숫자가있는 코드를 실행합니다. X는 최종 단계에 도달하는 숫자이지만,이 단계에서는 -0x8 (ebp)의 0 값을 문자열의 길이와 비교합니다. 56 행에서 -0x8 (ebp)에 0을 입력합니다. 위의 코드가 이것과 관련이 있는지 궁금합니다. 예를 들어

, 만약 내가 입력 "100 126"다음 프로그램이 나에게

여기에 전체 코드의 라인 (191)의 마지막 폭발을 뛰어 보자 0 7의 값을 비교하지 않습니다.

0x08048f13 <phase_4+0>: push %ebp 
    0x08048f14 <phase_4+1>: mov %esp,%ebp 
    0x08048f16 <phase_4+3>: push %ebx 
    0x08048f17 <phase_4+4>: sub $0x24,%esp 
    0x08048f1a <phase_4+7>: lea -0x14(%ebp),%eax 
    0x08048f1d <phase_4+10>:  mov %eax,0xc(%esp) 
    0x08048f21 <phase_4+14>:  lea -0x10(%ebp),%eax 
    0x08048f24 <phase_4+17>:  mov %eax,0x8(%esp) 
    0x08048f28 <phase_4+21>:  movl $0x804a206,0x4(%esp) 
    0x08048f30 <phase_4+29>:  mov 0x8(%ebp),%eax 
    0x08048f33 <phase_4+32>:  mov %eax,(%esp) 
    0x08048f36 <phase_4+35>:  call 0x8048b10 <[email protected]> 
    0x08048f3b <phase_4+40>:  cmp $0x2,%eax 
    0x08048f3e <phase_4+43>:  je  0x8048f45 <phase_4+50> 
    0x08048f40 <phase_4+45>:  call 0x8049e74 <explosion> 
    0x08048f45 <phase_4+50>:  mov -0x10(%ebp),%eax 
    0x08048f48 <phase_4+53>:  mov %eax,-0xc(%ebp) 
    0x08048f4b <phase_4+56>:  movl $0x0,-0x8(%ebp) 
    0x08048f52 <phase_4+63>:  mov -0x14(%ebp),%eax 
    0x08048f55 <phase_4+66>:  sub $0x74,%eax 
    0x08048f58 <phase_4+69>:  mov %eax,-0x18(%ebp) 
    0x08048f5b <phase_4+72>:  cmpl $0xa,-0x18(%ebp) 
    0x08048f5f <phase_4+76>:  ja  0x8048fb5 <phase_4+162> 
    0x08048f61 <phase_4+78>:  mov -0x18(%ebp),%edx 
    0x08048f64 <phase_4+81>:  mov 0x804a20c(,%edx,4),%eax 
    0x08048f6b <phase_4+88>:  jmp *%eax 
    0x08048f6d <phase_4+90>:  addl $0x1,-0x8(%ebp) 
    0x08048f71 <phase_4+94>:  movl $0x72,-0xc(%ebp) 
    0x08048f78 <phase_4+101>:  shll -0x8(%ebp) 
    0x08048f7b <phase_4+104>:  jmp 0x8048fba <phase_4+167> 
    0x08048f7d <phase_4+106>:  addl $0x38,-0xc(%ebp) 
    0x08048f81 <phase_4+110>:  addl $0x1,-0xc(%ebp) 
    0x08048f85 <phase_4+114>:  movl $0x7a,-0x8(%ebp) 
    0x08048f8c <phase_4+121>:  jmp 0x8048fba <phase_4+167> 
    0x08048f8e <phase_4+123>:  movl $0x44,-0xc(%ebp) 
    0x08048f95 <phase_4+130>:  subl $0x1,-0xc(%ebp) 
    0x08048f99 <phase_4+134>:  shll -0x8(%ebp) 
    0x08048f9c <phase_4+137>:  jmp 0x8048fba <phase_4+167> 
    0x08048f9e <phase_4+139>:  subl $0x1,-0x8(%ebp) 
    0x08048fa2 <phase_4+143>:  subl $0x7a,-0xc(%ebp) 
    0x08048fa6 <phase_4+147>:  jmp 0x8048fba <phase_4+167> 
    0x08048fa8 <phase_4+149>:  movl $0x3,-0xc(%ebp) 
    0x08048faf <phase_4+156>:  addl $0x1,-0x8(%ebp) 
    0x08048fb3 <phase_4+160>:  jmp 0x8048fba <phase_4+167> 
    0x08048fb5 <phase_4+162>:  call 0x8049e74 <explosion> 
    0x08048fba <phase_4+167>:  mov -0xc(%ebp),%eax 
    0x08048fbd <phase_4+170>:  imul -0x8(%ebp),%eax 
    0x08048fc1 <phase_4+174>:  mov %eax,%ebx 
    0x08048fc3 <phase_4+176>:  mov 0x8(%ebp),%eax 
    0x08048fc6 <phase_4+179>:  mov %eax,(%esp) 
    0x08048fc9 <phase_4+182>:  call 0x8048a20 <[email protected]> 
    0x08048fce <phase_4+187>:  cmp %eax,%ebx 
    0x08048fd0 <phase_4+189>:  je  0x8048fd7 <phase_4+196> 
    0x08048fd2 <phase_4+191>:  call 0x8049e74 <explosion> 
    0x08048fd7 <phase_4+196>:  add $0x24,%esp 
    0x08048fda <phase_4+199>:  pop %ebx 
    0x08048fdb <phase_4+200>:  pop %ebp 
    0x08048fdc <phase_4+201>:  ret  

어떤 도움을 주시면 감사하겠습니다. 고맙습니다.

+0

'x86과 유사하지 않음' –

+3

@Roman R .: 왜 안 되니? – BlackBear

+4

windows dude detected :-) – horsh

답변

5

점프가로드되는 주소가 edx의 내용에 따라 다르므로 804a20c의 값은 중요하지 않습니다. 주소는 실제로 edx에 의해 색인 된 점프 테이블의 기본입니다. 두 번째 줄로 넘어간 주소는 804a20c + (edx * 4)의 메모리 주소입니다.

+0

감사합니다. 나는 그것을 계속 보면서 그것이 무엇을 의미하는지 궁금해했다. – user1045991

관련 문제