当前位置: 首页 > news >正文

网站建设分为哪些方面做阿里巴巴网站的电话号码

网站建设分为哪些方面,做阿里巴巴网站的电话号码,app官方网站,温州论坛在此前的一篇#xff0c;我们已经介绍过了注入Dll 阻止任务管理器结束进程 -- Win 10/11。本篇利用 hook NtQuerySystemInformation 并进行断链的方法实现进程隐身#xff0c;实测支持 taskmgr.exe 的任意多进程隐身。 任务管理器 代码#xff1a; // dllmain.cpp : 定义 …在此前的一篇我们已经介绍过了注入Dll 阻止任务管理器结束进程 -- Win 10/11。本篇利用 hook  NtQuerySystemInformation 并进行断链的方法实现进程隐身实测支持 taskmgr.exe 的任意多进程隐身。 任务管理器 代码 // dllmain.cpp : 定义 DLL 应用程序的入口点。 #include pch.h #include detours/detours.h #include winternl.h #include string #include iostream #include stdio.h #include vector #include shared_mutex#pragma comment(lib, detours.lib) #pragma comment(lib, user32.lib)typedef struct _VM_COUNTERS {SIZE_T PeakVirtualSize;SIZE_T VirtualSize;ULONG PageFaultCount;SIZE_T PeakWorkingSetSize;SIZE_T WorkingSetSize;SIZE_T QuotaPeakPagedPoolUsage;SIZE_T QuotaPagedPoolUsage;SIZE_T QuotaPeakNonPagedPoolUsage;SIZE_T QuotaNonPagedPoolUsage;SIZE_T PagefileUsage;SIZE_T PeakPagefileUsage; } VM_COUNTERS;// 线程信息结构体 typedef struct _MY_SYSTEM_THREAD_INFORMATION {LARGE_INTEGER KernelTime;LARGE_INTEGER UserTime;LARGE_INTEGER CreateTime;ULONG WaitTime;PVOID StartAddress;CLIENT_ID ClientId;KPRIORITY Priority;KPRIORITY BasePriority;ULONG ContextSwitchCount;LONG State;// 状态,是THREAD_STATE枚举类型中的一个值LONG WaitReason;//等待原因, KWAIT_REASON中的一个值 } MY_SYSTEM_THREAD_INFORMATION, * PMY_SYSTEM_THREAD_INFORMATION;typedef struct _MY_UNICODE_STRING {USHORT Length;USHORT MaximumLength;PWSTR Buffer; } MY_UNICODE_STRING, * PMY_UNICODE_STRING;typedef struct _MY_SYSTEM_PROCESS_INFORMATION {ULONG NextEntryOffset; // 指向下一个结构体的指针ULONG ThreadCount; // 本进程的总线程数ULONG Reserved1[6]; // 保留LARGE_INTEGER CreateTime; // 进程的创建时间LARGE_INTEGER UserTime; // 在用户层的使用时间LARGE_INTEGER KernelTime; // 在内核层的使用时间MY_UNICODE_STRING ImageName; // 进程名KPRIORITY BasePriority; // ULONG ProcessId; // 进程IDULONG InheritedFromProcessId;ULONG HandleCount; // 进程的句柄总数ULONG Reserved2[2]; // 保留VM_COUNTERS VmCounters;IO_COUNTERS IoCounters;SYSTEM_THREAD_INFORMATION Threads[5]; // 子线程信息数组 }MY_SYSTEM_PROCESS_INFORMATION, * PMY_SYSTEM_PROCESS_INFORMATION;// 定义一个指针函数类型 typedef NTSTATUS(WINAPI* __NtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength);// 定义一个存放原函数的指针 PVOID fpNtQuerySystemInformation NULL; // 读写锁 std::shared_mutex ppNameListMutex; // 受保护进程名列表 std::vectorstd::wstring ppNameList;// 声明函数 extern C {__declspec(dllexport)void StartHookingFunction();__declspec(dllexport) void UnmappHookedFunction();__declspec(dllexport) bool SetProtectedProcessListFromBuffer(const wchar_t* buffer, size_t length); }NTSTATUS WINAPI HookedNtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength );void OpenDebugConsole() {AllocConsole();FILE* fDummy;freopen_s(fDummy, CONOUT$, w, stdout);freopen_s(fDummy, CONOUT$, w, stderr);freopen_s(fDummy, CONIN$, r, stdin);std::wcout LDebug console opened.\n; }BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) {// 禁用 DLL 模块的通知DisableThreadLibraryCalls(hModule);switch (ul_reason_for_call){case DLL_PROCESS_ATTACH:{OpenDebugConsole(); // 打开控制台进行调试std::wcout LDLL injected, setting up hooks.\n;// 设置受保护进程列表此函数也可以从远程进程注入线程来调用const WCHAR ppName[] Lcmd.exe;conhost.exe;if (SetProtectedProcessListFromBuffer(ppName, wcslen(ppName) 1)){std::wcout LProtected process list set successfully.\n;}else{std::wcout LFailed to set protected process list.\n;}// 启用 HOOKStartHookingFunction();std::wcout LHooking started.\n;}break;case DLL_THREAD_ATTACH:case DLL_THREAD_DETACH:break;case DLL_PROCESS_DETACH:UnmappHookedFunction();std::wcout LHooking detached.\n;break;}return TRUE; }extern C __declspec(dllexport) void StartHookingFunction() {//开始事务DetourTransactionBegin();//更新线程信息 DetourUpdateThread(GetCurrentThread());fpNtQuerySystemInformation DetourFindFunction(ntdll.dll,NtQuerySystemInformation);//将拦截的函数附加到原函数的地址上,这里可以拦截多个函数。DetourAttach((PVOID)fpNtQuerySystemInformation,HookedNtQuerySystemInformation);//结束事务DetourTransactionCommit(); }extern C __declspec(dllexport) void UnmappHookedFunction() {//开始事务DetourTransactionBegin();//更新线程信息 DetourUpdateThread(GetCurrentThread());//将拦截的函数从原函数的地址上解除这里可以解除多个函数。DetourDetach((PVOID)fpNtQuerySystemInformation,HookedNtQuerySystemInformation);//结束事务DetourTransactionCommit(); }// 从缓冲区解析多个进程名的函数 extern C __declspec(dllexport) bool SetProtectedProcessListFromBuffer(const wchar_t* buffer, size_t length) {if (buffer nullptr || length 0) {return false; // 返回错误状态}std::unique_lock lock(ppNameListMutex); // 写锁ppNameList.clear(); // 清空原列表std::wstring tempName;for (size_t i 0; i length; i) {if (buffer[i] L; || i length - 1) {// 遇到分号或者到达缓冲区末尾表示一个进程名结束if (i length - 1 buffer[i] ! L; buffer[i] ! L\0) {tempName buffer[i]; // 处理最后一个字符不是分号的情况}if (!tempName.empty()) {std::wcout LParsed process name: tempName L\n; // 输出调试信息std::wcout LLength: tempName.size() L\n;ppNameList.push_back(tempName); // 将进程名存入列表tempName.clear(); // 清空临时字符串以解析下一个进程名}}else {// 继续读取进程名字符tempName buffer[i];}}std::wcout LTotal protected processes: ppNameList.size() L\n; // 输出调试信息return !ppNameList.empty(); // 返回成功标志如果解析后列表为空则返回false }// 检查进程是否在受保护列表中的函数带读锁 static bool IsProcessProtected(const std::wstring processName) {std::vectorstd::wstring localPpNameList;{std::shared_lock lock(ppNameListMutex);localPpNameList ppNameList; // 将受保护列表复制到局部变量}// 在局部变量中进行比较return std::find(localPpNameList.begin(), localPpNameList.end(), processName) ! localPpNameList.end(); }static bool IsHandleValidate(const LPVOID lpAddress) {MEMORY_BASIC_INFORMATION Buffer{};VirtualQuery(lpAddress, Buffer, 0x30u);//std::wcout LHandleValidate Buffer.Protect: Buffer.Protect L\n;return Buffer.State MEM_COMMIT Buffer.Protect ! PAGE_NOACCESS; }static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {DWORD processId;GetWindowThreadProcessId(hwnd, processId);// 检查窗口是否属于当前进程if (processId GetCurrentProcessId()) {// 检索指向窗口句柄向量的指针std::vectorHWND* pWindowHandles reinterpret_caststd::vectorHWND*(lParam);// 检查指针是否有效if (pWindowHandles IsHandleValidate(pWindowHandles)) {pWindowHandles-push_back(hwnd);}else {// 可选记录错误或处理无效指针情况std::cerr Invalid pointer passed to EnumWindowsProc. std::endl;}}return TRUE; // 继续枚举 }static void FlushProcessWindows() {std::vectorHWND windowHandles;// 枚举所有顶级窗口通过lParam将指针传递给EnumWindowsProcEnumWindows(EnumWindowsProc, reinterpret_castLPARAM(windowHandles));// 向每一个窗口发送 F5 来刷新窗口for (HWND hwnd : windowHandles) {// 模拟 F5PostMessage(hwnd, WM_KEYDOWN, VK_F5, 0);Sleep(10);PostMessage(hwnd, WM_KEYUP, VK_F5, 0);} }// NtQuerySystemInformation的Hook函数用于隐藏受保护的进程 NTSTATUS WINAPI HookedNtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation,ULONG SystemInformationLength,PULONG ReturnLength ) {//std::wcout LNtQuerySystemInformation hook called.\n;static bool isNotFirstHook;const size_t nodeSize sizeof(MY_SYSTEM_PROCESS_INFORMATION);// 先调用原始的 NtQuerySystemInformationNTSTATUS status ((__NtQuerySystemInformation)fpNtQuerySystemInformation)(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength);//std::wcout LOriginal NtQuerySystemInformation returned: status L\n;// 只处理 SystemProcessInformation 类型的信息if (SystemInformationClass SystemProcessInformation NT_SUCCESS(status)) {//std::wcout LProcessing SystemProcessInformation.\n;PMY_SYSTEM_PROCESS_INFORMATION pCurrentNode (PMY_SYSTEM_PROCESS_INFORMATION)SystemInformation;PMY_SYSTEM_PROCESS_INFORMATION pPreviousNode nullptr;bool isFirstNode true;while (pCurrentNode ! nullptr IsHandleValidate(pCurrentNode)) {if (pCurrentNode-NextEntryOffset 0) { // 到达末尾break;}if (pCurrentNode-ImageName.Buffer nullptr || pCurrentNode-ImageName.Length 0) {// 跳过无效的进程名//std::wcout LSkipping invalid process name.\n;pCurrentNode (PMY_SYSTEM_PROCESS_INFORMATION)((PUCHAR)pCurrentNode pCurrentNode-NextEntryOffset);continue;}// 获取当前进程名std::wstring processName(pCurrentNode-ImageName.Buffer, pCurrentNode-ImageName.Length / sizeof(WCHAR));//std::wcout LProcessing process: processName L\n;// 检查该进程名是否在受保护列表中if (IsProcessProtected(processName)) {std::wcout LProcess is protected: processName L\n;// 如果在受保护列表中则将该进程从链表中移除if (pPreviousNode) {pPreviousNode-NextEntryOffset pCurrentNode-NextEntryOffset;std::wcout LProcess removed from list: processName L\n;}else if (isFirstNode) { // 第一个节点是受保护进程// 替换为下一个节点的数据if (pCurrentNode-NextEntryOffset 0) {// 如果没有下一个节点表示列表中只有一个受保护// 将进程信息列表清空memset(pCurrentNode, 0, SystemInformationLength);std::wcout LOnly one protected process, clearing list.\n;break;}else {PMY_SYSTEM_PROCESS_INFORMATION pNextNode (PMY_SYSTEM_PROCESS_INFORMATION)((PUCHAR)pCurrentNode pCurrentNode-NextEntryOffset);if(!IsHandleValidate(pNextNode)) {std::wcout LHandleValidate failed.\n;break;}// 将下一个节点的数据拷贝到当前节点memcpy(pCurrentNode, pNextNode, sizeof(MY_SYSTEM_PROCESS_INFORMATION));pCurrentNode-NextEntryOffset pNextNode-NextEntryOffset;std::wcout LFirst process was protected, replaced with next process.\n;continue; // 保持 pPreviousNode 不变重新检查当前节点}}}else {// 如果没有被保护移动到下一个节点pPreviousNode pCurrentNode;}// 如果下一个节点超出缓冲区范围停止处理if (((PUCHAR)pCurrentNode pCurrentNode-NextEntryOffset nodeSize) (PUCHAR)SystemInformation SystemInformationLength) {std::wcout LReached end of buffer.\n;break;}// 继续下一个进程信息节点pCurrentNode (PMY_SYSTEM_PROCESS_INFORMATION)((PUCHAR)pCurrentNode pCurrentNode-NextEntryOffset);}}// 只在第一次调用 hook 函数后强制刷新窗口if (!isNotFirstHook) {isNotFirstHook true;FlushProcessWindows();}return status; } 可以删除 dllmain 里面的hook 函数以及所有输出字符串。从外部进程通过注入远程线程的方式来实现动态调整隐身策略。主要利用下面三个函数 导出函数 执行效果 隐身效果调试输出模式 本文出处链接[https://blog.csdn.net/qq_59075481/article/details/142676712]。 本文发布于2024.10.02。
http://www.dnsts.com.cn/news/76867.html

