【3.A.S.T】网络安全爱好者's Archiver

黑客学习

ice_xke 发表于 2010-10-19 12:30

全局动态调用

全局动态调用笔记
#U/JLtbP)n.Q svchost files工程->插入->类(Generic Class DTDY)->DTDY.cpp DTDY.hv o/p*LQWq*`(N ap
----------------------------------------
j7B!V#A"V+zW.B;R DTDY.h:
?I-{A)M3{]Y
`"E(n5}$~.H8G`SP #if _MSC_VER>1000
5K%B0J Jd'~B9u/d #pragma onced6oJY%T/`$i(}'X$l
#endif //_MSC_VER>1000'd x6`WFx&`F
#include<windows.h>
q$R&RJGU,\ R I X1{h vR1D#w4u
typedef DWORD (__stdcall *pGetModuleFileNameA)(HMODULE,LPSTR,DWORD);x#cH)vJS:Jn
class DTDY5cby*h:V7X;] z S
{
6e8C#bH1^?r'F!H public:
3i8d7['?.?Ai DTDY();
y9{\4U7`j2\3[ virtual ~DTDY();
4cf2Q6bv:z public:
G9N'A%pc;x static pGetModuleFileNameA MyGetModuleFileName;
b,y6] v5`^+OpM static BOOL FunInitiallization();
#u4of2~P7l };+W!l YY\
#endif
Y|$w$A&se5h4[5A ----------------------------------------
$M/^f ]e(^
/?v1K;f e2QO DTDY.cpp:
&LtLj4] o BV4HU J+E"ar.Ie7l"z
#include "DTDY.h"r Au2AVeb
pGetModuleFileNameA DTDY::MyGetModuleFileName=NULL;
@ W;N-y4`p DTDY:TDY()
3P Fe7[ Y;KPVJ Ti {8s:a hL i r1JcRN6TQ)m
}A5Arv*lE)k#Qv
DTDY::~DTDY()
Gq$}4SM{*N/t(g {'y%Q-zi_+^xkj
}
'M#X-u"HF-e BOOL DTDY::FunInitiallization()
u\i%n9j*Bp9W+] {E7nPk#U|+G
HMODULE hModule=LoadLibrary("kernel32.dll");CM@ {-J*b T
MyGetModuleFileName=(pGetModuleFileNameA)GetProcAddress(hModule,"GetModuleFileNameA");g*E7Eo6s,Mfzj
if(!MyGetModuleFileName=) return FALSE;~ Z,[Kyx

&il7|+HIm G6_ return TRUE;
%K4}i?C-N }
| dU%{(ZDv ----------------------------------------
.|)oP1k)Tb&OT)@ svchost.cpp:)E?IJz6@/q gs{

%w Uz+h6W)Ht7Q5iKMh #include "DTDY.h"I|,u,C'{X3g7L&^
`,gh6y$K3SQy
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
lp MW Hd {
*|2R@V6d j%Pj switch(ul_reason_for_call)
GZg$a(P[ O2[hX {0e-H3B|h qrDDL5o
case DLL_PROCESS_ATTACH:
?'g:j I^K3| f9@ if(!DTDY::FunInitiallization()) return FALSE;,wC!\"z"_O-MS

,M a#T$c [_D break;
*M/k} TyG }CQf l6u!@v)}
}Let,o(`xB ^FKJ

C!b D;CX_hvl
1Lq K*dk GetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));->goto def;W9_@7O!dA
改写为m~-A-LJ9U
DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strFileName,sizeof(strFileName));
2Is$i;U;P,Gw ----------------------------------------
v(D?0^D K6N4i KernelManager.cpp:
b b"TN0kFo u
JUZ[-N&m #include "../DTDY.h"
]@^8d|N GetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));
Dq4Af[ fU(r 改写为
8oaTO]:LB DTDY::MyGetModuleFileName(CKeyboardManager::g_hInstance,strServiceDll,sizeof(strServiceDll));5iS v~5?3[x l{;F
----------------------------------------

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.