能力值:
( LV8,RANK:120 )
|
-
-
2 楼
hook native api 更好些吧
不过还是支持
|
能力值:
( LV3,RANK:20 )
|
-
-
3 楼
dll加载了,但是貌似没有hook成功,你的nsis中删除什么文件的?
|
能力值:
( LV6,RANK:80 )
|
-
-
4 楼
桌面上的2345.txt文件,
Section "MainSection" SEC01 Delete "$DESKTOP\2345.txt" SectionEnd
点击安装的时候进行删除文件操作的。
|
能力值:
( LV8,RANK:130 )
|
-
-
5 楼
SetWindowsHookEx能对所有进程安装钩子?
我咋不知道,看来技术 不够呢
|
能力值:
( LV8,RANK:130 )
|
-
-
6 楼
你的安装包是什么工具,我不清楚,
但是目测 ,你这个对windowsinstall安装包无效
|
能力值:
( LV3,RANK:20 )
|
-
-
7 楼
HookDll,在def文件中导出函数EnterInjectMode,然后在cmd下
执行rundll32 HookDll.dll EnterInjectMode,测试OK
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"
#include <mhook.h>
#pragma comment(lib, "mhook.lib")
#pragma comment(linker, "/Section:.shared,RWS")
#pragma data_seg(".shared")
HHOOK g_hHook = NULL;
#pragma data_seg()
HMODULE g_hDll = 0;
typedef BOOL (WINAPI *pfnDeleteFileW)(LPCWSTR lpFileName);
typedef BOOL (WINAPI *pfnDeleteFileA)(LPCSTR lpFileName);
pfnDeleteFileW realDeleteFileW = DeleteFileW;
pfnDeleteFileA realDeleteFileA = DeleteFileA;
BOOL WINAPI MyDeleteFileA(LPCSTR lpFileName)
{
MessageBox(NULL, lpFileName, "In MyDeleteFileA", 0);
return FALSE;
}
BOOL WINAPI MyDeleteFileW(LPCWSTR lpFileName)
{
MessageBoxW(NULL, lpFileName, L"In MyDeleteFileW", 0);
return FALSE;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hDll = hModule;
Mhook_SetHook((PVOID*)&realDeleteFileA, MyDeleteFileA);
Mhook_SetHook((PVOID*)&realDeleteFileW, MyDeleteFileW);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
Mhook_Unhook((PVOID*)&realDeleteFileA);
Mhook_Unhook((PVOID*)&realDeleteFileW);
break;
}
return TRUE;
}
LRESULT CALLBACK GlobalCBTHook(int nCode, WPARAM w, LPARAM l)
{
if(g_hHook)
{
return CallNextHookEx(g_hHook, nCode, w, l);
}
return 0;
}
BOOL WINAPI InstallGlobalHook()
{
g_hHook = SetWindowsHookEx(WH_CBT, GlobalCBTHook, g_hDll, 0);
return g_hHook==NULL?FALSE:TRUE;
}
void WINAPI UninstallGlobalHook()
{
if(g_hHook)
{
UnhookWindowsHookEx(g_hHook);
}
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM w, LPARAM l)
{
if(WM_DESTROY == msg)
{
PostQuitMessage(0);
}
return DefWindowProcA(hWnd, msg, w, l);
}
void WINAPI EnterMessageLoop()
{
do
{
WNDCLASSEXA wcex = {sizeof(wcex)};
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = g_hDll;
wcex.hIcon = LoadIcon(NULL, IDI_INFORMATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wcex.lpszClassName = "DeleteHook";
if(!RegisterClassExA(&wcex))
{
break;
}
HWND hWnd = CreateWindowExA(0, "DeleteHook", NULL, WS_OVERLAPPEDWINDOW,
0, 0, 50, 50, NULL, NULL, g_hDll, NULL);
if(!IsWindow(hWnd))
{
break;
}
UpdateWindow(hWnd);
MSG msg;
while(GetMessage(&msg, hWnd, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
} while (FALSE);
}
//导出函数
void WINAPI EnterInjectMode()
{
if(!InstallGlobalHook())
{
MessageBox(0, "InstallGlobalHook FAIL", "", 0);
return;
}
char szExe[MAX_PATH+1] = {0};
char szPath[MAX_PATH+1] = {0};
GetModuleFileName(NULL, szPath, MAX_PATH);
strcpy(szExe, strrchr(szPath, '\\')+1);
if(!strcmpi(szExe, "rundll32.exe"))
EnterMessageLoop();
}
|
能力值:
( LV6,RANK:80 )
|
-
-
8 楼
亲,请问在WIN8上有效果么?
|
能力值:
( LV2,RANK:10 )
|
-
-
9 楼
你先看看那个安装进程里有没DLL
|
能力值:
( LV6,RANK:80 )
|
-
-
10 楼
经过测试,xp,win7可以hook,WIN8中连dll都没注入到那个进程
|
能力值:
( LV6,RANK:80 )
|
-
-
11 楼
亲,HOOK ShellExecuteA,
typedef HINSTANCE (WINAPI *PFNSHELLEXECUTEA)(HWND hwnd,LPCSTR lpOperation,LPCSTR lpFile,LPCSTR lpParameters,LPCSTR lpDirectory,INT nShowCmd);
PFNSHELLEXECUTEA TrueShellExecute=(PFNSHELLEXECUTEA)GetProcAddress(GetModuleHandle(L"shell32"),"ShellExecuteA");
HINSTANCE WINAPI HookShellExecute(HWND hwnd,LPCSTR lpOperation,LPCSTR lpFile,LPCSTR lpParameters,LPCSTR lpDirectory,INT nShowCmd)
{
return TrueShellExecute(hwnd,lpOperation,lpFile,lpParameters,lpDirectory,nShowCmd);
}
Mhook_SetHook((PVOID*)&TrueShellExecute,HookShellExecute);
这样运行时候弹出:应用程序初始化失败。。。。。调试发现是
GetProcAddress(GetModuleHandle(L"shell32"),"ShellExecuteA");这块的问题,这里如何调整呢,求指导
|
能力值:
( LV6,RANK:80 )
|
-
-
12 楼
OK了,对应模块加载进去就好了。
|