├── .eslintrc.js ├── .gitignore ├── README.md ├── old.json ├── package.json ├── src ├── base.interfaces.ts ├── base.service.ts ├── game │ ├── clientState │ │ └── clientState.service.ts │ ├── entity │ │ ├── entity.interfaces.ts │ │ ├── entity.service.ts │ │ └── weapon.entity.ts │ ├── player │ │ └── player.ts │ └── renderer │ │ └── renderer.service.ts ├── index.ts ├── main.ts ├── math │ └── extendedMath.service.ts ├── network │ └── socket │ │ └── socket.service.ts ├── offsets.ts ├── process │ ├── process.interfaces.ts │ └── process.service.ts └── shared │ └── declerations.ts ├── tsconfig.json ├── tslint.json └── typings └── typings.d.ts /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es6: true, 5 | }, 6 | extends: [ 7 | 'airbnb-base', 8 | ], 9 | globals: { 10 | Atomics: 'readonly', 11 | SharedArrayBuffer: 'readonly', 12 | }, 13 | parser: '@typescript-eslint/parser', 14 | parserOptions: { 15 | ecmaVersion: 2018, 16 | sourceType: 'module', 17 | }, 18 | plugins: [ 19 | '@typescript-eslint', 20 | ], 21 | rules: { 22 | "import/no-unresolved": "off", 23 | "import/prefer-default-export": "off", 24 | "no-unused-vars": "off", 25 | "import/extensions": "off", 26 | "max-len": "off", 27 | "camelcase": "off", 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | package-lock.json 4 | lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # external-csgo-typescript Backend V2 (WINDOWS ONLY!) 2 | #Current Feautures 3 | Triggerbot & View Share to render when also using https://github.com/xsip/WebGL-BSP 4 | ![faces](https://github.com/xsip/WebGL-BSP/blob/master/preview.gif) 5 | -------------------------------------------------------------------------------- /old.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "tsRules": { 7 | "quotemark": [true, "single"], 8 | "object-literal-sort-keys": false 9 | }, 10 | "rules": {}, 11 | "rulesDirectory": [] 12 | } 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "external-go-v2", 3 | "version": "1.0.0", 4 | "description": "external csgo ts base v2 by xsip", 5 | "main": "lib/index.js", 6 | "types": "lib/index.d.ts", 7 | "scripts": { 8 | "prepare": "npm run build", 9 | "build": "tsc", 10 | "demo": "ts-node-dev src/main.ts" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "memoryjs": "github:matteofumagalli1275/memoryjs#node13", 16 | "node-gyp": "^7.1.2", 17 | "ws": "^7.2.1" 18 | }, 19 | "devDependencies": { 20 | "@types/node": "^13.1.4", 21 | "@types/ws": "^6.0.4", 22 | "@typescript-eslint/eslint-plugin": "^2.30.0", 23 | "@typescript-eslint/parser": "^2.30.0", 24 | "eslint": "^6.8.0", 25 | "eslint-config-airbnb-base": "^14.1.0", 26 | "eslint-plugin-import": "^2.20.2", 27 | "http-server": "^0.12.1", 28 | "ts-node": "^8.6.1", 29 | "tslint": "^5.20.1", 30 | "typescript": "^3.9.7" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/base.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Resolver } from '../typings/typings'; 2 | import { ClientStateService } from './game/clientState/clientState.service'; 3 | import { PlayerEntity } from './game/entity/entity.interfaces'; 4 | import { EntityBase } from './game/entity/entity.service'; 5 | import { Player } from './game/player/player'; 6 | import { Netvars, OffsetCollection, Signatures } from './offsets'; 7 | import {Global} from './shared/declerations'; 8 | 9 | export interface HackConfig { 10 | webSocketService?: { 11 | start: boolean; 12 | socketServicePort: number; 13 | }; 14 | offsets?: OffsetCollection; 15 | } 16 | 17 | export interface BaseGameData { 18 | baseIsRunning?: boolean; 19 | clientState: ClientStateService; 20 | entityBase: EntityBase; 21 | localEntity: PlayerEntity; 22 | player: Player; 23 | offsets: OffsetCollection; 24 | sendMessageToEachWsClient: (message: any) => void; 25 | getModuleBase: (modeName: string) => void; 26 | readMemory: typeof Global.rpm; 27 | } 28 | export interface AfterEntityLoopData extends BaseGameData { 29 | 30 | } 31 | export interface GameData extends BaseGameData { 32 | currentEntity: PlayerEntity; 33 | currentEntityIndex: number; 34 | player: Player; 35 | } 36 | 37 | export interface PlayerEntityResolver extends Resolver { 38 | base?: any; 39 | } 40 | export interface MiscEntityResolver extends Resolver { 41 | base?: any; 42 | } 43 | -------------------------------------------------------------------------------- /src/base.service.ts: -------------------------------------------------------------------------------- 1 | import * as rxjs from 'rxjs'; 2 | import {AfterEntityLoopData, BaseGameData, GameData, HackConfig} from './base.interfaces'; 3 | import {ClientStateService} from './game/clientState/clientState.service'; 4 | import {EntityBase} from './game/entity/entity.service'; 5 | import {Player} from './game/player/player'; 6 | import {RendererService} from './game/renderer/renderer.service'; 7 | import {SocketService} from './network/socket/socket.service'; 8 | import {offsets} from './offsets'; 9 | import {ProcessService} from './process/process.service'; 10 | import {Global} from './shared/declerations'; 11 | 12 | export let proc: ProcessService; 13 | 14 | export class BaseService { 15 | private newDataSubject: rxjs.Subject = new rxjs.Subject(); 16 | 17 | private afterEntityLoopSubject: rxjs.Subject = new rxjs.Subject(); 18 | 19 | private socketService: SocketService = new SocketService(); 20 | 21 | private wsStarted: boolean; 22 | 23 | constructor(public config: HackConfig = { 24 | webSocketService: { 25 | start: false, 26 | socketServicePort: 8080, 27 | }, 28 | }) { 29 | console.log('base service init'); 30 | } 31 | 32 | run() { 33 | if (this.wsShouldStart()) { 34 | console.log('starting ws server..'); 35 | this.socketService.startServer(this.doRun.bind(this)); 36 | this.wsStarted = true; 37 | return; 38 | } 39 | this.doRun(); 40 | } 41 | 42 | public onNewData(): rxjs.Subject { 43 | return this.newDataSubject; 44 | } 45 | 46 | public afterEntityLoop(): rxjs.Subject { 47 | return this.afterEntityLoopSubject; 48 | } 49 | 50 | private wsShouldStart = () => (this.config.webSocketService ? this.config.webSocketService.start : false); 51 | 52 | private getBaseReply = (): BaseGameData => ({ 53 | clientState: Global.clientState, 54 | baseIsRunning: true, 55 | entityBase: Global.entityBase, 56 | localEntity: Global.entityBase.entity(Global.clientState.localEntityIndex), 57 | player: Global.player, 58 | sendMessageToEachWsClient: this.socketService.sendToEachClient.bind(this.socketService), 59 | offsets: this.config.offsets, 60 | getModuleBase: (moduleName: string) => Global.gM(moduleName).modBaseAddr, 61 | readMemory: Global.rpm, 62 | }); 63 | 64 | private declareGlobal(processService: ProcessService) { 65 | Global.gM = processService.getModule.bind(proc); 66 | Global.rpm = processService.readMemory.bind(proc); 67 | Global.rbf = processService.readBuffer.bind(proc); 68 | Global.wpm = processService.writeMemory.bind(proc); 69 | 70 | Global.clientState = new ClientStateService(offsets); 71 | Global.entityBase = new EntityBase(offsets); 72 | Global.renderer = new RendererService(offsets); 73 | Global.player = new Player(offsets); 74 | } 75 | 76 | private doRun() { 77 | proc = new ProcessService('csgo.exe'); 78 | this.declareGlobal(proc); 79 | console.log('hack initialized..\nstarting main loop..'); 80 | 81 | const update = () => { 82 | Global.clientState.update(); 83 | Global.entityBase.update(Global.clientState.localEntityIndex); 84 | Global.renderer.readViewMatrix(); 85 | }; 86 | 87 | update(); 88 | const main = rxjs.interval(0); 89 | 90 | main.subscribe(() => { 91 | let loaded = []; 92 | for (let i = 0; i < Global.clientState.maxEntitys; i += 3) { 93 | if (!loaded.includes(i)) { 94 | loaded.push(i); 95 | this.sendNewPlayerDataByIndex(i); 96 | } 97 | if (!loaded.includes(i + 1) && i + 1 < Global.clientState.maxEntitys) { 98 | this.sendNewPlayerDataByIndex(i + 1); 99 | loaded.push(i + 1); 100 | } 101 | if (!loaded.includes(i + 2) && i + 2 < Global.clientState.maxEntitys) { 102 | this.sendNewPlayerDataByIndex(i + 2); 103 | loaded.push(i + 2); 104 | } 105 | 106 | } 107 | 108 | update(); 109 | // on update 110 | this.afterEntityLoopSubject.next({ 111 | ...this.getBaseReply(), 112 | localEntity: Global.entityBase.entity(Global.clientState.localEntityIndex), 113 | player: Global.player, 114 | }); 115 | }); 116 | } 117 | 118 | private sendNewPlayerDataByIndex(i: number) { 119 | Global.entityBase.update(i); 120 | const entity = Global.entityBase.entity(i); 121 | if (entity && entity.lifeState === 0) { 122 | if ((entity.team === 2 || entity.team === 3)) { 123 | this.newDataSubject.next({ 124 | ...this.getBaseReply(), 125 | currentEntity: entity, 126 | localEntity: Global.entityBase.entity(Global.clientState.localEntityIndex), 127 | currentEntityIndex: i, 128 | player: Global.player, 129 | }); 130 | // forEachPlayer(entity, i); 131 | } 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /src/game/clientState/clientState.service.ts: -------------------------------------------------------------------------------- 1 | import { Resolver } from '../../../typings/typings'; 2 | import { Vec3 } from '../../math/extendedMath.service'; 3 | import { MemoryTypesForSignatures, OffsetCollection, Signatures } from '../../offsets'; 4 | import { 5 | Global, 6 | } from '../../shared/declerations'; 7 | 8 | export class ClientStateService { 9 | public set viewAngles(angles: Vec3) { 10 | this.resolver().set.dwClientState_ViewAngles(angles); 11 | } 12 | 13 | public get viewAngles(): Vec3 { 14 | return this.privateViewAngles; 15 | } 16 | 17 | public currentMap: string = ''; 18 | 19 | public maxEntitys: number = 0; 20 | 21 | public localEntityIndex: number; 22 | 23 | 24 | private clientStateBase; 25 | 26 | private resolverResult: Resolver; 27 | 28 | private privateViewAngles = { x: 0, y: 0, z: 0 }; 29 | 30 | 31 | constructor(private offsets: OffsetCollection) { 32 | this.clientStateBase = Global.rpm( 33 | Global.gM('engine.dll').modBaseAddr + this.offsets.signatures.dwClientState, Global.mT.dword); 34 | console.log(this.clientStateBase); 35 | } 36 | 37 | 38 | update() { 39 | const resolver = this.resolver(); 40 | this.privateViewAngles = resolver.dwClientState_ViewAngles(); 41 | this.currentMap = resolver.dwClientState_Map(); 42 | this.maxEntitys = resolver.dwClientState_MaxPlayer(); 43 | this.localEntityIndex = resolver.dwClientState_GetLocalPlayer(); 44 | } 45 | 46 | private resolver(): Resolver { 47 | if (!this.resolverResult) { 48 | this.resolverResult = Global.createResolver( 49 | this.clientStateBase, this.offsets.signatures, MemoryTypesForSignatures, {}); 50 | } 51 | return this.resolverResult; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/game/entity/entity.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Vec3 } from '../../math/extendedMath.service'; 2 | import { MemoryTypes } from '../../process/process.interfaces'; 3 | import {WeaponEntity} from './weapon.entity'; 4 | export interface Entity { 5 | read: (offset: number, type: MemoryTypes) => T; 6 | readBuffer: (offset: number, bytes: number) => Buffer; 7 | } 8 | 9 | export interface PlayerEntity extends Entity { 10 | index?: number; 11 | health: number; 12 | team: number; 13 | origin: Vec3; 14 | vecView: Vec3; 15 | punchAngles: Vec3; 16 | lifeState: number; 17 | weaponEntity?: WeaponEntity; 18 | crosshairId?: number; 19 | crosshairEntity: PlayerEntity | null; 20 | getBonePosition: (bone: number) => Vec3; 21 | } 22 | -------------------------------------------------------------------------------- /src/game/entity/entity.service.ts: -------------------------------------------------------------------------------- 1 | import {MiscEntityResolver, PlayerEntityResolver} from '../../base.interfaces'; 2 | 3 | import {Vec3} from '../../math/extendedMath.service'; 4 | import {MemoryTypesForNetvars, MemoryTypesForSignatures, Netvars, OffsetCollection, Signatures} from '../../offsets'; 5 | import {MemoryTypes} from '../../process/process.interfaces'; 6 | import {Global} from '../../shared/declerations'; 7 | import {PlayerEntity} from './entity.interfaces'; 8 | import {WeaponEntity} from './weapon.entity'; 9 | 10 | export class EntityBase { 11 | private entityListBaseAddress; 12 | 13 | private playerEntityBaseList: { [index: number]: any } = {}; 14 | 15 | private miscEntityBaseList: { [index: number]: any } = {}; 16 | 17 | private entityList: PlayerEntity[] = []; 18 | 19 | constructor(private offsets: OffsetCollection) { 20 | this.entityListBaseAddress = Global.gM('client.dll').modBaseAddr + this.offsets.signatures.dwEntityList; 21 | } 22 | 23 | public entity = (entityIndex: number) => this.entityList[entityIndex]; 24 | 25 | update(entityId: number) { 26 | const p = this.getPlayerResolver(entityId); 27 | this.entityList[entityId] = { 28 | index: entityId, 29 | ...this.entityList[entityId], 30 | health: p.m_iHealth(), 31 | team: p.m_iTeamNum(), 32 | origin: p.m_vecOrigin(), 33 | vecView: p.m_vecViewOffset(), 34 | punchAngles: p.m_aimPunchAngle(), 35 | lifeState: p.m_lifeState(), 36 | getBonePosition: (bone: number) => this.getBonePositionByResolver(p, bone), 37 | read: (offset: number, type: MemoryTypes): T => Global.rpm(p.base + offset, type) as T, 38 | readBuffer: (offset: number, bytes: number): Buffer => Global.rbf(p.base + offset, bytes) as Buffer, 39 | crosshairId: p.m_iCrosshairId(), 40 | crosshairEntity: this.entity(p.m_iCrosshairId() - 1 || -1), 41 | }; 42 | const currentEntity: PlayerEntity = this.entity(entityId); 43 | const currentWeaponEntityForEntity = this.getWeaponEntityResolver(p); 44 | if (!currentEntity.weaponEntity || currentEntity.weaponEntity.base !== currentWeaponEntityForEntity.base) { 45 | currentEntity.weaponEntity = new WeaponEntity(currentWeaponEntityForEntity); 46 | } 47 | } 48 | 49 | getBonePositionByResolver(entity: PlayerEntityResolver, bone: number): Vec3 { 50 | const boneBase = entity.m_dwBoneMatrix(Global.mT.dword); 51 | const boneMatrixBuffer: Buffer = Global.rbf(boneBase + (0x30 * bone), 64); 52 | const boneMatrixList: number[] = []; 53 | for (let i = 0; i < 16; i++) { 54 | boneMatrixList[i] = boneMatrixBuffer.readFloatLE(i * 0x4); 55 | } 56 | return { x: boneMatrixList[3], y: boneMatrixList[7], z: boneMatrixList[11] }; 57 | } 58 | 59 | public getPlayerResolver(entityIndex: number): PlayerEntityResolver { 60 | this.playerEntityBaseList[entityIndex] = this.getBaseOffset(entityIndex); 61 | return this.buildPlayerResolver(entityIndex); 62 | } 63 | 64 | private getMiscResolver(entityIndex: number): MiscEntityResolver { 65 | this.miscEntityBaseList[entityIndex] = this.getBaseOffset(entityIndex); 66 | return this.buildMiscResolver(entityIndex); 67 | } 68 | 69 | private getBaseOffset(entityIndex: number): number { 70 | return Global.rpm(this.entityListBaseAddress + 0x10 * entityIndex, Global.mT.dword); 71 | } 72 | 73 | private buildPlayerResolver(entityIndex: number): PlayerEntityResolver { 74 | const resolver: PlayerEntityResolver = Global.createResolver( 75 | this.playerEntityBaseList[entityIndex], this.offsets.netvars, MemoryTypesForNetvars, {}); 76 | resolver.base = this.playerEntityBaseList[entityIndex]; 77 | return resolver; 78 | } 79 | 80 | private buildMiscResolver(entityIndex: number): MiscEntityResolver { 81 | // eslint-disable-next-line no-undef 82 | const resolver: MiscEntityResolver = Global.createResolver( 83 | this.playerEntityBaseList[entityIndex], 84 | { ...this.offsets.netvars, ...this.offsets.signatures }, 85 | { ...MemoryTypesForNetvars, ...MemoryTypesForSignatures }, {}); 86 | resolver.base = this.miscEntityBaseList[entityIndex]; 87 | return resolver; 88 | } 89 | 90 | 91 | private getWeaponEntityResolver(entityResolver: PlayerEntityResolver): MiscEntityResolver { 92 | let dwWeaponbase = entityResolver.m_hActiveWeapon() - 1; 93 | // eslint-disable-next-line no-bitwise 94 | dwWeaponbase &= 0xFFF; 95 | return this.getMiscResolver(dwWeaponbase); 96 | } 97 | 98 | private getCurrentWeaponId(entityResolver: PlayerEntityResolver) { 99 | return this.getWeaponEntityResolver(entityResolver).m_iItemDefinitionIndex(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/game/entity/weapon.entity.ts: -------------------------------------------------------------------------------- 1 | import {MiscEntityResolver} from '../../base.interfaces'; 2 | import {WeaponIndex} from '../../shared/declerations'; 3 | 4 | export class WeaponEntity { 5 | 6 | set id(id: number) { 7 | console.log(`Weapon Entity ID is not setable! | ${id}`); 8 | } 9 | 10 | get id() { 11 | return this.idResolver(); 12 | } 13 | 14 | set name(name: string) { 15 | console.log(`Weapon Entity name is not setable! | ${name}`); 16 | } 17 | 18 | get name() { 19 | return this.nameResolver(); 20 | } 21 | public base: number; 22 | 23 | constructor(private weaponEntityBase: MiscEntityResolver) { 24 | this.base = weaponEntityBase.base; 25 | } 26 | 27 | idResolver = () => this.weaponEntityBase.m_iItemDefinitionIndex(); 28 | 29 | nameResolver() { 30 | const weaponKeys = this.getWeaponKeys(); 31 | if (WeaponIndex[this.id]) { 32 | const currentKey = Object.keys(WeaponIndex).indexOf(`${this.id}`); 33 | if (currentKey && weaponKeys[currentKey]) { 34 | return weaponKeys[currentKey].replace('WEAPON_', '').replace(/_/g, ' ').toLowerCase(); 35 | } 36 | return 'unknown weapon'; 37 | } 38 | return 'unknown weapon'; 39 | } 40 | 41 | private getWeaponKeys(): string[] { 42 | return Object.keys(WeaponIndex).reduce((arr, key) => { 43 | if (!arr.includes(key)) { 44 | arr.push(WeaponIndex[key]); 45 | } 46 | return arr; 47 | }, []); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/game/player/player.ts: -------------------------------------------------------------------------------- 1 | import {OffsetCollection} from '../../offsets'; 2 | import {MemoryTypes} from '../../process/process.interfaces'; 3 | import {Global} from '../../shared/declerations'; 4 | 5 | export class Player { 6 | 7 | private canDoCollection: Record = {}; 8 | constructor(private offsets: OffsetCollection) { 9 | console.log('player init'); 10 | } 11 | 12 | jump(): void { 13 | this.performAction(this.offsets.signatures.dwForceJump); 14 | } 15 | 16 | attack(): void { 17 | this.performAction(this.offsets.signatures.dwForceAttack); 18 | } 19 | 20 | attack2(): void { 21 | this.performAction(this.offsets.signatures.dwForceAttack2); 22 | } 23 | 24 | 25 | private panoramaBase = () => Global.gM('client.dll').modBaseAddr; 26 | 27 | private performAction(action: number) { 28 | if (!this.canDoCollection[action]) { 29 | this.canDoCollection[action] = true; 30 | } 31 | 32 | if (this.canDoCollection[action]) { 33 | this.canDoCollection[action] = false; 34 | Global.wpm(this.panoramaBase() + action, 5, MemoryTypes.int); 35 | } 36 | 37 | setTimeout(() => { 38 | Global.wpm(this.panoramaBase() + action, 4, MemoryTypes.int); 39 | this.canDoCollection[action] = true; 40 | }, 10); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/game/renderer/renderer.service.ts: -------------------------------------------------------------------------------- 1 | import {OffsetCollection} from '../../offsets'; 2 | import {Global} from '../../shared/declerations'; 3 | 4 | export class RendererService { 5 | 6 | viewMatrix: any[] = []; 7 | 8 | constructor(private offsets: OffsetCollection) { 9 | 10 | } 11 | 12 | readViewMatrix() { 13 | const viewMatOffset = Global.gM('client.dll').modBaseAddr + this.offsets.signatures.dwViewMatrix; 14 | const matBuffer: Buffer = Global.rbf(viewMatOffset, 64); 15 | 16 | for (let i = 0; i < 16; i++) { 17 | this.viewMatrix[i] = matBuffer.readFloatLE(i * 0x4); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { Vec3, Vec2 } from './math/extendedMath.service'; 2 | 3 | export { BaseService } from './base.service'; 4 | export { getOffsets } from './offsets'; 5 | export { MemoryTypes } from './process/process.interfaces'; 6 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import {BaseService} from './base.service'; 2 | import {ExtendedMath, Vec3} from './math/extendedMath.service'; 3 | import {getOffsets} from './offsets'; 4 | import {MemoryTypes} from './process/process.interfaces'; 5 | import {Global} from './shared/declerations'; 6 | 7 | getOffsets().then((offsets) => { 8 | const base: BaseService = new BaseService({ 9 | webSocketService: { 10 | start: false, 11 | socketServicePort: 8080, 12 | }, 13 | offsets, 14 | }); 15 | 16 | base.run(); 17 | 18 | /*let allLocations = []; 19 | let position: any; 20 | let viewAngles: any; 21 | let vecView: any;*/ 22 | 23 | base.afterEntityLoop().subscribe((data) => { 24 | /*if (data.localEntity.crosshairEntity) { 25 | // data.entityBase.update(data.localEntity.crosshairEntity.index); 26 | const headPosLocal = ExtendedMath.addVec( 27 | data.localEntity.origin, data.localEntity.vecView); 28 | const headPosEnemy = data.localEntity.crosshairEntity.getBonePosition(8); 29 | const aimAngles = ExtendedMath.calcAngle(headPosLocal, headPosEnemy); 30 | data.clientState.viewAngles = ExtendedMath.subVec( 31 | aimAngles, ExtendedMath.multiplyVec(data.localEntity.punchAngles, 2.0)); 32 | data.player.attack(); 33 | }*/ 34 | /*if (base.config.webSocketService.start) { 35 | data.sendMessageToEachWsClient( 36 | JSON.stringify({entities: allLocations, local: {position, viewAngles, vecView}})); 37 | } 38 | allLocations = [];*/ 39 | }); 40 | 41 | base.onNewData().subscribe((data) => { 42 | const headPosLocal = ExtendedMath.addVec( 43 | data.localEntity.origin, data.localEntity.vecView); 44 | const headPosEnemy = data.currentEntity.getBonePosition(8); 45 | const aimAngles = ExtendedMath.calcAngle(headPosLocal, headPosEnemy); 46 | const angleDiff = ExtendedMath.subVec(data.clientState.viewAngles, aimAngles); 47 | const fov = 10; 48 | if (((angleDiff.x > 0 && angleDiff.x <= fov) || (angleDiff.x < 0 && angleDiff.x >= fov * -1)) && 49 | ((angleDiff.y > 0 && angleDiff.y <= fov) || (angleDiff.y < 0 && angleDiff.y >= fov * -1))) { 50 | if (data.currentEntity.team !== data.localEntity.team && data.currentEntity.health >= 1) { 51 | data.clientState.viewAngles = ExtendedMath.subVec( 52 | aimAngles, ExtendedMath.multiplyVec(data.localEntity.punchAngles, 2.0)); 53 | data.player.attack(); 54 | } 55 | } else { 56 | } 57 | /*const crosshairId = data.localEntity.read(data.offsets.netvars.m_iCrosshairId, MemoryTypes.int); 58 | allLocations.push(data.currentEntity.origin); 59 | position = data.localEntity.origin; 60 | viewAngles = data.clientState.viewAngles; 61 | vecView = data.localEntity.vecView;*/ 62 | 63 | // console.log(data.localEntity.weaponEntity.name); 64 | // console.log(data.localEntity.weaponEntity.id); 65 | // There are Three ways to get data: 66 | 67 | // 1. Reading a buffer and then getting data from this buffer. 68 | // const healthBuffer = data.localEntity.readBuffer(offsets.netvars.m_iHealth, 4); 69 | // const health = healthBuffer.readIntLE(0, 4); 70 | 71 | // 2. Using quick access for the most basic entity vars. 72 | // const health = data.localEntity.health; 73 | 74 | // 3. Reading a type by offset 75 | // const health = data.localEntity.read(offsets.netvars.m_iHealth,MemoryTypes.int); 76 | // console.log(data.localEntity.health); 77 | 78 | // To get the bone position of a PlayerEntity, you can do one of the following executions 79 | 80 | // 1. To get the bone data for the currentLoop PlayerEntity 81 | // console.log(data.currentEntity.getBonePosition(8)); 82 | // or 2. To get the bone position for a entity by index ( index 10 in this case 83 | 84 | // console.log(data.entityBase.entity(10).getBonePosition(8)); 85 | }); 86 | }).catch((e) => { 87 | console.log('couldnt load offsets...'); 88 | }); 89 | -------------------------------------------------------------------------------- /src/math/extendedMath.service.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-empty */ 2 | export interface Vec3 { 3 | x: number; 4 | y: number; 5 | z: number; 6 | } 7 | 8 | export interface Vec2 { 9 | x: number; 10 | y: number; 11 | } 12 | 13 | export class ExtendedMath { 14 | // new 15 | public static Subtract(src: Vec3, dst: Vec3) { 16 | const diff: Vec3 = {x: 0, y: 0, z: 0}; 17 | diff.x = src.x - dst.x; 18 | diff.y = src.y - dst.y; 19 | diff.z = src.z - dst.z; 20 | return diff; 21 | } 22 | 23 | public static Magnitude(vec: Vec3) { 24 | return Math.sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z); 25 | } 26 | 27 | public static Distance(src: Vec3, dst: Vec3) { 28 | return ExtendedMath.Magnitude(ExtendedMath.Subtract(src, dst)); 29 | } 30 | 31 | public static CalcAngle(src: Vec3, dst: Vec3): Vec3 { 32 | const angles: Vec3 = {x: 0, y: 0, z: 0}; 33 | angles.x = (Math.atan2(dst.x - src.x, dst.y - src.y)) / Math.PI * 180.0; 34 | angles.y = (Math.asin((dst.z - src.z) / ExtendedMath.Distance(src, dst))) * 180.0 / Math.PI; 35 | angles.z = 0.0; 36 | return angles; 37 | /*const angle: Vec3 = {x: 0, y: 0, z: 0}; 38 | angle.x = -Math.atan2(dst.x - src.x, dst.y - src.y) / Math.PI * 180.0 + 180.0; 39 | angle.y = Math.asin((dst.z - src.z) / ExtendedMath.Distance(src, dst)) * 180.0 / Math.PI; 40 | angle.z = 0.0;*/ 41 | 42 | // return {x: angle.y, y: angle.x, z: 0}; 43 | } 44 | 45 | public static subVec(from: Vec3, sub: Vec3): Vec3 { 46 | return { 47 | x: from.x - sub.x, 48 | y: from.y - sub.y, 49 | z: from.z - sub.z, 50 | }; 51 | } 52 | public static multiplyVec(vec: Vec3, multiplyBy: number): Vec3 { 53 | return { 54 | x: vec.x * multiplyBy, 55 | y: vec.y * multiplyBy, 56 | z: vec.z * multiplyBy, 57 | }; 58 | } 59 | public static addVec(from: Vec3, sub: Vec3): Vec3 { 60 | return { 61 | x: from.x + sub.x, 62 | y: from.y + sub.y, 63 | z: from.z + sub.z, 64 | }; 65 | } 66 | public static calcAngle(src: Vec3, dst: Vec3): Vec3 { 67 | const angles: Vec3 = {} as Vec3; 68 | const delta: number[] = [(src.x - dst.x), (src.y - dst.y), (src.z - dst.z)]; 69 | const hyp: number = Math.sqrt(delta[0] * delta[0] + delta[1] * delta[1]); 70 | angles.x = (Math.asin(delta[2] / hyp) * 57.295779513082); 71 | angles.y = (Math.atan(delta[1] / delta[0]) * 57.295779513082); 72 | angles.z = 0.0; 73 | if (delta[0] >= 0.0) { 74 | angles.y += 180.0; 75 | } 76 | 77 | return angles; 78 | } 79 | 80 | public static DEG2RAD(degrees: number) { 81 | return degrees * (Math.PI / 180); 82 | } 83 | 84 | public static dotProduct(a: Vec3, b: Vec3 = {x: 0, y: 0, z: 0}) { 85 | return (a.x * b.x + a.y * b.y + a.z * b.z); 86 | } 87 | 88 | public static getDistance(playerPos: Vec3, entityPos: Vec3): number { 89 | return Math.sqrt(ExtendedMath.dotProduct(ExtendedMath.subVec(entityPos, playerPos))); 90 | } 91 | 92 | public static angleDifference(viewAngles: Vec3, targetAngles: Vec3, dist: number): number { 93 | const pitch: number = viewAngles.x - targetAngles.x; 94 | const yaw: number = viewAngles.y - targetAngles.y; 95 | 96 | return Math.sqrt(Math.pow(pitch, 2.0) + Math.pow(yaw, 2.0)); 97 | } 98 | 99 | public static worldToScreen(from: Vec3, viewMatrix: number[], width: number = 1280, height: number = 720): Vec2 { 100 | let w: number; 101 | const ret: Vec2 = {} as Vec2; 102 | 103 | ret.x = viewMatrix[0] * from.x + viewMatrix[1] * from.y + viewMatrix[2] * from.z + viewMatrix[3]; 104 | ret.y = viewMatrix[4] * from.x + viewMatrix[5] * from.y + viewMatrix[6] * from.z + viewMatrix[7]; 105 | w = viewMatrix[12] * from.x + viewMatrix[13] * from.y + viewMatrix[14] * from.z + viewMatrix[15]; 106 | if (w < 0.01) { 107 | return {x: 0, y: 0}; 108 | } 109 | 110 | const invw: number = 1.0 / w; 111 | 112 | ret.x *= invw; 113 | ret.y *= invw; 114 | 115 | let x: number = width / 2; 116 | let y: number = height / 2; 117 | 118 | x += 0.5 * ret.x * width + 0.5; 119 | y -= 0.5 * ret.y * height + 0.5; 120 | 121 | ret.x = x; 122 | ret.y = y; 123 | return ret; 124 | } 125 | 126 | constructor() { 127 | 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /src/network/socket/socket.service.ts: -------------------------------------------------------------------------------- 1 | import * as _WebSocket from 'ws'; 2 | 3 | 4 | import WebSocket = require('ws'); 5 | 6 | 7 | export class SocketService { 8 | 9 | public connections: WebSocket[] = []; 10 | private wss: WebSocket.Server; 11 | 12 | private isRunning: boolean; 13 | 14 | constructor() {} 15 | 16 | public sendToEachClient(data: any) { 17 | if (this.isRunning) { 18 | this.connections.forEach((connection) => { 19 | connection.send(data); 20 | }); 21 | } else { 22 | throw Error('Please make sure that the Websocket server is running!'); 23 | } 24 | } 25 | 26 | public startServer(afterStarting: () => void, port: number = 8080) { 27 | this.wss = new _WebSocket.Server({ port }); 28 | this.addConnectionListener(afterStarting); 29 | } 30 | 31 | public addConnectionListener = (afterAdding) => { 32 | this.wss.on('connection', (ws) => { 33 | ws.on('message', (message) => { 34 | console.log(`Received message => ${message}`); 35 | try { 36 | this.handleRequest(JSON.parse(`${message}`)); 37 | } catch { 38 | 39 | } 40 | }); 41 | this.connections.push(ws); 42 | 43 | // eslint-disable-next-line no-param-reassign 44 | ws.onclose = () => { 45 | this.onOverlayDisconnect(ws); 46 | }; 47 | }); 48 | this.isRunning = true; 49 | afterAdding(); 50 | } 51 | 52 | private handleRequest = (request: any) => { 53 | console.log(request); 54 | } 55 | 56 | private onOverlayDisconnect(ws: WebSocket) { 57 | this.connections = this.connections.filter((w) => w !== ws) as any; 58 | console.log('Overlay disconnected'); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/offsets.ts: -------------------------------------------------------------------------------- 1 | import * as request from 'request'; 2 | import {MemoryTypes} from './process/process.interfaces'; 3 | 4 | export const getOffsets = async (): Promise => { 5 | 6 | const url = 'https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.json'; 7 | 8 | return new Promise((res, rej) => { 9 | request({ 10 | url, 11 | json: true, 12 | }, (error, response, body) => { 13 | 14 | if (!error && response.statusCode === 200) { 15 | res(body); 16 | } else { 17 | rej(false); 18 | } 19 | }); 20 | }); 21 | }; 22 | export const offsets = { 23 | timestamp: 1603805972, 24 | signatures: { 25 | anim_overlays: 10624, 26 | clientstate_choked_commands: 19760, 27 | clientstate_delta_ticks: 372, 28 | clientstate_last_outgoing_command: 19756, 29 | clientstate_net_channel: 156, 30 | convar_name_hash_table: 192760, 31 | dwClientState: 5824484, 32 | dwClientState_GetLocalPlayer: 384, 33 | dwClientState_IsHLTV: 19784, 34 | dwClientState_Map: 652, 35 | dwClientState_MapDirectory: 392, 36 | dwClientState_MaxPlayer: 904, 37 | dwClientState_PlayerInfo: 21184, 38 | dwClientState_State: 264, 39 | dwClientState_ViewAngles: 19856, 40 | dwEntityList: 81077148, 41 | dwForceAttack: 51919136, 42 | dwForceAttack2: 51919148, 43 | dwForceBackward: 51919064, 44 | dwForceForward: 51919172, 45 | dwForceJump: 85966760, 46 | dwForceLeft: 51919052, 47 | dwForceRight: 51919088, 48 | dwGameDir: 6473720, 49 | dwGameRulesProxy: 86438564, 50 | dwGetAllClasses: 14042020, 51 | dwGlobalVars: 5823720, 52 | dwGlowObjectManager: 86614480, 53 | dwInput: 85604712, 54 | dwInterfaceLinkList: 9458916, 55 | dwLocalPlayer: 13884692, 56 | dwMouseEnable: 13908152, 57 | dwMouseEnablePtr: 13908104, 58 | dwPlayerResource: 51911792, 59 | dwRadarBase: 85487868, 60 | dwSensitivity: 13907796, 61 | dwSensitivityPtr: 13907752, 62 | dwSetClanTag: 565472, 63 | dwViewMatrix: 81018036, 64 | dwWeaponTable: 85607468, 65 | dwWeaponTableIndex: 12892, 66 | dwYawPtr: 13907224, 67 | dwZoomSensitivityRatioPtr: 13928376, 68 | dwbSendPackets: 880218, 69 | dwppDirect3DDevice9: 684112, 70 | find_hud_element: 713235424, 71 | force_update_spectator_glow: 3804674, 72 | interface_engine_cvar: 256492, 73 | is_c4_owner: 3856528, 74 | m_bDormant: 237, 75 | m_flSpawnTime: 41840, 76 | m_pStudioHdr: 10572, 77 | m_pitchClassPtr: 85488544, 78 | m_yawClassPtr: 13907224, 79 | model_ambient_min: 5836892, 80 | set_abs_angles: 1917952, 81 | set_abs_origin: 1917504, 82 | }, 83 | netvars: { 84 | cs_gamerules_data: 0, 85 | m_ArmorValue: 45944, 86 | m_Collision: 800, 87 | m_CollisionGroup: 1140, 88 | m_Local: 12220, 89 | m_MoveType: 604, 90 | m_OriginalOwnerXuidHigh: 12740, 91 | m_OriginalOwnerXuidLow: 12736, 92 | m_SurvivalGameRuleDecisionTypes: 4896, 93 | m_SurvivalRules: 3320, 94 | m_aimPunchAngle: 12332, 95 | m_aimPunchAngleVel: 12344, 96 | m_angEyeAnglesX: 45948, 97 | m_angEyeAnglesY: 45952, 98 | m_bBombPlanted: 2461, 99 | m_bFreezePeriod: 32, 100 | m_bGunGameImmunity: 14660, 101 | m_bHasDefuser: 45960, 102 | m_bHasHelmet: 45932, 103 | m_bInReload: 12965, 104 | m_bIsDefusing: 14640, 105 | m_bIsQueuedMatchmaking: 116, 106 | m_bIsScoped: 14632, 107 | m_bIsValveDS: 117, 108 | m_bSpotted: 2365, 109 | m_bSpottedByMask: 2432, 110 | m_bStartedArming: 13296, 111 | m_bUseCustomAutoExposureMax: 2521, 112 | m_bUseCustomAutoExposureMin: 2520, 113 | m_bUseCustomBloomScale: 2522, 114 | m_clrRender: 112, 115 | m_dwBoneMatrix: 9896, 116 | m_fAccuracyPenalty: 13104, 117 | m_fFlags: 260, 118 | m_flC4Blow: 10640, 119 | m_flCustomAutoExposureMax: 2528, 120 | m_flCustomAutoExposureMin: 2524, 121 | m_flCustomBloomScale: 2532, 122 | m_flDefuseCountDown: 10668, 123 | m_flDefuseLength: 10664, 124 | m_flFallbackWear: 12752, 125 | m_flFlashDuration: 42016, 126 | m_flFlashMaxAlpha: 42012, 127 | m_flLastBoneSetupTime: 10532, 128 | m_flLowerBodyYawTarget: 14992, 129 | m_flNextAttack: 11632, 130 | m_flNextPrimaryAttack: 12856, 131 | m_flSimulationTime: 616, 132 | m_flTimerLength: 10644, 133 | m_hActiveWeapon: 12024, 134 | m_hMyWeapons: 11768, 135 | m_hObserverTarget: 13196, 136 | m_hOwner: 10700, 137 | m_hOwnerEntity: 332, 138 | m_iAccountID: 12232, 139 | m_iClip1: 12900, 140 | m_iCompetitiveRanking: 6788, 141 | m_iCompetitiveWins: 7048, 142 | m_iCrosshairId: 46052, 143 | m_iEntityQuality: 12204, 144 | m_iFOV: 12772, 145 | m_iFOVStart: 12776, 146 | m_iGlowIndex: 42040, 147 | m_iHealth: 256, 148 | m_iItemDefinitionIndex: 12202, 149 | m_iItemIDHigh: 12224, 150 | m_iMostRecentModelBoneCounter: 9872, 151 | m_iObserverMode: 13176, 152 | m_iShotsFired: 41872, 153 | m_iState: 12888, 154 | m_iTeamNum: 244, 155 | m_lifeState: 607, 156 | m_nFallbackPaintKit: 12744, 157 | m_nFallbackSeed: 12748, 158 | m_nFallbackStatTrak: 12756, 159 | m_nForceBone: 9868, 160 | m_nTickBase: 13360, 161 | m_rgflCoordinateFrame: 1092, 162 | m_szCustomName: 12348, 163 | m_szLastPlaceName: 13748, 164 | m_thirdPersonViewAngles: 12760, 165 | m_vecOrigin: 312, 166 | m_vecVelocity: 276, 167 | m_vecViewOffset: 264, 168 | m_viewPunchAngle: 12320, 169 | }, 170 | }; 171 | 172 | export interface Signatures { 173 | anim_overlays: number; 174 | clientstate_choked_commands: number; 175 | clientstate_delta_ticks: number; 176 | clientstate_last_outgoing_command: number; 177 | clientstate_net_channel: number; 178 | convar_name_hash_table: number; 179 | dwClientState: number; 180 | dwClientState_GetLocalPlayer: number; 181 | dwClientState_IsHLTV: number; 182 | dwClientState_Map: number; 183 | dwClientState_MapDirectory: number; 184 | dwClientState_MaxPlayer: number; 185 | dwClientState_PlayerInfo: number; 186 | dwClientState_State: number; 187 | dwClientState_ViewAngles: number; 188 | dwEntityList: number; 189 | dwForceAttack: number; 190 | dwForceAttack2: number; 191 | dwForceBackward: number; 192 | dwForceForward: number; 193 | dwForceJump: number; 194 | dwForceLeft: number; 195 | dwForceRight: number; 196 | dwGameDir: number; 197 | dwGameRulesProxy: number; 198 | dwGetAllClasses: number; 199 | dwGlobalVars: number; 200 | dwGlowObjectManager: number; 201 | dwInput: number; 202 | dwInterfaceLinkList: number; 203 | dwLocalPlayer: number; 204 | dwMouseEnable: number; 205 | dwMouseEnablePtr: number; 206 | dwPlayerResource: number; 207 | dwRadarBase: number; 208 | dwSensitivity: number; 209 | dwSensitivityPtr: number; 210 | dwSetClanTag: number; 211 | dwViewMatrix: number; 212 | dwWeaponTable: number; 213 | dwWeaponTableIndex: number; 214 | dwYawPtr: number; 215 | dwZoomSensitivityRatioPtr: number; 216 | dwbSendPackets: number; 217 | dwppDirect3DDevice9: number; 218 | find_hud_element: number; 219 | force_update_spectator_glow: number; 220 | interface_engine_cvar: number; 221 | is_c4_owner: number; 222 | m_bDormant: number; 223 | m_flSpawnTime: number; 224 | m_pStudioHdr: number; 225 | m_pitchClassPtr: number; 226 | m_yawClassPtr: number; 227 | model_ambient_min: number; 228 | set_abs_angles: number; 229 | set_abs_origin: number; 230 | } 231 | 232 | export interface Netvars { 233 | cs_gamerules_data: number; 234 | m_ArmorValue: number; 235 | m_Collision: number; 236 | m_CollisionGroup: number; 237 | m_Local: number; 238 | m_MoveType: number; 239 | m_OriginalOwnerXuidHigh: number; 240 | m_OriginalOwnerXuidLow: number; 241 | m_SurvivalGameRuleDecisionTypes: number; 242 | m_SurvivalRules: number; 243 | m_aimPunchAngle: number; 244 | m_aimPunchAngleVel: number; 245 | m_angEyeAnglesX: number; 246 | m_angEyeAnglesY: number; 247 | m_bBombPlanted: number; 248 | m_bFreezePeriod: number; 249 | m_bGunGameImmunity: number; 250 | m_bHasDefuser: number; 251 | m_bHasHelmet: number; 252 | m_bInReload: number; 253 | m_bIsDefusing: number; 254 | m_bIsQueuedMatchmaking: number; 255 | m_bIsScoped: number; 256 | m_bIsValveDS: number; 257 | m_bSpotted: number; 258 | m_bSpottedByMask: number; 259 | m_bStartedArming: number; 260 | m_bUseCustomAutoExposureMax: number; 261 | m_bUseCustomAutoExposureMin: number; 262 | m_bUseCustomBloomScale: number; 263 | m_clrRender: number; 264 | m_dwBoneMatrix: number; 265 | m_fAccuracyPenalty: number; 266 | m_fFlags: number; 267 | m_flC4Blow: number; 268 | m_flCustomAutoExposureMax: number; 269 | m_flCustomAutoExposureMin: number; 270 | m_flCustomBloomScale: number; 271 | m_flDefuseCountDown: number; 272 | m_flDefuseLength: number; 273 | m_flFallbackWear: number; 274 | m_flFlashDuration: number; 275 | m_flFlashMaxAlpha: number; 276 | m_flLastBoneSetupTime: number; 277 | m_flLowerBodyYawTarget: number; 278 | m_flNextAttack: number; 279 | m_flNextPrimaryAttack: number; 280 | m_flSimulationTime: number; 281 | m_flTimerLength: number; 282 | m_hActiveWeapon: number; 283 | m_hMyWeapons: number; 284 | m_hObserverTarget: number; 285 | m_hOwner: number; 286 | m_hOwnerEntity: number; 287 | m_iAccountID: number; 288 | m_iClip1: number; 289 | m_iCompetitiveRanking: number; 290 | m_iCompetitiveWins: number; 291 | m_iCrosshairId: number; 292 | m_iEntityQuality: number; 293 | m_iFOV: number; 294 | m_iFOVStart: number; 295 | m_iGlowIndex: number; 296 | m_iHealth: number; 297 | m_iItemDefinitionIndex: number; 298 | m_iItemIDHigh: number; 299 | m_iMostRecentModelBoneCounter: number; 300 | m_iObserverMode: number; 301 | m_iShotsFired: number; 302 | m_iState: number; 303 | m_iTeamNum: number; 304 | m_lifeState: number; 305 | m_nFallbackPaintKit: number; 306 | m_nFallbackSeed: number; 307 | m_nFallbackStatTrak: number; 308 | m_nForceBone: number; 309 | m_nTickBase: number; 310 | m_rgflCoordinateFrame: number; 311 | m_szCustomName: number; 312 | m_szLastPlaceName: number; 313 | m_thirdPersonViewAngles: number; 314 | m_vecOrigin: number; 315 | m_vecVelocity: number; 316 | m_vecViewOffset: number; 317 | m_viewPunchAngle: number; 318 | } 319 | 320 | export const MemoryTypesForNetvars = { 321 | cs_gamerules_data: MemoryTypes.vector3, 322 | m_ArmorValue: MemoryTypes.vector3, 323 | m_Collision: MemoryTypes.vector3, 324 | m_CollisionGroup: MemoryTypes.vector3, 325 | m_Local: MemoryTypes.vector3, 326 | m_MoveType: MemoryTypes.vector3, 327 | m_OriginalOwnerXuidHigh: MemoryTypes.vector3, 328 | m_OriginalOwnerXuidLow: MemoryTypes.vector3, 329 | m_SurvivalGameRuleDecisionTypes: MemoryTypes.vector3, 330 | m_SurvivalRules: MemoryTypes.vector3, 331 | m_aimPunchAngle: MemoryTypes.vector3, 332 | m_aimPunchAngleVel: MemoryTypes.vector3, 333 | m_angEyeAnglesX: MemoryTypes.float, 334 | m_angEyeAnglesY: MemoryTypes.float, 335 | m_bBombPlanted: MemoryTypes.boolean, 336 | m_bFreezePeriod: MemoryTypes.int32, 337 | m_bGunGameImmunity: MemoryTypes.vector3, 338 | m_bHasDefuser: MemoryTypes.boolean, 339 | m_bHasHelmet: MemoryTypes.boolean, 340 | m_bInReload: MemoryTypes.boolean, 341 | m_bIsDefusing: MemoryTypes.boolean, 342 | m_bIsQueuedMatchmaking: MemoryTypes.boolean, 343 | m_bIsScoped: MemoryTypes.boolean, 344 | m_bIsValveDS: MemoryTypes.boolean, 345 | m_bSpotted: MemoryTypes.boolean, 346 | m_bSpottedByMask: MemoryTypes.boolean, 347 | m_bStartedArming: MemoryTypes.boolean, 348 | m_bUseCustomAutoExposureMax: MemoryTypes.boolean, 349 | m_bUseCustomAutoExposureMin: MemoryTypes.boolean, 350 | m_bUseCustomBloomScale: MemoryTypes.boolean, 351 | m_clrRender: MemoryTypes.vector3, 352 | m_dwBoneMatrix: MemoryTypes.dword, 353 | m_fAccuracyPenalty: MemoryTypes.float, 354 | m_fFlags: MemoryTypes.float, 355 | m_flC4Blow: MemoryTypes.float, 356 | m_flCustomAutoExposureMax: MemoryTypes.float, 357 | m_flCustomAutoExposureMin: MemoryTypes.float, 358 | m_flCustomBloomScale: MemoryTypes.float, 359 | m_flDefuseCountDown: MemoryTypes.float, 360 | m_flDefuseLength: MemoryTypes.float, 361 | m_flFallbackWear: MemoryTypes.float, 362 | m_flFlashDuration: MemoryTypes.float, 363 | m_flFlashMaxAlpha: MemoryTypes.float, 364 | m_flLastBoneSetupTime: MemoryTypes.float, 365 | m_flLowerBodyYawTarget: MemoryTypes.float, 366 | m_flNextAttack: MemoryTypes.float, 367 | m_flNextPrimaryAttack: MemoryTypes.float, 368 | m_flSimulationTime: MemoryTypes.float, 369 | m_flTimerLength: MemoryTypes.float, 370 | m_hActiveWeapon: MemoryTypes.dword, 371 | m_hMyWeapons: MemoryTypes.dword, 372 | m_hObserverTarget: MemoryTypes.dword, 373 | m_hOwner: MemoryTypes.dword, 374 | m_hOwnerEntity: MemoryTypes.dword, 375 | m_iAccountID: MemoryTypes.int, 376 | m_iClip1: MemoryTypes.int, 377 | m_iCompetitiveRanking: MemoryTypes.int, 378 | m_iCompetitiveWins: MemoryTypes.int, 379 | m_iCrosshairId: MemoryTypes.int, 380 | m_iEntityQuality: MemoryTypes.int, 381 | m_iFOV: MemoryTypes.int, 382 | m_iFOVStart: MemoryTypes.int, 383 | m_iGlowIndex: MemoryTypes.int, 384 | m_iHealth: MemoryTypes.int, 385 | m_iItemDefinitionIndex: MemoryTypes.int, 386 | m_iItemIDHigh: MemoryTypes.int, 387 | m_iMostRecentModelBoneCounter: MemoryTypes.int, 388 | m_iObserverMode: MemoryTypes.int, 389 | m_iShotsFired: MemoryTypes.int, 390 | m_iState: MemoryTypes.int, 391 | m_iTeamNum: MemoryTypes.int, 392 | m_lifeState: MemoryTypes.int, 393 | m_nFallbackPaintKit: MemoryTypes.vector3, 394 | m_nFallbackSeed: MemoryTypes.vector3, 395 | m_nFallbackStatTrak: MemoryTypes.vector3, 396 | m_nForceBone: MemoryTypes.vector3, 397 | m_nTickBase: MemoryTypes.vector3, 398 | m_rgflCoordinateFrame: MemoryTypes.vector3, 399 | m_szCustomName: MemoryTypes.vector3, 400 | m_szLastPlaceName: MemoryTypes.vector3, 401 | m_thirdPersonViewAngles: MemoryTypes.vector3, 402 | m_vecOrigin: MemoryTypes.vector3, 403 | m_vecVelocity: MemoryTypes.vector3, 404 | m_vecViewOffset: MemoryTypes.vector3, 405 | m_viewPunchAngle: MemoryTypes.vector3, 406 | }; 407 | 408 | export const MemoryTypesForSignatures = { 409 | anim_overlays: MemoryTypes.dword, 410 | clientstate_choked_commands: MemoryTypes.dword, 411 | clientstate_delta_ticks: MemoryTypes.dword, 412 | clientstate_last_outgoing_command: MemoryTypes.dword, 413 | clientstate_net_channel: MemoryTypes.dword, 414 | convar_name_hash_table: MemoryTypes.dword, 415 | dwClientState: MemoryTypes.dword, 416 | dwClientState_GetLocalPlayer: MemoryTypes.int, 417 | dwClientState_IsHLTV: MemoryTypes.boolean, 418 | dwClientState_Map: MemoryTypes.string, 419 | dwClientState_MapDirectory: MemoryTypes.string, 420 | dwClientState_MaxPlayer: MemoryTypes.int, 421 | dwClientState_PlayerInfo: MemoryTypes.dword, 422 | dwClientState_State: MemoryTypes.dword, 423 | dwClientState_ViewAngles: MemoryTypes.vector3, 424 | dwEntityList: MemoryTypes.dword, 425 | dwForceAttack: MemoryTypes.dword, 426 | dwForceAttack2: MemoryTypes.dword, 427 | dwForceBackward: MemoryTypes.dword, 428 | dwForceForward: MemoryTypes.dword, 429 | dwForceJump: MemoryTypes.dword, 430 | dwForceLeft: MemoryTypes.dword, 431 | dwForceRight: MemoryTypes.dword, 432 | dwGameDir: MemoryTypes.dword, 433 | dwGameRulesProxy: MemoryTypes.dword, 434 | dwGetAllClasses: MemoryTypes.dword, 435 | dwGlobalVars: MemoryTypes.dword, 436 | dwGlowObjectManager: MemoryTypes.dword, 437 | dwInput: MemoryTypes.dword, 438 | dwInterfaceLinkList: MemoryTypes.dword, 439 | dwLocalPlayer: MemoryTypes.dword, 440 | dwMouseEnable: MemoryTypes.dword, 441 | dwMouseEnablePtr: MemoryTypes.dword, 442 | dwPlayerResource: MemoryTypes.dword, 443 | dwRadarBase: MemoryTypes.dword, 444 | dwSensitivity: MemoryTypes.dword, 445 | dwSensitivityPtr: MemoryTypes.dword, 446 | dwSetClanTag: MemoryTypes.dword, 447 | dwViewMatrix: MemoryTypes.dword, 448 | dwWeaponTable: MemoryTypes.dword, 449 | dwWeaponTableIndex: MemoryTypes.dword, 450 | dwYawPtr: MemoryTypes.dword, 451 | dwZoomSensitivityRatioPtr: MemoryTypes.dword, 452 | dwbSendPackets: MemoryTypes.dword, 453 | dwppDirect3DDevice9: MemoryTypes.dword, 454 | find_hud_element: MemoryTypes.dword, 455 | force_update_spectator_glow: MemoryTypes.dword, 456 | interface_engine_cvar: MemoryTypes.dword, 457 | is_c4_owner: MemoryTypes.dword, 458 | m_bDormant: MemoryTypes.dword, 459 | m_flSpawnTime: MemoryTypes.dword, 460 | m_pStudioHdr: MemoryTypes.dword, 461 | m_pitchClassPtr: MemoryTypes.dword, 462 | m_yawClassPtr: MemoryTypes.dword, 463 | model_ambient_min: MemoryTypes.dword, 464 | set_abs_angles: MemoryTypes.dword, 465 | set_abs_origin: MemoryTypes.dword, 466 | }; 467 | 468 | export interface OffsetCollection { 469 | timestamp: number; 470 | signatures: Signatures; 471 | netvars: Netvars; 472 | } 473 | -------------------------------------------------------------------------------- /src/process/process.interfaces.ts: -------------------------------------------------------------------------------- 1 | export enum MemoryTypes { 2 | byte = 'byte', 3 | int = 'int', 4 | int32 = 'int32', 5 | uint32 = 'uint32', 6 | int64 = 'int64', 7 | uint64 = 'uint64', 8 | dword = 'dword', 9 | short = 'short', 10 | long = 'long', 11 | float = 'float', 12 | double = 'double', 13 | bool = 'bool', 14 | boolean = 'boolean', 15 | ptr = 'ptr', 16 | pointer = 'pointer', 17 | str = 'str', 18 | string = 'string', 19 | vec3 = 'vec3', 20 | vector3 = 'vector3', 21 | vec4 = 'vec4', 22 | vector4 = 'vector4', 23 | } 24 | -------------------------------------------------------------------------------- /src/process/process.service.ts: -------------------------------------------------------------------------------- 1 | import * as memoryJs from 'memoryJs'; 2 | import { 3 | IModuleListEntry, IModuleObject, IProcessObject, 4 | } from 'memoryJs'; 5 | import {MemoryTypes} from './process.interfaces'; 6 | 7 | export class ProcessService implements IProcessObject { 8 | dwSize: number; 9 | 10 | th32ProcessID: number; 11 | 12 | cntThreads: number; 13 | 14 | th32ParentProcessID: number; 15 | 16 | pcPriClassBase: number; 17 | 18 | szExeFile: string; 19 | 20 | handle: number; 21 | 22 | modBaseAddr: number; 23 | 24 | modules: { [index: string]: IModuleListEntry } = {}; 25 | 26 | constructor(exeName: string) { 27 | this.copyInstanceToClass(memoryJs.openProcess(exeName)); 28 | this.getAllModules(); 29 | } 30 | 31 | getModule(moduleName): IModuleListEntry { 32 | if (!this.modules[moduleName]) { 33 | console.log(moduleName); 34 | this.modules[moduleName] = memoryJs.findModule(moduleName, this.th32ProcessID); 35 | } 36 | return this.modules[moduleName]; 37 | } 38 | 39 | readMemory(addr: any, type: MemoryTypes) { 40 | return memoryJs.readMemory(this.handle, addr, type); 41 | } 42 | 43 | readMatrix(addr: any, type: MemoryTypes) { 44 | return memoryJs.readMemory(this.handle, addr, type); 45 | } 46 | 47 | writeMemory(addr: any, value, type: MemoryTypes, handle?: IModuleListEntry) { 48 | return memoryJs.writeMemory(this.handle, addr, value, type); 49 | } 50 | 51 | readBuffer(addr: any, size: number, handle?: IModuleListEntry) { 52 | return memoryJs.readBuffer(handle ? handle.hModule : this.handle, addr, size); 53 | } 54 | 55 | writeBuffer(addr: any, buffer: number, handle?: IModuleListEntry) { 56 | return memoryJs.writeBuffer(handle ? handle.hModule : this.handle, addr, buffer); 57 | } 58 | 59 | private copyInstanceToClass(inst: IProcessObject) { 60 | for (const key in inst) { 61 | this[key] = inst[key]; 62 | } 63 | } 64 | 65 | private getAllModules(): IModuleObject { 66 | memoryJs.getModules(this.th32ProcessID).map((m) => { 67 | if (m.szModule) { 68 | this.getModule(m.szModule); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/shared/declerations.ts: -------------------------------------------------------------------------------- 1 | import {IModuleListEntry, Resolver} from '../../typings/typings'; 2 | import {ClientStateService} from '../game/clientState/clientState.service'; 3 | import {EntityBase} from '../game/entity/entity.service'; 4 | import {Player} from '../game/player/player'; 5 | import {RendererService} from '../game/renderer/renderer.service'; 6 | import {MemoryTypes} from '../process/process.interfaces'; 7 | import {ProcessService} from '../process/process.service'; 8 | 9 | const notInitializedFunc = () => { 10 | throw Error('Globals not initialized!!'); 11 | }; 12 | 13 | export class Global { 14 | public static gM: (moduleName: string) => IModuleListEntry = notInitializedFunc; 15 | public static rpm: typeof ProcessService.prototype.readMemory = notInitializedFunc; 16 | public static rbf: typeof ProcessService.prototype.readBuffer = notInitializedFunc; 17 | public static wpm: typeof ProcessService.prototype.writeMemory = notInitializedFunc; 18 | public static mT = MemoryTypes; 19 | 20 | public static entityBase: EntityBase; 21 | public static clientState: ClientStateService; 22 | public static renderer: RendererService; 23 | public static player: Player; 24 | 25 | public static createResolver = ( 26 | baseOffset: any, offsetList: T, 27 | typesForSignatures?: { [index: string]: MemoryTypes }, extendBy?: U): Resolver => { 28 | const resolver: Resolver & U = { 29 | base: baseOffset, 30 | ...extendBy || {}, 31 | set: {}, 32 | } as Resolver & U; 33 | for (const k in offsetList as Object) { 34 | if (offsetList[k]) { 35 | resolver[k] = (type?: MemoryTypes) => 36 | Global.rpm(resolver.base + offsetList[k], type || typesForSignatures[k]); 37 | resolver.set[k] = (value: any, type?: MemoryTypes) => { 38 | Global.wpm(resolver.base + offsetList[k], value, type || typesForSignatures[k]); 39 | }; 40 | } else { 41 | resolver[k] = (type?: MemoryTypes) => console.log(`${k} is not a valid offset`); 42 | resolver.set[k] = (value: any, type?: MemoryTypes) => { 43 | console.log(`${k} is not a valid offset`); 44 | }; 45 | } 46 | } 47 | 48 | return resolver; 49 | } 50 | } 51 | 52 | process.title = 'External Cs go!'; 53 | 54 | export enum WeaponIndex { 55 | WEAPON_DEAGLE = 1, 56 | WEAPON_ELITE = 2, 57 | WEAPON_FIVESEVEN = 3, 58 | WEAPON_GLOCK = 4, 59 | WEAPON_AK47 = 7, 60 | WEAPON_AUG = 8, 61 | WEAPON_AWP = 9, 62 | WEAPON_FAMAS = 10, 63 | WEAPON_G3SG1 = 11, 64 | WEAPON_GALILAR = 13, 65 | WEAPON_M249 = 14, 66 | WEAPON_M4A1 = 16, 67 | WEAPON_MAC10 = 17, 68 | WEAPON_P90 = 19, 69 | WEAPON_UMP45 = 24, 70 | WEAPON_XM1014 = 25, 71 | WEAPON_BIZON = 26, 72 | WEAPON_MAG7 = 27, 73 | WEAPON_NEGEV = 28, 74 | WEAPON_SAWEDOFF = 29, 75 | WEAPON_TEC9 = 30, 76 | WEAPON_TASER = 31, 77 | WEAPON_HKP2000 = 32, 78 | WEAPON_MP7 = 33, 79 | WEAPON_MP9 = 34, 80 | WEAPON_NOVA = 35, 81 | WEAPON_P250 = 36, 82 | WEAPON_SCAR20 = 38, 83 | WEAPON_SG556 = 39, 84 | WEAPON_SSG08 = 40, 85 | WEAPON_KNIFE = 42, 86 | WEAPON_FLASHBANG = 43, 87 | WEAPON_HEGRENADE = 44, 88 | WEAPON_SMOKEGRENADE = 45, 89 | WEAPON_MOLOTOV = 46, 90 | WEAPON_DECOY = 47, 91 | WEAPON_INCGRENADE = 48, 92 | WEAPON_C4 = 49, 93 | WEAPON_KNIFE_T = 59, 94 | WEAPON_M4A1_SILENCER = 60, 95 | WEAPON_USP_SILENCER = 61, 96 | WEAPON_CZ75A = 63, 97 | WEAPON_REVOLVER = 64, 98 | WEAPON_KNIFE_BAYONET = 500, 99 | WEAPON_KNIFE_FLIP = 505, 100 | WEAPON_KNIFE_GUT = 506, 101 | WEAPON_KNIFE_KARAMBIT = 507, 102 | WEAPON_KNIFE_M9_BAYONET = 508, 103 | WEAPON_KNIFE_TACTICAL = 509, 104 | WEAPON_KNIFE_FALCHION = 512, 105 | WEAPON_KNIFE_SURVIVAL_BOWIE = 514, 106 | WEAPON_KNIFE_BUTTERFLY = 515, 107 | WEAPON_KNIFE_PUSH = 516, 108 | } 109 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "noImplicitAny": false, 5 | "sourceMap": true, 6 | "outDir": "./lib/", 7 | "target": "ESNEXT", 8 | "typeRoots": [ 9 | "./node_modules/@types" 10 | ] 11 | }, 12 | "lib": [ 13 | "es2016" 14 | ], 15 | "exclude": [ 16 | "./node_modules", 17 | "./typings" 18 | ] 19 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [], 4 | "rules": { 5 | "interface-name": false, 6 | "object-literal-sort-keys": false, 7 | "forin": false, 8 | "member-access": false, 9 | "quotemark": [true, "single"], 10 | "max-line-length": { 11 | "options": [120] 12 | }, 13 | "new-parens": true, 14 | "no-arg": true, 15 | "no-bitwise": true, 16 | "no-conditional-assignment": true, 17 | "no-consecutive-blank-lines": false, 18 | "no-console": { 19 | "severity": "warning", 20 | "options": ["debug", "info", "log", "time", "timeEnd", "trace"] 21 | } 22 | }, 23 | "jsRules": { 24 | "max-line-length": { 25 | "options": [120] 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /typings/typings.d.ts: -------------------------------------------------------------------------------- 1 | 2 | declare interface IProcessListEntry { 3 | cntThreads: number, 4 | szExeFile: string, 5 | th32ProcessID: number, 6 | th32ParentProcessID: number, 7 | pcPriClassBase: number, 8 | } 9 | 10 | declare interface IModuleListEntry { 11 | modBaseAddr: number; 12 | modBaseSize: number; 13 | szExePath: string; 14 | szModule: string; 15 | th32ProcessID: number; 16 | hModule: number; 17 | } 18 | 19 | declare interface IModuleObject { 20 | modBaseAddr: number; 21 | modBaseSize: number; 22 | szExePath: string; 23 | szModule: string; 24 | th32ModuleID: number; 25 | } 26 | 27 | declare interface IProcessObject { 28 | dwSize: number; 29 | th32ProcessID: number; 30 | cntThreads: number; 31 | th32ParentProcessID: number, 32 | pcPriClassBase: number; 33 | szExeFile: string; 34 | handle: number; 35 | modBaseAddr: number; 36 | } 37 | 38 | declare type EMemoryTypes = any; 39 | declare type MemoryTypes = 40 | 'byte' 41 | | 'int' 42 | | 'int32' 43 | | 'uint32' 44 | | 'int64' 45 | | 'uint64' 46 | | 'dword' 47 | | 'short' 48 | | 'long' 49 | | 'float' 50 | | 'double' 51 | | 'bool' 52 | | 'boolean' 53 | | 'ptr' 54 | | 'pointer' 55 | | 'str' 56 | | 'string' 57 | | 'vec3' 58 | | 'vector3' 59 | | 'vec4' 60 | | 'vector4'; 61 | 62 | 63 | /* 64 | processObject => 65 | { dwSize: 304, 66 | th32ProcessID: 16452, 67 | cntThreads: 3, 68 | th32ParentProcessID: 2412, 69 | pcPriClassBase: 8, 70 | szExeFile: 'notepad.exe', 71 | handle: 520, 72 | modBaseAddr: 3734306816 } 73 | */ 74 | 75 | 76 | // @ts-ignore 77 | declare module 'memoryJs' { 78 | export function openProcess(processIdentifier: string, callback: (error: any, processObject: IProcessObject) => void): void; 79 | export function openProcess(processIdentifier: string): IProcessObject; 80 | 81 | export function getProcesses(callback: (error: any, processes: IProcessListEntry[]) => void): void; 82 | export function getProcesses(): IProcessListEntry[]; 83 | 84 | export function findModule(moduleName: string, pid: string): IModuleListEntry; 85 | 86 | export function getModules(pid: string): IModuleObject[]; 87 | 88 | export function readMemory(handle: number, address: any, dataType: EMemoryTypes); 89 | 90 | export function writeMemory(handle: number, address: any, value: any, dataType: EMemoryTypes); 91 | 92 | export function readBuffer(handle: number, address: any, size: number); 93 | 94 | export function writeBuffer(handle: number, address: any, buffer: any); 95 | } 96 | 97 | export type Resolver = { 98 | [Key in keyof T]?: (type?: EMemoryTypes) => any; 99 | } & { base?: any; } & { 100 | set?: { 101 | [Key in keyof T]?: (value: any, type?: EMemoryTypes) => void; 102 | } 103 | }; 104 | --------------------------------------------------------------------------------