好友
阅读权限10
听众
最后登录1970-1-1
|
25吾爱币
我是小白一个,不怎么懂汇编,但喜欢学习。有一个exe调用一个dll文件,我用od跟出下面代码,我想要脱离这个od调试exe的方法,获取任意一个16进制字符串解密。
目前我只能在od调试中修改内存,请问各位大佬,我应该怎么才能做到?
想法一:完全分析出解密过程,自己写程序。暂无能为力。。。
想法二:动态载入这个dll,获取call地址,然后调用,但不知道怎么做...
想法三:在原exe中写加个区段,写一段汇编,弹出输入框,输入要处理的16进制字符,然后调用call coodxxx.0043F76A,把解密后的字符串写到文件。可能能做到。。。
想法四,在exe运行时到指定汇编处,拦截暂停,修改指定处待解密的字符串,让它自己解密后获取,好像比较容易些
有没有大佬愿意帮忙教学,让我学习的?
解密前:9B 33 76 F8 0E 2B 85 59 A2 1B 00 78 02 41 CA C6 C0 57 F9 6A 9A B8 25 E4 DE 66 B1 EF 8C BC 37 5A
长度:32(1F)
解密后:7B 22 73 74 61 74 75 73 22 3A 22 31 22 2C 22 6D 73 67 22 3A 22 5C 75 37 36 37 62 5C 75 35 66 35
以解密第4个字节为例:
原字符:F8
解密出来是:74
反汇编0:
0040969A |> \03D8 |add ebx,eax
0040969C |. 899D 78FFFFFF |mov [local.34],ebx
004096A2 |. 8B9D 78FFFFFF |mov ebx,[local.34]
004096A8 |. 8A03 |mov al,byte ptr ds:[ebx]
004096AA |. 25 FF000000 |and eax,0xFF
004096AF |. 68 01030080 |push 0x80000301
004096B4 |. 6A 00 |push 0x0
004096B6 |. 50 |push eax
004096B7 |. 8B5D D0 |mov ebx,[local.12] //[local.12]指向的数值:F8
004096BA |. 8A03 |mov al,byte ptr ds:[ebx] //ebx字节:F8
004096BC |. 25 FF000000 |and eax,0xFF //位与
004096C1 |. 68 01030080 |push 0x80000301 //
004096C6 |. 6A 00 |push 0x0 //
004096C8 |. 50 |push eax //值:000000F8
004096C9 |. 68 02000000 |push 0x2
004096CE |. BB F0FB4300 |mov ebx,coodxxx.0043FBF0 //这里应该是一个子程序入口地址:参见反汇编1
004096D3 |. E8 92600300 |call coodxxx.0043F76A //这里应该是真正解密字符串的调用参见:反汇编解密
004096D8 |. 83C4 1C |add esp,0x1C //esp指向值1F(待解密字符串长度)
004096DB |. 8B5D D4 |mov ebx,[local.11] //
004096DE |. 8803 |mov byte ptr ds:[ebx],al //al这里就是解密完的字节:"74"
004096E0 |. 58 |pop eax ; 0019F84C
004096E1 |. 5B |pop ebx ; 0019F84C
004096E2 |. 59 |pop ecx ; 0019F84C
004096E3 |.^ E9 FFFAFFFF \jmp coodxxx.004091E7
反汇编1:
0043FBF0 . 8B4424 0C mov eax,dword ptr ss:[esp+0xC]
0043FBF4 . 8B4C24 08 mov ecx,dword ptr ss:[esp+0x8]
0043FBF8 . 8B5424 04 mov edx,dword ptr ss:[esp+0x4]
0043FBFC . 50 push eax
0043FBFD . 51 push ecx
0043FBFE . 52 push edx
0043FBFF . 6A 02 push 0x2
0043FC01 . E8 4AFFFFFF call coodxxx.0043FB50 //参见反汇编2:
0043FC06 . 83C4 10 add esp,0x10
0043FC09 . C3 retn
反汇编2:
0043FB50 /$ 8B5424 10 mov edx,dword ptr ss:[esp+0x10]
0043FB54 |. 8B4424 0C mov eax,dword ptr ss:[esp+0xC]
0043FB58 |. 83F8 01 cmp eax,0x1
0043FB5B |. 8B0A mov ecx,dword ptr ds:[edx]
0043FB5D |. 7E 2F jle short coodxxx.0043FB8E
0043FB5F |. 56 push esi ; coodxxx.004E6BB5
0043FB60 |. 8B7424 08 mov esi,dword ptr ss:[esp+0x8]
0043FB64 |. 57 push edi
0043FB65 |. 8D78 FF lea edi,dword ptr ds:[eax-0x1]
0043FB68 |> 8BC6 /mov eax,esi ; coodxxx.004E6BB5
0043FB6A |. 83C2 0C |add edx,0xC
0043FB6D |. 83E8 00 |sub eax,0x0 ; Switch (cases 0..2)
0043FB70 |. 74 0E |je short coodxxx.0043FB80
0043FB72 |. 48 |dec eax
0043FB73 |. 74 07 |je short coodxxx.0043FB7C
0043FB75 |. 48 |dec eax
0043FB76 |. 75 0A |jnz short coodxxx.0043FB82
0043FB78 |. 330A |xor ecx,dword ptr ds:[edx] ; Case 2 of switch 0043FB6D
0043FB7A |. EB 06 |jmp short coodxxx.0043FB82
0043FB7C |> 0B0A |or ecx,dword ptr ds:[edx] ; Case 1 of switch 0043FB6D
0043FB7E |. EB 02 |jmp short coodxxx.0043FB82
0043FB80 |> 230A |and ecx,dword ptr ds:[edx] ; Case 0 of switch 0043FB6D
0043FB82 |> 4F |dec edi ; Default case of switch 0043FB6D
0043FB83 |.^ 75 E3 \jnz short coodxxx.0043FB68
0043FB85 |. 8B4424 10 mov eax,dword ptr ss:[esp+0x10]
0043FB89 |. 5F pop edi
0043FB8A |. 5E pop esi ; coodxxx.004E6BB5
0043FB8B |. 8908 mov dword ptr ds:[eax],ecx
0043FB8D |. C3 retn
0043FB8E |> 8B5424 08 mov edx,dword ptr ss:[esp+0x8]
0043FB92 |. 890A mov dword ptr ds:[edx],ecx
0043FB94 \. C3 retn
反汇编解密:
0043F76A $ /FF25 6C3E4E00 jmp dword ptr ds:[0x4E3E6C] ; coodxxx.0045B210
0045B210 . 8D4424 08 lea eax,dword ptr ss:[esp+0x8]
0045B214 . 83EC 0C sub esp,0xC
0045B217 . 50 push eax
0045B218 . FF7424 14 push dword ptr ss:[esp+0x14]
0045B21C . 33C0 xor eax,eax
0045B21E . 894424 08 mov dword ptr ss:[esp+0x8],eax
0045B222 . 894424 0C mov dword ptr ss:[esp+0xC],eax
0045B226 . 894424 10 mov dword ptr ss:[esp+0x10],eax
0045B22A . 8D5424 08 lea edx,dword ptr ss:[esp+0x8]
0045B22E . 52 push edx
0045B22F . FFD3 call ebx 参见:反汇编解密1
0045B231 . 8B4424 0C mov eax,dword ptr ss:[esp+0xC]
0045B235 . 8B5424 10 mov edx,dword ptr ss:[esp+0x10]
0045B239 . 8B4C24 14 mov ecx,dword ptr ss:[esp+0x14]
0045B23D . 83C4 18 add esp,0x18
0045B240 . C3 retn
反汇编解密1地址内容和反汇编1一摸一样。。。
0043FBF0 . 8B4424 0C mov eax,dword ptr ss:[esp+0xC]
0043FBF4 . 8B4C24 08 mov ecx,dword ptr ss:[esp+0x8]
0043FBF8 . 8B5424 04 mov edx,dword ptr ss:[esp+0x4]
0043FBFC . 50 push eax
0043FBFD . 51 push ecx
0043FBFE . 52 push edx
0043FBFF . 6A 02 push 0x2
0043FC01 . E8 4AFFFFFF call coodxxx.0043FB50 //参见反汇编解密2
0043FC06 . 83C4 10 add esp,0x10
0043FC09 . C3 retn
反汇编解密2地址内容和反汇编2一摸一样的。。。
0043FB50 /$ 8B5424 10 mov edx,dword ptr ss:[esp+0x10]
0043FB54 |. 8B4424 0C mov eax,dword ptr ss:[esp+0xC]
0043FB58 |. 83F8 01 cmp eax,0x1
0043FB5B |. 8B0A mov ecx,dword ptr ds:[edx]
0043FB5D |. 7E 2F jle short coodxxx.0043FB8E
0043FB5F |. 56 push esi ; coodxxx.004E6BB5
0043FB60 |. 8B7424 08 mov esi,dword ptr ss:[esp+0x8]
0043FB64 |. 57 push edi
0043FB65 |. 8D78 FF lea edi,dword ptr ds:[eax-0x1]
0043FB68 |> 8BC6 /mov eax,esi ; coodxxx.004E6BB5
0043FB6A |. 83C2 0C |add edx,0xC
0043FB6D |. 83E8 00 |sub eax,0x0 ; Switch (cases 0..2)
0043FB70 |. 74 0E |je short coodxxx.0043FB80
0043FB72 |. 48 |dec eax
0043FB73 |. 74 07 |je short coodxxx.0043FB7C
0043FB75 |. 48 |dec eax
0043FB76 |. 75 0A |jnz short coodxxx.0043FB82
0043FB78 |. 330A |xor ecx,dword ptr ds:[edx] ; Case 2 of switch 0043FB6D
0043FB7A |. EB 06 |jmp short coodxxx.0043FB82
0043FB7C |> 0B0A |or ecx,dword ptr ds:[edx] ; Case 1 of switch 0043FB6D
0043FB7E |. EB 02 |jmp short coodxxx.0043FB82
0043FB80 |> 230A |and ecx,dword ptr ds:[edx] ; Case 0 of switch 0043FB6D
0043FB82 |> 4F |dec edi ; Default case of switch 0043FB6D
0043FB83 |.^ 75 E3 \jnz short coodxxx.0043FB68
0043FB85 |. 8B4424 10 mov eax,dword ptr ss:[esp+0x10]
0043FB89 |. 5F pop edi ; coodxxx.0045B231
0043FB8A |. 5E pop esi ; coodxxx.0045B231
0043FB8B |. 8908 mov dword ptr ds:[eax],ecx
0043FB8D |. C3 retn
0043FB8E |> 8B5424 08 mov edx,dword ptr ss:[esp+0x8]
0043FB92 |. 890A mov dword ptr ds:[edx],ecx
0043FB94 \. C3 retn
|
|