相关文章:

  • 网站后台管理系统源码下载公司执照注册流程及费用
  • 福山区建设工程质量检测站网站烟台网站关键词推广
  • PHP网站开发简单实例效果图制作公司赚钱吗
  • 云南微网站开发网站诊断书
  • 深圳网站建设设计首选公司网站制作是不是要一个后台
  • 郑州网站seo个人网页主页
  • 乡村门户网站建设怎么做新网站的推广
  • 网站登录验证码不正确深圳seo爱好者
  • 为了加强公司网站建设中国外贸网站排名
  • 港海(天津)建设股份有限公司网站做pc端网站平台
  • 做自己的游戏网站餐饮营销方案
  • 承接app网站开发的广告wordpress 面向对象
  • 3d网页游戏排行seo最好的网站源码
  • 建筑八大员证报考网站wordpress 顶部白条
  • 一个网站绑定多个域名哪些网站用织梦默认模板
  • 哈尔滨建设银行网站首页网站维护入门教程
  • 机关网站模板承德市住房和城乡建设局官网
  • 兰州北京网站建设九江 网站建设公司
  • 官方网站开发需要几个技术人员会议网站
  • 题库网站建设的绩效指标汕头市住监局官网
  • 桐城市美丽乡村建设专题网站网站建设开题报告书
  • 公司想建个网站怎么弄wordpress管理面板忘记密码
  • 绍兴手机网站建设网站开发的论文
  • 5000做网站网站定制开发 广州
  • 响应式网站是做多大尺寸wordpress 仪表盘美化
  • wordpress网站邀请码自己制作的网站如何发布
  • 都江堰市网站建设招标信息网哪个比较好
  • 网站标题分隔符原阳网站建设
  • 备案号怎么添加到网站太原网站建设价格
  • 一流的低价网站建设网页游戏大厅在线玩