好友
阅读权限 30
听众
最后登录 1970-1-1
本帖最后由 whyIDA 于 2017-10-25 20:18 编辑
原帖地址:
https://www.52pojie.cn/thread-654545-1-1.html
查壳为upx ,直接上脱壳 机脱壳,ida载入
[Asm] 纯文本查看 复制代码
.text:00401460 ; int __cdecl main(int argc, const char **argv, const char **envp)
.text:00401460 public _main
.text:00401460 _main proc near ; CODE XREF: sub_4011B0+D0p
.text:00401460
.text:00401460 Str = dword ptr -30h
.text:00401460 var_2C = dword ptr -2Ch
.text:00401460 var_1A = byte ptr -1Ah
.text:00401460 var_19 = byte ptr -19h
.text:00401460 var_18 = byte ptr -18h
.text:00401460 var_17 = byte ptr -17h
.text:00401460 var_16 = byte ptr -16h
.text:00401460 var_15 = byte ptr -15h
.text:00401460 var_14 = byte ptr -14h
.text:00401460 var_13 = byte ptr -13h
.text:00401460 var_12 = byte ptr -12h
.text:00401460 var_11 = byte ptr -11h
.text:00401460 var_10 = byte ptr -10h
.text:00401460 var_F = byte ptr -0Fh
.text:00401460 var_E = byte ptr -0Eh
.text:00401460 var_D = byte ptr -0Dh
.text:00401460 var_C = byte ptr -0Ch
.text:00401460 var_B = byte ptr -0Bh
.text:00401460 var_A = byte ptr -0Ah
.text:00401460 var_9 = byte ptr -9
.text:00401460 var_8 = dword ptr -8
.text:00401460 var_4 = dword ptr -4
.text:00401460 argv = dword ptr 0Ch
.text:00401460 envp = dword ptr 10h
.text:00401460
.text:00401460 push ebp
.text:00401461 mov ebp, esp
.text:00401463 and esp, 0FFFFFFF0h
.text:00401466 sub esp, 30h
.text:00401469 call ___main
.text:0040146E mov [esp+30h+Str], offset Str ; "please input a number:"
.text:00401475 call _puts
.text:0040147A lea eax, [esp+30h+var_8]
.text:0040147E mov [esp+30h+var_2C], eax
.text:00401482 mov [esp+30h+Str], offset Format ; "%d"
.text:00401489 call _scanf
.text:0040148E mov [esp+30h+var_1A], 83h
.text:00401493 mov [esp+30h+var_19], 7Ch
.text:00401498 mov [esp+30h+var_18], 86h
.text:0040149D mov [esp+30h+var_17], 7Fh
.text:004014A2 mov [esp+30h+var_16], 6Ah
.text:004014A7 mov [esp+30h+var_15], 8Fh
.text:004014AC mov [esp+30h+var_14], 93h
.text:004014B1 mov [esp+30h+var_13], 8Ah
.text:004014B6 mov [esp+30h+var_12], 82h
.text:004014BB mov [esp+30h+var_11], 77h
.text:004014C0 mov [esp+30h+var_10], 6Ch
.text:004014C5 mov [esp+30h+var_F], 7Fh
.text:004014CA mov [esp+30h+var_E], 86h
.text:004014CF mov [esp+30h+var_D], 74h
.text:004014D4 mov [esp+30h+var_C], 7Ah
.text:004014D9 mov [esp+30h+var_B], 66h
.text:004014DE mov [esp+30h+var_A], 9Ah
.text:004014E3 mov [esp+30h+var_9], 5Bh
.text:004014E8 mov [esp+30h+var_4], 0
.text:004014F0 jmp short loc_40151B
.text:004014F2 ; ---------------------------------------------------------------------------
.text:004014F2
.text:004014F2 loc_4014F2: ; CODE XREF: _main+C0j
.text:004014F2 mov edx, [esp+30h+var_8]
.text:004014F6 lea ecx, [esp+30h+var_1A]
.text:004014FA mov eax, [esp+30h+var_4]
.text:004014FE add eax, ecx
.text:00401500 movzx eax, byte ptr [eax]
.text:00401503 movsx eax, al
.text:00401506 sub edx, eax
.text:00401508 mov eax, edx
.text:0040150A sub eax, [esp+30h+var_4]
.text:0040150E mov [esp+30h+Str], eax ; Ch
.text:00401511 call _putchar
.text:00401516 add [esp+30h+var_4], 1
.text:0040151B
.text:0040151B loc_40151B: ; CODE XREF: _main+90j
.text:0040151B cmp [esp+30h+var_4], 11h
.text:00401520 jle short loc_4014F2
.text:00401522 mov [esp+30h+Str], 0Ah ; Ch
.text:00401529 call _putchar
.text:0040152E mov [esp+30h+Str], offset aIfYouCanTSeeFl ; "if you can't see flag,the number is wro"...
.text:00401535 call _puts
.text:0040153A nop
.text:0040153B leave
.text:0040153C retn
.text:0040153C _main endp
F5 得到伪c 代码:
[C] 纯文本查看 复制代码
char v4; // [sp+16h] [bp-1Ah]@1
char v5; // [sp+17h] [bp-19h]@1
char v6; // [sp+18h] [bp-18h]@1
char v7; // [sp+19h] [bp-17h]@1
char v8; // [sp+1Ah] [bp-16h]@1
char v9; // [sp+1Bh] [bp-15h]@1
char v10; // [sp+1Ch] [bp-14h]@1
char v11; // [sp+1Dh] [bp-13h]@1
char v12; // [sp+1Eh] [bp-12h]@1
char v13; // [sp+1Fh] [bp-11h]@1
char v14; // [sp+20h] [bp-10h]@1
char v15; // [sp+21h] [bp-Fh]@1
char v16; // [sp+22h] [bp-Eh]@1
char v17; // [sp+23h] [bp-Dh]@1
char v18; // [sp+24h] [bp-Ch]@1
char v19; // [sp+25h] [bp-Bh]@1
char v20; // [sp+26h] [bp-Ah]@1
char v21; // [sp+27h] [bp-9h]@1
int v22; // [sp+28h] [bp-8h]@1
int i; // [sp+2Ch] [bp-4h]@1
__main();
puts("please input a number:");
scanf("%d", &v22);
v4 = -125;
v5 = 124;
v6 = -122;
v7 = 127;
v8 = 106;
v9 = -113;
v10 = -109;
v11 = -118;
v12 = -126;
v13 = 119;
v14 = 108;
v15 = 127;
v16 = -122;
v17 = 116;
v18 = 122;
v19 = 102;
v20 = -102;
v21 = 91;
for ( i = 0; i <= 17; ++i )
putchar(v22 - *(&v4 + i) - i);
putchar(10);
return puts("if you can't see flag,the number is wrong!!!");
}
flag 第一个字母位“f” asII 码为0x66 ,十进制 102.也就是
x-(-125)=102,x=-23
用c描述就是这样:
[C] 纯文本查看 复制代码
#include <stdio.h>
void main()
{
int i;
int s[]={-125,124,-122,127,106,-113,-109,-118,-126,119,108,127,-122,116,122,102,-102,91};
for(i=0;i<=17;i++)
{
putchar(-23- (s【i】)-i);
}
putchar(10);
}
免费评分
查看全部评分