首页
社区
课程
招聘
[求助]汇编代码逆向为C的问题?
发表于: 2007-11-2 13:39 5391

[求助]汇编代码逆向为C的问题?

2007-11-2 13:39
5391
ebp+arg_0是字符缓冲区指针,ebp+arg_4是字符串的长度。
调用的方式为:
decry(char * buff,int len);
我就是不明白
.text:08051B6D                 lea     edx, [eax+eax]
这句是什么意思?

.text:08051B55 loc_8051B55: ; CODE XREF: decry+DAj
.text:08051B55 mov eax, [ebp+var_4]
.text:08051B58 cmp eax, [ebp+arg_4]
.text:08051B5B jge loc_8051C03

.text:08051B61 mov eax, [ebp+var_4]
.text:08051B64 add eax, [ebp+arg_0]
.text:08051B67 movzx eax, byte ptr [eax]
.text:08051B6A and eax, 1
.text:08051B6D lea edx, [eax+eax]
.text:08051B70 mov eax, [ebp+var_4]
.text:08051B73 add eax, [ebp+arg_0]
.text:08051B76 movzx eax, byte ptr [eax]
.text:08051B79 and eax, 2
.text:08051B7C shl eax, 6
.text:08051B7F or edx, eax
.text:08051B81 mov eax, [ebp+var_4]
.text:08051B84 add eax, [ebp+arg_0]
.text:08051B87 movzx eax, byte ptr [eax]
.text:08051B8A and eax, 4
.text:08051B8D shl eax, 4
.text:08051B90 or edx, eax
.text:08051B92 mov eax, [ebp+var_4]
.text:08051B95 add eax, [ebp+arg_0]
.text:08051B98 movzx eax, byte ptr [eax]
.text:08051B9B and eax, 8
.text:08051B9E shl eax, 2
.text:08051BA1 or edx, eax
.text:08051BA3 mov eax, [ebp+var_4]
.text:08051BA6 add eax, [ebp+arg_0]
.text:08051BA9 movzx eax, byte ptr [eax]
.text:08051BAC and eax, 10h
.text:08051BAF sar eax, 2
.text:08051BB2 or edx, eax
.text:08051BB4 mov eax, [ebp+var_4]
.text:08051BB7 add eax, [ebp+arg_0]
.text:08051BBA movzx eax, byte ptr [eax]
.text:08051BBD and eax, 20h
.text:08051BC0 sar eax, 2
.text:08051BC3 or edx, eax
.text:08051BC5 mov eax, [ebp+var_4]
.text:08051BC8 add eax, [ebp+arg_0]
.text:08051BCB movzx eax, byte ptr [eax]
.text:08051BCE and eax, 40h
.text:08051BD1 sar eax, 2
.text:08051BD4 or edx, eax
.text:08051BD6 mov eax, [ebp+var_4]
.text:08051BD9 add eax, [ebp+arg_0]
.text:08051BDC movzx eax, byte ptr [eax]
.text:08051BDF and eax, 80h
.text:08051BE4 sar eax, 7
.text:08051BE7 or eax, edx
.text:08051BE9 mov [ebp+var_5], al
.text:08051BEC mov eax, [ebp+var_4]
.text:08051BEF mov edx, [ebp+arg_0]
.text:08051BF2 add edx, eax
.text:08051BF4 mov al, [ebp+var_5]
.text:08051BF7 mov [edx], al
.text:08051BF9 lea eax, [ebp+var_4]
.text:08051BFC inc dword ptr [eax]
.text:08051BFE jmp loc_8051B55

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 1946
活跃值: (248)
能力值: (RANK:330 )
在线值:
发帖
回帖
粉丝
2
↓
2007-11-2 13:45
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
eax*2
2007-11-2 13:47
0
雪    币: 3
活跃值: (394)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
4
逆向出来的代码,不知道对不对?


decry(char * buff,int len)
{

int i;
char t;
char s;
for (i=0;i<len;i++)
{

t=buff;
t=t&0x1;
s=t+t;

t=buff;
t=t&0x2;
t=t<<6;
s=s | t;


t=buff;
t=t&0x4;
t=t<<4;
s=s | t;

t=buff;
t=t&0x8;
t=t<<2;
s=s | t;


t=buff;
t=t&0x10;
t=t>>2;
s=s | t;

t=buff;
t=t&0x20;
t=t>>2;
s=s | t;


t=buff;
t=t&0x40;
t=t>>2;
s=s | t;

t=buff;
t=t&0x80;
t=t>>7;
t=t | s;

buff=t;

}
}


2007-11-2 13:56
0
游客
登录 | 注册 方可回帖
返回
//