利用Golang 做CS:GO自动扳机+GLOW

利用Golang 做CS:GO自动扳机+GLOW

Tags
notes
Published
需要的变量:
localplayer
entitylist
health
team
forceattack
crosshairid //用于 获取瞄准对象的实体id 瞄准玩家获取队伍id
 
循环 检查热键是否按下
设置 buffer变量=读取内存 client.dll + localplayer (read pointer)
 
设置 cross 变量=读取字节 buffer +crosshairid (read bytes,4)到整型//获取自身瞄准
设置 ourteam 变量=读取字节 buffer+team (read bytes,4)到整型//获取自身team
 
//接下来获取瞄准得实体id
enemy 变量= 读取内存 client.dll+entitylist+(cross-1)*0x10 (read pointer)//获取瞄准的实体
//游戏里的每个实体隔10字节 至于减一 个人猜测 cross到整时会进1 所以要减去
enemyteam 变量=读取字节 enemy+team (read bytes,4)到整型//获取瞄准的实体team
enemyhealth 变量=读取字节 enemy+health(read bytes,4)到整型//获取瞄准的实体血量
 
接下来检查我十字线瞄准的实体队伍是否和我的队伍相同 是的话开枪 不是的话 不枪决队友
判断 ourteam 不等于 enemyteam 并且enemyhealth>1 //避免瞄准队友;瞄准死去的敌人
 
写入字节 client.dll+forceattack (write bytes,5) //5代表开火
sleep 1 避免指令冲突
写入字节 client.dll+forceattack (write bytes,4) //4代表停火 以便下次触发
 
{
sleep 1
以上思路 写出来是这样的 下面是成品 谢谢H31RX大佬造的轮子
package main import ( "fmt" "github.com/H3nr1X/ReadWriteMemory" "github.com/jamesmoriarty/gomem" "time" ) const( localplayer = 0xDB75DC entitylist = 0x4DD344C health = 0x100 team = 0xF4 forceattack = 0x32038F4 crosshair = 0x11838 ) func main() { process,err := ReadWriteMemory.ProcessByName("csgo") if err != nil { fmt.Println("你是不是小金鱼 先打开GOGO再打开我") } client:= process.Modules["client.dll"].ModBaseAddr if err != nil { fmt.Println("not find client modules") fmt.Println(err) } for { if !gomem.IsKeyDown(0x12) { //https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes time.Sleep(time.Millisecond * 1) continue } buffer,_ := process.ReadIntPtr(client + localplayer) cross,_ := process.ReadIntPtr(buffer + crosshair) ourteam,_ := process.ReadIntPtr(buffer + team) enemy,_ := process.ReadIntPtr(client + entitylist + (cross - 1)* 0x10) enemyteam,_ := process.ReadIntPtr(enemy + team) enemyhealth,_ := process.ReadIntPtr(enemy + health) if ourteam != enemyteam && enemyhealth > 1 { process.WriteInt(client + forceattack,5) time.Sleep(time.Millisecond * 1) process.WriteInt(client + forceattack,4) fmt.Printf("buffer =%v\n",buffer) fmt.Printf("corss = %v\n",cross) fmt.Printf("ourteam = %v\n",ourteam) fmt.Printf("enemy = %v\n",enemy) fmt.Printf("enmyteam = %v\n",enemyteam) fmt.Printf("enemyhealth = %v\n",enemyhealth) fmt.Println("--------------------------------") start := time.Now() fmt.Println(start.Format(time.RFC850)) } time.Sleep(time.Millisecond * 1) } }

csgo 做glow 思路

写循环得时候延迟1毫秒 不然程序会跑上亿次浪费资源
需要的变量
localplayer //获取本地玩家
entitylist //获取项目实体
glowobjectmanager //实体发光列表
teamnum //队伍编号
glowindex //每个实体拥有的发光索引 修改它获得glow
 
循环 检查热键是否按下
设置buff变量 = 读内存 client.dll+localplayer (read pointer)
设置glowmanager变量 = 读内存 client.dll+glowobjectmanager (read pointer)
//为了glow敌人 我们需要遍历所有的实体 然后确认敌人得实体 并上色
if 循环 i=0;i<64, ++i //进行循环 因为csgo实体一般不会太多 63次循环 获取64实体足够
设置entity变量 = 读内存 client.dll+entitylist + i * 0x10 //csgo每个实体相隔0x10个字节 也就是16
设置if循环 判断获取实体的队伍是否相等自身队伍 如果是 则继续
设置glowin变量 = 读内存 entity+glowindex (read.byte) //glowindexr 是可以发光的对象列表
写内存 glowmanager + (glowin* 0x38)+0x8,1.f //red
0x38是glowindex多人游戏发光时的size 0x8是RGB中红色的存储 RGBA相隔0x4个字节
写内存 glowmanager + (glowin* 0x38)+0xC,0.f //green
写内存 glowmanager + (glowin* 0x38)+0x10,0.f //blue
写内存 glowmanager + (glowin* 0x38)+0x8,14.f //alpha
写内存 glowmanager + (glowin* 0x38)+0x27 //被遮挡时渲染
写内存 glowmanager + (glowin* 0x38)+0x28 //不被遮挡时候渲染
package main import ( "fmt" "github.com/H3nr1X/ReadWriteMemory" "github.com/jamesmoriarty/gomem" "time" ) const( localplayer = 0xDB75DC entitylist = 0x4DD344C team = 0xF4 GlowObjectManager = 0x531C058 GlowIndex = 0x10488 enable = 1.0 disable = 0.0 ) func main() { process,err := ReadWriteMemory.ProcessByName("csgo") if err != nil { fmt.Println("你是不是小金鱼 先打开GOGO再打开我") } client:= process.Modules["client.dll"].ModBaseAddr if err != nil { fmt.Println("not find client modules") fmt.Println(err) } for { if !gomem.IsKeyDown(0x12) { //https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes time.Sleep(time.Millisecond * 1) continue } buffer,_ := process.ReadIntPtr(client + localplayer) ourteam,_ := process.ReadIntPtr(buffer + team) glowmanager,_ := process.ReadIntPtr(client+GlowObjectManager) for i:=0;i<64;i++{ entity,_ := process.ReadIntPtr(client + entitylist + (uintptr(i) * 0x10)) entityteam,_ := process.ReadIntPtr(entity + team) time.Sleep(time.Millisecond * 1) if ourteam != entityteam { glowin,_:= process.ReadIntPtr(entity + GlowIndex) process.WriteFloat(glowmanager + ((glowin * 0x38) + 0x8),enable ) //r process.WriteFloat(glowmanager + ((glowin * 0x38) + 0xC),disable ) //g process.WriteFloat(glowmanager + ((glowin * 0x38) + 0x10),disable ) //b process.WriteFloat(glowmanager + ((glowin * 0x38) + 0x14),enable ) //a process.WriteInt(glowmanager + ((glowin * 0x38) + 0x27),1 )//被遮挡时渲染 process.WriteInt(glowmanager + ((glowin * 0x38) + 0x28),1 )//不被遮挡时候渲染 } } } }