#include <Windows.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include "HackProcess.h"
#include <vector>
#include <algorithm> CHackProcess fProcess;
using namespace std; #define F6_Key 0x75 #define RIGHT_MOUSE 0x02 int NumOfPlayers = 32; const DWORD dw_PlayerCountOffs = 0x7994E0;//Engine.dll //自己人物模块偏移
const DWORD Player_Base = 0x4C5B3B4;//client_panorama.dll //阵营
const DWORD dw_mTeamOffset = 0xE8;//client_panorama.dll
//血量
const DWORD dw_Health = 0xF4;//client_panorama.dll //人物坐标偏移
const DWORD dw_Pos = 0x12C;//client_panorama.dll //敌人地址
const DWORD EntityPlayer_Base = 0x4c5b3bc;//client_panorama.dll //敌人结构偏移
const DWORD EntityLoopDistance = 0x8; //鼠标指针
const DWORD dw_m_angRotation = 0x461A9C;
RECT m_Rect; HDC HDC_Desktop; HBRUSH EnemyBrush;
HFONT Font; //矩阵地址
const DWORD dw_vMatrix = 0x4C2CD04 + 0xb0;
const DWORD dw_antiFlick = 0x58C2B8; HWND TargetWnd;
HWND Handle;
DWORD DwProcId; COLORREF SnapLineCOLOR;
COLORREF TextCOLOR; typedef struct
{
float flMatrix [4][4];
}WorldToScreenMatrix_t; float Get3dDistance(float * myCoords, float * enemyCoords)
{
return sqrt(
pow(double(enemyCoords[0] - myCoords[0]), 2.0) +
pow(double(enemyCoords[1] - myCoords[1]), 2.0) +
pow(double(enemyCoords[2] - myCoords[2]), 2.0)); } void SetupDrawing(HDC hDesktop, HWND handle)
{
HDC_Desktop =hDesktop;
Handle = handle;
EnemyBrush = CreateSolidBrush(RGB(255, 0, 0));
//Color
SnapLineCOLOR = RGB(0, 0, 255);
TextCOLOR = RGB(0, 255, 0);
}
struct MyPlayer_t
{
DWORD CLocalPlayer;
int Team;
int Health;
WorldToScreenMatrix_t WorldToScreenMatrix;
float Position[3];
int flickerCheck;
void ReadInformation()
{
// 读自己地址
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &CLocalPlayer, sizeof(DWORD), 0);
// 读阵营
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_mTeamOffset), &Team, sizeof(int), 0);
// 读血量
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_Health), &Health, sizeof(int), 0);
// 读坐标
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + dw_Pos), &Position, sizeof(float[3]), 0); //读房间人数
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_PlayerCountOffs), &NumOfPlayers, sizeof(int), 0); //anti flicker
//ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + dw_antiFlick), &flickerCheck, sizeof(int), 0);
//VMATRIX
//if(flickerCheck == 0)
//{ //读矩阵
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_vMatrix), &WorldToScreenMatrix, sizeof(WorldToScreenMatrix), 0);
//}
//-1A4 = ANTI FLICKER
//Engine.dll+0x58C45C
}
}MyPlayer; //ENemy struct
struct PlayerList_t
{
DWORD CBaseEntity;
int Team;
int Health;
float Position[3];
float AimbotAngle[3];
char Name[39]; void ReadInformation(int Player)
{
// 读敌人地址
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + EntityPlayer_Base + (Player * EntityLoopDistance)),&CBaseEntity, sizeof(DWORD), 0);
// 读阵营
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_mTeamOffset), &Team, sizeof(int), 0);
// 读血量
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Health), &Health, sizeof(int), 0);
// 读坐标
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + dw_Pos), &Position, sizeof(float[3]), 0);
}
}PlayerList[32]; bool WorldToScreen(float * from, float * to)
{
float w = 0.0f; to[0] = MyPlayer.WorldToScreenMatrix.flMatrix[0][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[0][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[0][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[0][3];
to[1] = MyPlayer.WorldToScreenMatrix.flMatrix[1][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[1][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[1][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[1][3];
w = MyPlayer.WorldToScreenMatrix.flMatrix[3][0] * from[0] + MyPlayer.WorldToScreenMatrix.flMatrix[3][1] * from[1] + MyPlayer.WorldToScreenMatrix.flMatrix[3][2] * from[2] + MyPlayer.WorldToScreenMatrix.flMatrix[3][3]; if(w < 0.01f)
return false; float invw = 1.0f / w;
to[0] *= invw;
to[1] *= invw; int width = (int)(m_Rect.right - m_Rect.left);
int height = (int)(m_Rect.bottom - m_Rect.top); float x = width/2;
float y = height/2; x += 0.5 * to[0] * width + 0.5;
y -= 0.5 * to[1] * height + 0.5; to[0] = x+ m_Rect.left;
to[1] = y+ m_Rect.top ; return true;
} void DrawFilledRect(int x, int y, int w, int h)
{ RECT rect = { x, y, x + w, y + h }; FillRect(HDC_Desktop, &rect, EnemyBrush);
} void DrawBorderBox(int x, int y, int w, int h, int thickness)
{
//Top horiz line
DrawFilledRect(x, y, w, thickness);
//Left vertical line
DrawFilledRect( x, y, thickness, h);
//right vertical line
DrawFilledRect((x + w), y, thickness, h);
//bottom horiz line
DrawFilledRect(x, y + h, w+thickness, thickness);
} void DrawLine(float StartX, float StartY, float EndX, float EndY, COLORREF Pen)
{
int a,b=0;
HPEN hOPen;
HPEN hNPen = CreatePen(PS_SOLID, 2, Pen);
hOPen = (HPEN)SelectObject(HDC_Desktop, hNPen);
MoveToEx(HDC_Desktop, StartX, StartY, NULL);
a = LineTo(HDC_Desktop, EndX, EndY);
DeleteObject(SelectObject(HDC_Desktop, hOPen));
} void DrawString(int x, int y, COLORREF color, const char* text)
{
SetTextAlign(HDC_Desktop,TA_CENTER|TA_NOUPDATECP); SetBkColor(HDC_Desktop,RGB(0,0,0));
SetBkMode(HDC_Desktop,TRANSPARENT); SetTextColor(HDC_Desktop,color); SelectObject(HDC_Desktop,Font); TextOutA(HDC_Desktop,x,y,text,strlen(text)); DeleteObject(Font);
} void DrawESP(int x, int y, float distance)
{
int width = 18100/distance;
int height = 36000/distance;
DrawBorderBox(x-(width/2), y-height, width, height, 1); DrawLine((m_Rect.right - m_Rect.left)/2,
m_Rect.bottom - m_Rect.top, x, y,
SnapLineCOLOR); std::stringstream ss;
ss << (int)distance; char * distanceInfo = new char[ss.str().size()+1];
strcpy(distanceInfo, ss.str().c_str()); DrawString(x, y, TextCOLOR, distanceInfo); delete [] distanceInfo;
} void ESP()
{
GetWindowRect(FindWindow(NULL, "Counter-Strike: Global Offensive"), &m_Rect); for(int i = 0; i < NumOfPlayers; i ++)
{
PlayerList[i].ReadInformation(i); if(PlayerList[i].Health < 2)
continue; if(PlayerList[i].Team == MyPlayer.Team)
continue; float EnemyXY[3];
if(WorldToScreen(PlayerList[i].Position, EnemyXY))
{
DrawESP(EnemyXY[0] - m_Rect.left, EnemyXY[1] - m_Rect.top, Get3dDistance(MyPlayer.Position, PlayerList[i].Position));
} } } int main()
{
fProcess.RunProcess(); ShowWindow(FindWindowA("ConsoleWindowClass", NULL), false);
TargetWnd = FindWindow(0, "Counter-Strike: Global Offensive");
HDC HDC_Desktop = GetDC(TargetWnd);
SetupDrawing(HDC_Desktop, TargetWnd); for(;;)
{
MyPlayer.ReadInformation(); ESP(); } return 0;
}

main.cpp

#pragma once

#include <Windows.h>
#include <TlHelp32.h> //THIS FILE SIMPLY DOES MOST OF THE BACKEND WORK FOR US,
//FROM FINDING THE PROCESS TO SETTING UP CORRECT ACCESS FOR US
//TO EDIT MEMORY
//IN MOST GAMES, A SIMPLER VERSION OF THIS CAN BE USED, or if you're injecting then its often not necessary
//This file has been online for quite a while so credits should be shared but im using this from NubTIK
//So Credits to him and thanks class CHackProcess
{
public: PROCESSENTRY32 __gameProcess;
HANDLE __HandleProcess;
HWND __HWNDCss;
DWORD __dwordClient;
DWORD __dwordEngine;
DWORD __dwordOverlay;
DWORD __dwordVGui;
DWORD __dwordLibCef;
DWORD __dwordSteam;
DWORD FindProcessName(const char *__ProcessName, PROCESSENTRY32 *pEntry)
{
PROCESSENTRY32 __ProcessEntry;
__ProcessEntry.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0; if (!Process32First(hSnapshot, &__ProcessEntry))
{
CloseHandle(hSnapshot);
return 0;
}
do{if (!_strcmpi(__ProcessEntry.szExeFile, __ProcessName))
{
memcpy((void *)pEntry, (void *)&__ProcessEntry, sizeof(PROCESSENTRY32));
CloseHandle(hSnapshot);
return __ProcessEntry.th32ProcessID;
}} while (Process32Next(hSnapshot, &__ProcessEntry));
CloseHandle(hSnapshot);
return 0;
} DWORD getThreadByProcess(DWORD __DwordProcess)
{
THREADENTRY32 __ThreadEntry;
__ThreadEntry.dwSize = sizeof(THREADENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0; if (!Thread32First(hSnapshot, &__ThreadEntry)) {CloseHandle(hSnapshot); return 0; } do {if (__ThreadEntry.th32OwnerProcessID == __DwordProcess)
{
CloseHandle(hSnapshot);
return __ThreadEntry.th32ThreadID;
}} while (Thread32Next(hSnapshot, &__ThreadEntry));
CloseHandle(hSnapshot);
return 0;
} DWORD GetModuleNamePointer(LPSTR LPSTRModuleName, DWORD __DwordProcessId)
{
MODULEENTRY32 lpModuleEntry = {0};
HANDLE hSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, __DwordProcessId);
if(!hSnapShot)
return NULL;
lpModuleEntry.dwSize = sizeof(lpModuleEntry);
BOOL __RunModule = Module32First( hSnapShot, &lpModuleEntry );
while(__RunModule)
{
if(!strcmp(lpModuleEntry.szModule, LPSTRModuleName ) )
{CloseHandle( hSnapShot );
return (DWORD)lpModuleEntry.modBaseAddr;
}
__RunModule = Module32Next( hSnapShot, &lpModuleEntry );
}
CloseHandle( hSnapShot );
return NULL;
} void runSetDebugPrivs()
{
HANDLE __HandleProcess=GetCurrentProcess(), __HandleToken;
TOKEN_PRIVILEGES priv;
LUID __LUID;
OpenProcessToken(__HandleProcess, TOKEN_ADJUST_PRIVILEGES, &__HandleToken);
LookupPrivilegeValue(0, "seDebugPrivilege", &__LUID);
priv.PrivilegeCount = 1;
priv.Privileges[0].Luid = __LUID;
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(__HandleToken, false, &priv, 0, 0, 0);
CloseHandle(__HandleToken);
CloseHandle(__HandleProcess);
} void RunProcess()
{
//commented lines are for non steam versions of the game
runSetDebugPrivs();
while (!FindProcessName("csgo.exe", &__gameProcess)) Sleep(12);
while (!(getThreadByProcess(__gameProcess.th32ProcessID))) Sleep(12);
__HandleProcess = OpenProcess(PROCESS_ALL_ACCESS, false, __gameProcess.th32ProcessID); while(__dwordClient == 0x0) __dwordClient = GetModuleNamePointer("client_panorama.dll", __gameProcess.th32ProcessID); while(__dwordEngine == 0x0) __dwordEngine = GetModuleNamePointer("engine.dll", __gameProcess.th32ProcessID); //while(__dwordOverlay == 0x0) __dwordOverlay = GetModuleNamePointer("gameoverlayrenderer.dll", __gameProcess.th32ProcessID);
//while(__dwordVGui == 0x0) __dwordVGui = GetModuleNamePointer("vguimatsurface.dll", __gameProcess.th32ProcessID);
//while(__dwordLibCef == 0x0) __dwordLibCef = GetModuleNamePointer("libcef.dll", __gameProcess.th32ProcessID);
// while(__dwordSteam == 0x0) __dwordSteam = GetModuleNamePointer("steam.dll", __gameProcess.th32ProcessID);
__HWNDCss = FindWindow(NULL, "Counter-Strike: Global Offensive");
}
}; extern CHackProcess fProcess;

hackprocess.h

CSGO项目的更多相关文章

  1. 第二次作业——个人项目实战(Sudoku)

    Github:Sudoku 项目相关要求 利用程序随机构造出N个已解答的数独棋盘 . 输入 数独棋盘题目个数N 输出 随机生成N个 不重复 的 已解答完毕的 数独棋盘,并输出到sudoku.txt中, ...

  2. IGXE搬砖项目

    主要的赚钱方式和倒爷其实是差不多的,自动检测igxe平台上价格与buff相差8.5%以上的饰品,按照历史价格进行一定的过滤,防止翻车,然后自动购买. 2019年经历了十几次的改进以对抗同行的脚本,到1 ...

  3. Fis3前端工程化之项目实战

    Fis3项目 项目目录结构: E:. │ .gitignore │ fis-conf.js │ index.html │ package.json │ README.md │ ├─material │ ...

  4. 【原】Android热更新开源项目Tinker源码解析系列之三:so热更新

    本系列将从以下三个方面对Tinker进行源码解析: Android热更新开源项目Tinker源码解析系列之一:Dex热更新 Android热更新开源项目Tinker源码解析系列之二:资源文件热更新 A ...

  5. 最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目

    最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目 最近一个来自重庆的客户找到走起君,客户的业务是做移动互联网支付,是微信支付收单渠道合作伙伴,数据库里存储的是支付流水和交易流水 ...

  6. Hangfire项目实践分享

    Hangfire项目实践分享 目录 Hangfire项目实践分享 目录 什么是Hangfire Hangfire基础 基于队列的任务处理(Fire-and-forget jobs) 延迟任务执行(De ...

  7. Travis CI用来持续集成你的项目

    这里持续集成基于GitHub搭建的博客为项目 工具: zqz@ubuntu:~$ node --version v4.2.6 zqz@ubuntu:~$ git --version git versi ...

  8. 【原】Android热更新开源项目Tinker源码解析系列之一:Dex热更新

    [原]Android热更新开源项目Tinker源码解析系列之一:Dex热更新 Tinker是微信的第一个开源项目,主要用于安卓应用bug的热修复和功能的迭代. Tinker github地址:http ...

  9. 【原】Android热更新开源项目Tinker源码解析系列之二:资源文件热更新

    上一篇文章介绍了Dex文件的热更新流程,本文将会分析Tinker中对资源文件的热更新流程. 同Dex,资源文件的热更新同样包括三个部分:资源补丁生成,资源补丁合成及资源补丁加载. 本系列将从以下三个方 ...

随机推荐

  1. OSPF --- 不规则区域实验

    OSPF不规则区域实验: 一.知识点整理: OSPF中路由器的角色(看图): 骨干路由器:路由器所有接口属于area 0  -->R3 非骨干路由器:路由器所有接口属于非area 0  --&g ...

  2. 红黑树规则,TreeSet原理,HashSet特点,什么是哈希值,HashSet底层原理,Map集合特点,Map集合遍历方法

    ==学习目标== 1.能够了解红黑树 2.能够掌握HashSet集合的特点以及使用(特点以及使用,哈希表数据结构) 3.能够掌握Map集合的特点以及使用(特点,常见方法,Map集合的遍历) 4.能够掌 ...

  3. Gitlab+Jenkins构建一个Go项目

    部署Go项目简介 对于golang的发布,之前一直没有一套规范的发布流程,来看看之前发布流程: 方案一 • 开发者本地环境需要将环境变量文件改为正式环境配置 • 编译成可执行文件 • 发送给运维 • ...

  4. mac 清理磁盘空间

    128G mac真的用的很崩溃,发现系统占用80G ,肯定是有问题的,发现了是缓存的原因,删除后好多了,记录一下. 从管理里进入之后,从文稿中选择"文件浏览器"可以看到每一个文件夹 ...

  5. 解决WebStorme点击谷歌浏览器图标无反应问题

    解决思路: 在设置中重新设置谷歌浏览器路径,一定要选中到谷歌浏览器安装目录的Chrome.exe文件,选中后记得apply. 设置步骤: file->seeting->tools-> ...

  6. 在mac上使用vscode创建第一个C++项目

    https://blog.csdn.net/bujidexinq/article/details/106539523 准备工作:安装好vscode安装插件『C/C++』正式开始:首先是创建一个空的文件 ...

  7. .NET C#中处理Url中文编码问题

    近些日子在做一个用C#访问webservise的程序,由于需要传递中文参数去请求网站,所以碰到了中文编码问题.我们知道像百度这种搜索引擎中,当用户输入中文关键字后,它会把中文转码,以确保在Url中不会 ...

  8. window下运行nginx出现nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)

    做谷粒学院项目,用nginx出现nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a s ...

  9. TurtleBot3使用课程-第一节b(北京智能佳)

    目录 1.模拟运行TurtleBot 2 1.1 ROS安装和设置2 1.1.1 turtlebot3 在Gazebo中模拟 3 1.1.1.1用于Gazebo的ROS包装 3 1.1.1.2 tur ...

  10. JavaScript同步模式,异步模式及宏任务,微任务队列

    首先JavaScript是单线程的语言,也就是说JS执行环境中,负责执行代码的线程只有一个.一次只能执行一个任务,如果有多个任务的话, 就要排队,然后依次执行,优点就是更安全,更简单.缺点就是遇到耗时 ...