星外飞客

关于nag窗口的去除办法有三种:
修改资源,动态分析,静态分析;

说到窗口,不得不说一下,目前为止用得最多的几种,其实窗口的范围很广,大到一个window,小到一个button,等等都可以列入窗口之列;

要想nag一个窗口,本人觉得首先你必须对你nag的对象有个了解才行,我们常常要nag的窗口包括:

MessageBox 消息框
产生:
消息框的产生也许你在任何一本有关GUI编程的书中都能找到,调用一API函数,
The MessageBox function creates, displays, and operates a message box.
The message box contains an application-defined message and title,
plus any combination of predefined icons and push buttons.
MessageBox函数创建,显示,并且控制一个消息框,消息框包含应用程序已定于的消息和标题,再加上一个预定义的图标和按钮.
int MessageBox(
HWND hWnd, // handle of owner window 拥有这个消息框的窗口句柄
LPCTSTR lpText, // address of text in message box 在消息框中的文本的地址( 指针)
LPCTSTR lpCaption, // address of title of message box 消息框标题的地址
UINT uType // style of message box 消息框的样式,( 可以设定的值很多,详细请参考API手册或是MSDN)
);

对于消息框的去除,有下列几种方法可以尝试: 我们用一个例子说明:
反汇编后的代码如下:
00401000 >/$ 6A 00 push 0 ; /Style = MB_OK|MB_APPLMODAL
00401002 |. 68 00304000 push 00403000 ; |Title = "Acid_Cool_178′s"
00401007 |. 68 10304000 push 00403010 ; |Text = "Win32Asm Crackme 1"
0040100C |. 6A 00 push 0 ; |hOwner = NULL
0040100E |. E8 2D000000 call ; \MessageBoxA
00401013 |. 6A 00 push 0 ; /Style = MB_OK|MB_APPLMODAL
00401015 |. 68 23304000 push 00403023 ; |Title = "Greetings goes too all my friends.."
0040101A |. 68 47304000 push 00403047 ; |Text = "Hellforge, tCA, FHCF, DQF and the rest…"
0040101F |. 6A 00 push 0 ; |hOwner = NULL
00401021 |. E8 1A000000 call ; \MessageBoxA

00401026 |. 6A 00 push 0 ; /Style = MB_OK|MB_APPLMODAL
00401028 |. 68 71304000 push 00403071 ; |Title = "Remove Me!"
0040102D |. 68 7C304000 push 0040307C ; |Text = "NAG NAG"
00401032 |. 6A 00 push 0 ; |hOwner = NULL
00401034 |. E8 07000000 call ; \MessageBoxA 这个消息框是我们要去除的
00401039 |. 6A 00 push 0 ; /ExitCode = 0
0040103B \. E8 06000000 call ; \ExitProcess

方法1: 跳过警告窗口的那段代码;用JMP指令;

1)用hiew打开程序: Crackeme_01.exe
2)回车键进入代码模式,F5进入你要修改的地址,如果是虚拟地址前面加点号;本例输入: .401026
3)F3进入编辑状态,此时地址显示的是文件偏移地址;
4)在指定行上回车键或者F2修改汇编代码,输入: jmp 000000439后,ESC键返回,确认后,F9存盘!
5) 运行程序; nag 窗口没了;

方法2:
用NOP指令填充401026到401039之间的代码;
1)用hiew打开程序;
2)回车进入16进制模式,F5进入你要修改的地址
3)F3进入编辑状态,用90填充426–439之间的数据!
4)F9 存盘后运行,NOG窗口没了!

方法3:改WM_CLOSE 消息跳转;本例中直接调用三个messagebox函数,所以此方法不用;

DialogBox 对话框
什么是对话框;
一个对话框被作为资源定义,这和菜单的定义有很多相同之处.
你写一个对话框模版用来描述这个对话框的特征面( 属性) 和它拥有的控件并用资源编辑器将这些资源脚本组合在一起.
有两种类型的对话框: 模式的和非模式的.非模式的对话框能让你切换输入焦点给其他窗口.如word中的查找对话框就是非模式的.
模式对话框有两种子类型: 应用程序模式和系统模式.一个应用程序模式对话框不让你切换输入焦点给属于同一应用程序的其他窗口了,
但是你能切换输入焦点给其他的应用程序窗口.一个系统模式的对话框不允许你切换输入焦点给任何其它窗口,直到你响应它为止.
对话框的产生:
模式对话框是通过调用CreateDialogParam API 函数来创建的.模式对话框是通过调用DialogBoxParam函数创建。
应用程序模式对话框和系统模式对话框唯一的区别就是系统模式对话框指定DS_SYSMODAL样式.
如果在一个对话框模版中包含DS_SYSMODAL样式,那么这个对话框将是系统模式的对话框.
int DialogBoxParam(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpTemplateName, // identifies dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc, // pointer to dialog box procedure
LPARAM dwInitParam // initialization value
);

