Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xc0000005 #9

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions config/offsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
type Offsets struct {
Timestamp string `yaml:"timestamp"`
Signatures struct {
OffsetLocalPlayer int `yaml:"dwLocalPlayer"`
OffsetForceJump int `yaml:"dwForceJump"`
OffsetLocalPlayer uintptr `yaml:"dwLocalPlayer"`
OffsetForceJump uintptr `yaml:"dwForceJump"`
} `yaml:"signatures"`
Netvars struct {
OffsetLocalPlayerFlags int `yaml:"m_fFlags"`
OffsetLocalPlayerFlags uintptr `yaml:"m_fFlags"`
} `yaml:"netvars"`
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.13

require (
github.com/sirupsen/logrus v1.4.2
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/tools v0.0.0-20191122232904-2a6ccf25d769 // indirect
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 // indirect
gopkg.in/yaml.v2 v2.2.7
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE=
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ=
Expand All @@ -27,7 +33,11 @@ golang.org/x/tools v0.0.0-20191121040551-947d4aa89328 h1:t3X42h9e6xdbrCD/gPyWqAX
golang.org/x/tools v0.0.0-20191121040551-947d4aa89328/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191122232904-2a6ccf25d769 h1:nIPDpirk90v9eLG0L8usrehSoJ1rWd6wX7BdjAKhZ4I=
golang.org/x/tools v0.0.0-20191122232904-2a6ccf25d769/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
67 changes: 25 additions & 42 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,46 @@ import (
win32 "github.com/jamesmoriarty/gohack/win32"
log "github.com/sirupsen/logrus"
"os"
"time"
"unsafe"
)

const url = "https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.yaml"
const (
url = "https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.yaml"
processName = "csgo.exe"
moduleName = "client_panorama.dll"
)

func main() {
config.PrintBanner()
// Dynamic adresses
var (
addressLocal uintptr
addressLocalForceJump uintptr
addressLocalPlayer uintptr
addressLocalPlayerFlags uintptr
)

log.SetFormatter(&log.TextFormatter{ForceColors: true})

config.PrintBanner()

log.WithFields(log.Fields{"url": url}).Info("GetLatestOffsets")
offsets, err := config.GetLatestOffsets(url)

if err != nil {
log.Fatal("Failed getting offsets ", err)
os.Exit(1)
}

var (
// Constants
PROCESSNAME = "csgo.exe"
MODULENAME = "client_panorama.dll"
VKSPACE = 0x20 // https://docs.microsoft.com/en-gb/windows/win32/inputdev/virtual-key-codes
// Player flags https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/const.h#L147
playerFlagsJump = uintptr(0x6)
// Offsets https://github.com/frk1/hazedumper/blob/master/csgo.cs
offsetLocalPlayerFlags = uintptr(offsets.Netvars.OffsetLocalPlayerFlags)
offsetLocalPlayer = uintptr(offsets.Signatures.OffsetLocalPlayer)
offsetForceJump = uintptr(offsets.Signatures.OffsetForceJump)
// Dynamic adresses
addressLocal uintptr
addressLocalForceJump uintptr
addressLocalPlayer uintptr
addressLocalPlayerFlags uintptr
)

pid, success := win32.GetProcessID(PROCESSNAME)
log.WithFields(log.Fields{"pid": pid}).Info("GetProcessID ", PROCESSNAME)
pid, success := win32.GetProcessID(processName)
log.WithFields(log.Fields{"pid": pid}).Info("GetProcessID ", processName)
if !success {
log.Fatal("Failed to get pid ", PROCESSNAME)
log.Fatal("Failed to get pid ", processName)
os.Exit(1)
}

_, success, address := win32.GetModule(MODULENAME, pid)
log.WithFields(log.Fields{"address": address}).Info("GetModule ", MODULENAME)
_, success, address := win32.GetModule(moduleName, pid)
log.WithFields(log.Fields{"address": address}).Info("GetModule ", moduleName)
if !success {
log.Fatal("Failed to get module address ", MODULENAME)
log.Fatal("Failed to get module address ", moduleName)
os.Exit(1)
}

Expand All @@ -63,25 +55,16 @@ func main() {
addressLocal = uintptr(unsafe.Pointer(address))
log.WithFields(log.Fields{"value": util.ConvertPtrToHex(addressLocal)}).Info("- addressLocal")

addressLocalForceJump = addressLocal + offsetForceJump
addressLocalForceJump = addressLocal + offsets.Signatures.OffsetForceJump
log.WithFields(log.Fields{"value": util.ConvertPtrToHex(addressLocalForceJump)}).Info("- addressLocalForceJump")

win32.ReadProcessMemory(processHandle, win32.LPCVOID(addressLocal+offsetLocalPlayer), &addressLocalPlayer, 4)
win32.ReadProcessMemory(processHandle, win32.LPCVOID(addressLocal+offsets.Signatures.OffsetLocalPlayer), &addressLocalPlayer, 4)
log.WithFields(log.Fields{"value": util.ConvertPtrToHex(addressLocalPlayer)}).Info("- addressLocalPlayer")

addressLocalPlayerFlags = addressLocalPlayer + offsetLocalPlayerFlags
addressLocalPlayerFlags = addressLocalPlayer + offsets.Netvars.OffsetLocalPlayerFlags
log.WithFields(log.Fields{"value": util.ConvertPtrToHex(addressLocalPlayerFlags)}).Info("- addressLocalPlayerFlags")

var flagsCurrent uintptr
go util.NeverExit(func() { util.DoBHOP(processHandle, addressLocalPlayerFlags, addressLocalForceJump) })

for {
if win32.GetAsyncKeyState(VKSPACE) > 0 {
win32.ReadProcessMemory(processHandle, win32.LPCVOID(addressLocalPlayerFlags), &flagsCurrent, 1)

if flagsCurrent != 0 {
win32.WriteProcessMemory(processHandle, addressLocalForceJump, unsafe.Pointer(&playerFlagsJump), 1)
}
}
time.Sleep(35)
}
select {}
}
29 changes: 29 additions & 0 deletions util/bhop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package util

import (
win32 "github.com/jamesmoriarty/gohack/win32"
"time"
"unsafe"
)

const (
vkSpace = 0x20 // https://docs.microsoft.com/en-gb/windows/win32/inputdev/virtual-key-codes
)

func DoBHOP(processHandle win32.HANDLE, addressLocalPlayerFlags uintptr, addressLocalForceJump uintptr) {
var (
flagsCurrent uintptr
playerFlagsJump = uintptr(0x6)
)

for {
if win32.GetAsyncKeyState(vkSpace) > 0 {
win32.ReadProcessMemory(processHandle, win32.LPCVOID(addressLocalPlayerFlags), &flagsCurrent, 1)

if flagsCurrent != 0 {
win32.WriteProcessMemory(processHandle, addressLocalForceJump, unsafe.Pointer(&playerFlagsJump), 1)
}
}
time.Sleep(35)
}
}
10 changes: 10 additions & 0 deletions util/routines.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package util

func NeverExit(f func()) {
defer func() {
if v := recover(); v != nil {
go NeverExit(f)
}
}()
f()
}
2 changes: 1 addition & 1 deletion util/strings.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package strings
package util

import (
"fmt"
Expand Down