首页
社区
课程
招聘
关于琢石成器中两个例子的一点小问题
发表于: 2010-3-24 00:05 4389

关于琢石成器中两个例子的一点小问题

2010-3-24 00:05
4389
是一个关于进程间通信的例子
这是post端
------------------------------------------------------------------------------------------------
                .386
                .model flat,stdcall
                option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include        windows.inc
include        user32.inc
includelib        user32.lib
include        kernel32.inc
includelib        kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                .data
hWnd        dd        ?
szBuffer        db        256        dup(?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                .const
szCaption        db        'SendMessage',0
szStart                db        'Press OK to start SendMessage,param:08x!',0
szReturn        db        'SendMessage returned',0
szDestClass        db        'MyClass',0
szText                db        'Text send to other windows',0
szNotFound        db        'Receive Message Window not found!',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                .code
start:
                invoke        FindWindow,addr szDestClass,NULL
                .if        eax
                        mov hWnd,eax
                        invoke        wsprintf,addr szBuffer,addr szStart,addr szText
                        invoke        MessageBox,NULL,offset szBuffer,offset szCaption,MB_OK
                        invoke        SendMessage,hWnd,WM_SETTEXT,0,addr szText
                        invoke        MessageBox,NULL,offset szReturn,offset szCaption,MB_OK
                .else
                        invoke        MessageBox,NULL,offset szNotFound,offset szCaption,MB_OK
                .endif
                invoke        ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                end start

反汇编后的代码是
--------------------------------------------
00401000 >/$  6A 00         push    0                                ; /Title = NULL
00401002  |.  68 66204000   push    00402066                         ; |Class = "MyClass"
00401007  |.  E8 7C000000   call    <jmp.&user32.FindWindowA>        ; \FindWindowA
0040100C  |.  0BC0          or      eax, eax
0040100E  |.  74 58         je      short 00401068
00401010  |.  A3 00304000   mov     dword ptr [403000], eax
00401015  |.  68 6E204000   push    0040206E                         ;  ASCII "Text send to other windows"
0040101A  |.  68 28204000   push    00402028                         ; /Format = "Press OK to start SendMessage,param:08x!"
0040101F  |.  68 04304000   push    00403004                         ; |s = postnode.00403004
00401024  |.  E8 59000000   call    <jmp.&user32.wsprintfA>          ; \wsprintfA
00401029  |.  83C4 0C       add     esp, 0C                          ;  堆栈使用完毕,释放堆栈
0040102C  |.  6A 00         push    0                                ; /Style = MB_OK|MB_APPLMODAL
0040102E  |.  68 1C204000   push    0040201C                         ; |Title = "SendMessage"
00401033  |.  68 04304000   push    00403004                         ; |Text = ""
00401038  |.  6A 00         push    0                                ; |hOwner = NULL
0040103A  |.  E8 4F000000   call    <jmp.&user32.MessageBoxA>        ; \MessageBoxA
0040103F  |.  68 6E204000   push    0040206E                         ; /lParam = 40206E
00401044  |.  6A 00         push    0                                ; |wParam = 0
00401046  |.  6A 0C         push    0C                               ; |Message = WM_SETTEXT
00401048  |.  FF35 00304000 push    dword ptr [403000]               ; |hWnd = NULL
0040104E  |.  E8 41000000   call    <jmp.&user32.SendMessageA>       ; \SendMessageA
00401053  |.  6A 00         push    0                                ; /Style = MB_OK|MB_APPLMODAL
00401055  |.  68 1C204000   push    0040201C                         ; |Title = "SendMessage"
0040105A  |.  68 51204000   push    00402051                         ; |Text = "SendMessage returned"
0040105F  |.  6A 00         push    0                                ; |hOwner = NULL
00401061  |.  E8 28000000   call    <jmp.&user32.MessageBoxA>        ; \MessageBoxA
00401066  |.  EB 13         jmp     short 0040107B
00401068  |>  6A 00         push    0                                ; /Style = MB_OK|MB_APPLMODAL
0040106A  |.  68 1C204000   push    0040201C                         ; |Title = "SendMessage"
0040106F  |.  68 89204000   push    00402089                         ; |Text = "Receive Message Window not found!"
00401074  |.  6A 00         push    0                                ; |hOwner = NULL
00401076  |.  E8 13000000   call    <jmp.&user32.MessageBoxA>        ; \MessageBoxA
0040107B  |>  6A 00         push    0                                ; /ExitCode = 0
0040107D  \.  E8 18000000   call    <jmp.&kernel32.ExitProcess>      ; \ExitProcess
00401082   $- FF25 14204000 jmp     dword ptr [<&user32.wsprintfA>]  ;  user32.wsprintfA
00401088   $- FF25 10204000 jmp     dword ptr [<&user32.FindWindowA>>;  user32.FindWindowA
0040108E   $- FF25 0C204000 jmp     dword ptr [<&user32.MessageBoxA>>;  user32.MessageBoxA
00401094   $- FF25 08204000 jmp     dword ptr [<&user32.SendMessageA>;  user32.SendMessageA
0040109A   .- FF25 00204000 jmp     dword ptr [<&kernel32.ExitProces>;  kernel32.ExitProcess

请问从401082到40109A的那些jmp有何用处?

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (13)
雪    币: 75
活跃值: (618)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
2
你看看这些地址

00402014
00402010
....
它们保存的内容,和 user32.wsprintfA,user32.FindWindowA
。。。。的地址比较一下就知道了
2010-3-24 00:12
0
雪    币: 161
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
啊。。。原来前面的call是call到了这里啊。。。
谢谢了。。。
2010-3-24 00:14
0
雪    币: 161
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
_ProcWinMain        proc uses ebx edi esi,hWnd,uMsg,wParam,lParam       
---
像是这个窗口过程中的uses是啥意思?
我知道前面是把ebx,edi,esi压入栈,但是后面那几个变量作何用的?
谢谢
2010-3-24 00:16
0
雪    币: 401
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
后面那四个是参数。uses告诉编译器我要使用后面的这几个寄存器,你帮我保护和恢复现场。也可以不使用uses,自己保护和恢复现场,就是一开始push ebx,push edi,push esi,最后再pop esi,pop edi,pop ebx。
2010-3-24 10:18
0
雪    币: 285
活跃值: (16)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
6
那是IAT,晕死
2010-3-24 14:08
0
雪    币: 285
活跃值: (16)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
7
00401082   $- FF25 14204000 jmp     dword ptr [<&user32.wsprintfA>]  ;  user32.wsprintfA
00401088   $- FF25 10204000 jmp     dword ptr [<&user32.FindWindowA>>;  user32.FindWindowA
0040108E   $- FF25 0C204000 jmp     dword ptr [<&user32.MessageBoxA>>;  user32.MessageBoxA
00401094   $- FF25 08204000 jmp     dword ptr [<&user32.SendMessageA>;  user32.SendMessageA
0040109A   .- FF25 00204000 jmp     dword ptr [<&kernel32.ExitProces>;  kernel32.ExitProcess
是这部分代码吧?
2010-3-24 14:10
0
雪    币: 285
活跃值: (16)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
8
前面的CALL全都通过这里调用真正的IAT的
2010-3-24 14:11
0
雪    币: 161
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
非常感谢各位,完全明白了
2010-3-24 18:58
0
雪    币: 49
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
有没有 琢石成器 的TXT版啊(手机版),我看加解三总是睡着,灯都忘关了
2010-3-24 19:02
0
雪    币: 161
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
还是买一本吧。。。
纸质的书比电子版的要有感觉的多
chinapub上最近买一送一,很有性价比。。。
2010-3-24 19:07
0
雪    币: 49
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
白天没时间看,晚上看看就睡着了,然后半夜要又起来关灯。
2010-3-24 19:11
0
雪    币: 10
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
13
   你学习比较认真   我都是看书看得烦了,然后才睡觉,还睡不着!!想书里的东西!
2010-3-25 19:41
0
雪    币: 34
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
snn
14
哪里有电子版可以下啊!!!
2010-4-17 08:40
0
游客
登录 | 注册 方可回帖
返回
//