好友
阅读权限20
听众
最后登录1970-1-1
|
liwj
发表于 2023-10-12 03:46
// ConsoleApplication_GetBaseAddress.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<stdio.h>
#include<windows.h>
#include<psapi.h>
#include<direct.h>
#include <string.h>
int _tmain(int argc, _TCHAR* argv[])
{
//获取当前目录
char path[100];
getcwd(path, 100);
//printf("current work path:%s\n", path);
char *zifu = getcwd(path, 100);
//printf("current work path:%s\n", zifu);
char *zifu2 = "\\MindMaster.exe";//修改该值即可
char *zifu3 = strcat(zifu, zifu2);
printf("启动MindMaster:%s\n", zifu3);
//运行外部的程序
WinExec(zifu3, SW_SHOW);
//延时
int a;
a = 15000;
Sleep(a);
//获取窗口句柄
HWND hWnd = FindWindow(NULL, "MindMaster");
if (hWnd == NULL){ //如果无法获取句柄则报错
printf("无法获取窗口句柄,请检查进程是否存在!\n");
system("pause");
return -1;
}
DWORD pro_id;
GetWindowThreadProcessId(hWnd, &pro_id); //获取进程ID
if (pro_id == 0){
printf("无法获取进程ID\n");
system("pause");
return 0;
}
printf("进程id: %d\n", pro_id);
HANDLE hpro = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pro_id);
if (hpro == 0){
printf("无法获取进程句柄");
}
printf("进程句柄id: %d\n", hpro);
// 获取每一个模块加载基址
DWORD pro_base = NULL;
DWORD prodll_base = NULL;
HMODULE hModule[100] = { 0 };
DWORD dwRet = 0;
int num = 0;
int bRet = EnumProcessModulesEx(hpro, (HMODULE *)(hModule), sizeof(hModule), &dwRet, NULL);
if (bRet == 0){
printf("EnumProcessModules");
}
// 总模块个数
num = dwRet / sizeof(HMODULE);
printf("总模块个数: %d\n", num);
// 打印每一个模块加载基址
char lpBaseName[100];
for (int i = 0; i < num; i++){
GetModuleBaseNameA(hpro, hModule[i], lpBaseName, sizeof(lpBaseName));
printf("%-2d %-25s基址: 0x%p\n", i, lpBaseName, hModule[i]);
}
pro_base = (DWORD)hModule[0]; prodll_base = (DWORD)hModule[49];
printf("程序基址: 0x%p\n", pro_base); printf("objectmodule基址: 0x%p\n", prodll_base);
/////////////////////////////////////////////////////////////////////////////
DWORD tounaofenbao = pro_base + 0x78eb95;
printf("头脑风暴基地址: 0x%p\n", tounaofenbao);
//ReadProcessMemory(hpro, (PVOID)tounaofenbao, &tounaofenbao, 4, 0); 为什么注释掉,因为把eb95的值7C 79 FA 83 转换成了地址
//tounaofenbao = tounaofenbao + 0x0;
DWORD Tnfb_value = 2088368771;//OD显示的二进制顺序是 83 FA 79 7C 在换算的时候要倒着念 7C 79 FA 83 把7C 79 FA 83换成十进制就得到2088368771
WriteProcessMemory(hpro, (LPVOID)tounaofenbao, &Tnfb_value, 4, 0);//是修改成功了 但程序确自动退出了 找到原因了 加上7C后就正确了 保持4个字节
//甘特图
DWORD gantetu = pro_base + 0x6122E1;
printf("甘特图基地址: 0x%p\n", gantetu);
//DWORD GTU_value = 2425393296;
char GTU_value[6] = {0x90,0x90,0x90,0x90,0x90,0x90};
WriteProcessMemory(hpro, (LPVOID)gantetu, GTU_value, 6, 0);
DWORD gantetu2 = pro_base + 0x6122E9;
printf("甘特图基地址: 0x%p\n", gantetu2);
char GTU_value2[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
WriteProcessMemory(hpro, (LPVOID)gantetu2, GTU_value2, 6, 0);
//主题风格
DWORD zhutifengge = pro_base + 0x68C118;
printf("主题风格基地址: 0x%p\n", zhutifengge);
char zhutifengge_value[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
WriteProcessMemory(hpro, (LPVOID)zhutifengge, zhutifengge_value, sizeof(zhutifengge_value), 0);
DWORD zhutifengge2 = pro_base + 0x68C122;
printf("主题风格基地址2: 0x%p\n", zhutifengge2);
char zhutifengge_value2[6] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
WriteProcessMemory(hpro, (LPVOID)zhutifengge2, zhutifengge_value2, sizeof(zhutifengge_value2), 0);
//复制图片功能
DWORD tup = prodll_base + 0x127B60;
printf("复制图片功能基地址: 0x%p\n", tup);
char tup_value[2] = { 0xeb, 0x3b};
WriteProcessMemory(hpro, (LPVOID)tup, tup_value, sizeof(tup_value), 0);
//图标功能
DWORD tub = pro_base + 0x706206;
printf("图标功能基地址: 0x%p\n", tub);
char tub_value[2] = { 0x90, 0x90 };
WriteProcessMemory(hpro, (LPVOID)tub, tub_value, sizeof(tub_value), 0);
DWORD tub2 = pro_base + 0x70620C;
printf("图标功能基地址: 0x%p\n", tub2);
char tub2_value[2] = { 0xeb, 0x22 };
WriteProcessMemory(hpro, (LPVOID)tub2, tub2_value, sizeof(tub2_value), 0);
return 0;
}
|
免费评分
-
查看全部评分
|