分析学习【2】—— 隐藏初始化

在开始调用驱动杀杀软的时候,有如下代码。前面的GetInputState,然后再PostThreadMessageA还有PeekMessageA是用来隐藏初始化,后面的CreatEventA可以用来当做互斥变量。

一、关于GetInputState、PostThreadMessageA还有PeekMessageA三个函数作用,GetInputState(http://msdn.microsoft.com/en-us/library/windows/desktop/ms644935(v=vs.85).aspx)是用来判断线程消息队列是否有键盘消息或者按键消息的。然后Post和Peek分别是发送和接收消息。

二、CreatEvent的话,则是创建一个事件,通过GetLastError来判断错误代码是否为183(ERROR_ALREADY_EXISTS),起到互斥作用。

代码如下:

.text:7100125B ; =============== S U B R O U T I N E =======================================
.text:7100125B
.text:7100125B
.text:7100125B ; DWORD __stdcall kill_SecProcess(LPVOID)
.text:7100125B kill_SecProcess proc near               ; DATA XREF: DllEntryPoint+7Co
.text:7100125B                                         ; SvchostEntry_W32Time+36o
.text:7100125B
.text:7100125B var_20          = dword ptr -20h
.text:7100125B Msg             = tagMSG ptr -1Ch
.text:7100125B
.text:7100125B                 sub     esp, 20h
.text:7100125E                 push    ebx
.text:7100125F                 push    ebp
.text:71001260                 push    esi
.text:71001261                 push    edi
.text:71001262                 call    ds:GetInputState
.text:71001268                 xor     esi, esi
.text:7100126A                 push    esi             ; lParam
.text:7100126B                 push    esi             ; wParam
.text:7100126C                 push    esi             ; Msg
.text:7100126D                 call    ds:GetCurrentThreadId
.text:71001273                 push    eax             ; idThread
.text:71001274                 call    ds:PostThreadMessageA ;
.text:7100127A                 push    1               ; wRemoveMsg
.text:7100127C                 push    esi             ; wMsgFilterMax
.text:7100127D                 push    esi             ; wMsgFilterMin
.text:7100127E                 push    esi             ; hWnd
.text:7100127F                 lea     eax, [esp+40h+Msg]
.text:71001283                 push    eax             ; lpMsg
.text:71001284                 call    ds:PeekMessageA
.text:7100128A                 mov     edi, ds:LoadLibraryW
.text:71001290                 push    offset aSleep   ; "Sleep"
.text:71001295                 push    offset LibFileName ; "kernel32.dll"
.text:7100129A                 call    edi ; LoadLibraryW
.text:7100129C                 mov     ebx, ds:GetProcAddress
.text:710012A2                 push    eax             ; hModule
.text:710012A3                 call    ebx ; GetProcAddress
.text:710012A5                 mov     ebp, eax        ; ebp :Sleep
.text:710012A7                 call    Anti_debug
.text:710012AC                 test    eax, eax
.text:710012AE                 jnz     short loc_710012E4
.text:710012B0                 nop
.text:710012B1                 nop
.text:710012B2                 push    offset Name     ; "NSDownLoader26AVip20081206"
.text:710012B7                 push    esi             ; bInitialState
.text:710012B8                 push    esi             ; bManualReset
.text:710012B9                 push    esi             ; lpEventAttributes
.text:710012BA                 call    ds:CreateEventA ; 创建事件对象,初始无信号,并自动置事件有信号
.text:710012C0                 mov     [esp+30h+var_20], eax
.text:710012C4                 call    ds:GetLastError
.text:710012CA                 cmp     [esp+30h+var_20], esi
.text:710012CE                 jz      short loc_710012D7
.text:710012D0                 cmp     eax, 183        ; 判断该对象是否已经被创建,如果是则退出进程
.text:710012D5                 jnz     short loc_710012EB ; 如果该对象第一次被创建
.text:710012D7


不过

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值