找寻盗号木马的踪迹。

这一段时间,我在找盗号木马的踪迹,这是我的记录及心得。请大佬绕步。

我的系统是windows11系统。找盗号木马,用的是这个命令。

netstat -p TCP -anb

最后的-b参数能显示进程名。

根据进程找可疑ip可以定位木马。。。

这段代码通过进程名获得pid.

#写一段hook指定进程的程序


import psutil

def hook_process(process_name):
    for proc in psutil.process_iter():
        try:
            pinfo = proc.as_dict(attrs=['pid', 'name', 'cmdline'])
        except psutil.NoSuchProcess:
            pass
        else:
            if pinfo['name'] == process_name:
                print(pinfo)
                return pinfo['pid']
                
if __name__ == '__main__':
    pid = hook_process('SearchHost.exe')
    if pid:
        print('hook process success')
    else:
        print('hook process failed')

我在SearchHost进程中找到了CoreMessaging.dll模块,里面的PostMessageW函数可疑。下面是我的hook代码。。。

#根据进程pid钩住CoreMessaging.dll模块的PostMessagew函数


from ctypes import *  
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM  
  
# Load DLL  
dll = windll.LoadLibrary("CoreMessaging.dll")  
  
# Get PostMessage function from DLL  
PostMessage = dll.PostMessageW  
  
# Set argument types and return type of PostMessage  
PostMessage.argtypes = [HWND, UINT, WPARAM, LPARAM]  
PostMessage.restype = BOOL  # According to the documentation, PostMessage returns a BOOL  
  
# Create a handle to a window (HWND)  
hwnd = c_int(6224)  # You should replace this with the actual window handle you want to send the message to  
  
# Define the message you want to send (UINT) and the parameters for the message (WPARAM and LPARAM)  
message = 0x100  # You should replace this with the actual message you want to send  
wparam = 0  
lparam = 0  
  
# Call PostMessage with the given arguments  
#result = PostMessage(hwnd, message, wparam, lparam)  
result = PostMessage(6224, message, wparam, lparam)
if result == 0:  
    print("Failed to post message")  
else:  
    print("Message posted successfully")

我将这两个文件发上来。同时还有相关工具。。。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值