HWND CreateDialogParam(
HINSTANCE hInstance, // handle to application instance 应用程序实例句柄
LPCTSTR lpTemplateName, // identifies dialog box template 对话框模版标识 ,ID号
HWND hWndParent, // handle to owner window 拥有对话框的窗口句柄,父窗口句柄
DLGPROC lpDialogFunc, // pointer to dialog box procedure 指向对话框过程的指针,
LPARAM dwInitParam // initialization value 初始化值
);

这两个函数中在去除NAG窗口时有两个窗口很重要:
DLGPROC lpDialogFunc, // pointer to dialog box procedure 指向对话框过程的指针
LPCTSTR lpTemplateName, // identifies dialog box template 对话框模版标识 ,ID号
这两个参数决定了你想创建什么样的对话框,和对话框可以做些什么!
如果程序中有两个NAG窗口,我们就可以将这两个参数嫁接到另一个对话框函数的这两个参数上;来看看这种方法;
1)打开资源黑客,找到我们要移出的对话框ID号为121D,16进制为:0×79,还有其它两个对话框

00401051 |. 6A 00 push 0 ; /lParam = NULL
00401053 |. 68 C4104000 push 004010C4 ; |DlgProc = Nag.004010C4
00401058 |. 6A 00 push 0 ; |hOwner = NULL
0040105A |. 6A 79 push 79 ; |pTemplate = 79 我们要移出的对话框
0040105C |. 50 push eax ; |hInst
0040105D |. A3 9C114000 mov dword ptr [40119C], eax ; |
00401062 |. FF15 10104000 call dword ptr [<&USER32.DialogBoxPar>; \DialogBoxParamA

004010E5 . 6A 00 push 0 ; /lParam = NULL
004010E7 . 68 09114000 push 00401109 ; |DlgProc = Nag.00401109
004010EC . 6A 00 push 0 ; |hOwner = NULL
004010EE . 6A 65 push 65 ; |pTemplate = 65
004010F0 . 6A 00 push 0 ; |/pModule = NULL
004010F2 . FF15 00104000 call dword ptr [<&KERNEL32.GetModuleH>; |\GetModuleHandleA
004010F8 . 50 push eax ; |hInst
004010F9 . FF15 10104000 call dword ptr [<&USER32.DialogBoxPar>; \DialogBoxParamA

方法一: 将创建目标对话框的窗口作如下更改
00401051 |. 6A 00 push 0 ; /lParam = NULL
004010E7 . 68 09114000 push 00401109 ; |DlgProc = Nag.00401109
004010EC . 6A 00 push 0 ; |hOwner = NULL
004010EE . 6A 65 push 65 ; |pTemplate = 65
0040105C |. 50 push eax ; |hInst
0040105D |. A3 9C114000 mov dword ptr [40119C], eax ; |
00401062 |. FF15 10104000 call dword ptr [<&USER32.DialogBoxPar>; \DialogBoxParamA

用hiew打开,nag.exe
1)回车,转换到代码窗口
2)F5,输入 .401053 来到DlgProc处 ,
3)F3进入编辑状态 ,回车后输入 PUSH 00401109
4)回车来到 push 79 处,改为 PUSH 65后ESC退出
5)F9存盘,运行程序,嘿嘿,成功;

方法二:可以用Jmp指令直接跳到
004010E5 . 6A 00 push 0 ;

用hiew打开,nag.exe
1)回车,转换到代码窗口
2)F5,输入 .4010E5,在按F3 ,查看文件偏移: 为10E5
3)ESC返回到代码窗口,F5查找.401051
4)F3进入编辑状态 ,回车后输入 jmp 10E5
5)F9存盘,运行程序,嘿嘿,成功

方法三: 修改资源,设置对话框的样式为隐藏

版权所有,转载请注明出处。
转载自 <a href="http://www.yanghengfei.com/archives/161/" title="关于NAG窗口的移除方法" rel="bookmark">关于NAG窗口的移除方法 | 星外飞客 </a>

我简单说几句

随机推荐

最新评论

无觅相关文章插件,快速提升流量