danielkrupinski / GOESP

Cross-platform streamproof ESP hack for Counter-Strike: Global Offensive, written in modern C++. Rendering and GUI powered by Dear ImGui + FreeType.
MIT License
433 stars 72 forks source link

Injection problem [LINUX] #48

Closed bruhmoment21 closed 4 years ago

bruhmoment21 commented 4 years ago

When i try to inject this into csgo i get signal 11 (segmentation fault i think). I even made a different project memory class only and pollEvent + swapWindow.

System: Ubuntu 20.04 Compiling with g++ and using c++17(no build errors).

I'm not getting get my couts printed into the terminal. Screenshot from 2020-08-03 11-41-58

Other screenshots: Screenshot from 2020-08-03 11-36-56 Screenshot from 2020-08-03 11-37-16 Screenshot from 2020-08-03 11-37-31 Screenshot from 2020-08-03 11-39-50

danielkrupinski commented 4 years ago

Try injecting using gdb.

bruhmoment21 commented 4 years ago

Try injecting using gdb.

My game crashes when using gdb. Below is what logs into console after injecting.

No minidump written, nothing to upload.
Segmentation fault (core dumped)
CCrossProcessPipe::BWrite wrote too few bytes: 32 (Broken pipe).  Continuing.
Game removed: AppID 730 "", ProcID 29841 
Game 730 created interface STEAMAPPLIST_INTERFACE_VERSION001 / AppList
Game 730 created interface STEAMAPPS_INTERFACE_VERSION008 / Apps
Game 730 created interface STEAMHTMLSURFACE_INTERFACE_VERSION_005 / HTMLSurface
Game 730 created interface STEAMHTTP_INTERFACE_VERSION003 / HTTP
Game 730 created interface STEAMINVENTORY_INTERFACE_V001 / Inventory
Game 730 created interface STEAMMUSICREMOTE_INTERFACE_VERSION001 / MusicRemote
Game 730 created interface STEAMMUSIC_INTERFACE_VERSION001 / Music
Game 730 created interface STEAMREMOTESTORAGE_INTERFACE_VERSION014 / 
Game 730 created interface STEAMREMOTESTORAGE_INTERFACE_VERSION014 / RemoteStorage
Game 730 created interface STEAMSCREENSHOTS_INTERFACE_VERSION003 / Screenshots
Game 730 created interface STEAMUGC_INTERFACE_VERSION014 / UGC
Game 730 created interface STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001 / UnifiedMessages
Game 730 created interface STEAMUSERSTATS_INTERFACE_VERSION012 / UserStats
Game 730 created interface STEAMVIDEO_INTERFACE_V001 / Video
Game 730 created interface SteamAppDisableUpdate001 / 
Game 730 created interface SteamController003 / Controller
Game 730 created interface SteamController007 / 
Game 730 created interface SteamFriends017 / Friends
Game 730 created interface SteamGameCoordinator001 / 
Game 730 created interface SteamGameStats001 / 
Game 730 created interface SteamInput001 / 
Game 730 created interface SteamMatchMaking009 / Matchmaking
Game 730 created interface SteamMatchMakingServers002 / MatchmakingServers
Game 730 created interface SteamNetworking005 / Networking
Game 730 created interface SteamNetworkingSocketsSerialized003 / 
Game 730 created interface SteamUser020 / User
Game 730 created interface SteamUser021 / User
Game 730 created interface SteamUtils009 / 
Game 730 created interface SteamUtils009 / Utils
Game 730 method call count for IClientNetworkingSocketsSerialized::GetCertAsync : 1
Game 730 method call count for IClientNetworkingSocketsSerialized::GetCachedRelayTicketCount : 1
Game 730 method call count for IClientUser::BSetDurationControlOnlineState : 1
Game 730 method call count for IClientUser::BLoggedOn : 10
Game 730 method call count for IClientUser::BIsSubscribedApp : 49
Game 730 method call count for IClientUser::GetUserDataFolder : 1
Game 730 method call count for IClientUser::GetSteamID : 230
Game 730 method call count for IClientFriends::GetSmallFriendAvatar : 103
Game 730 method call count for IClientFriends::GetMediumFriendAvatar : 1
Game 730 method call count for IClientFriends::GetFriendCount : 5
Game 730 method call count for IClientFriends::RequestUserInformation : 62
Game 730 method call count for IClientFriends::GetFriendPersonaState : 10
Game 730 method call count for IClientFriends::GetFriendRelationship : 66
Game 730 method call count for IClientFriends::GetFriendGamePlayed : 10
Game 730 method call count for IClientFriends::SetRichPresence : 20
Game 730 method call count for IClientFriends::GetFriendByIndex : 10
Game 730 method call count for IClientFriends::GetPersonaName : 1
Game 730 method call count for IClientFriends::GetFriendPersonaName_Public : 7
Game 730 method call count for IClientUtils::GetImageRGBA : 77
Game 730 method call count for IClientUtils::IsSteamChinaLauncher : 2
Game 730 method call count for IClientUtils::InitFilterText : 1
Game 730 method call count for IClientUtils::FilterText : 2
Game 730 method call count for IClientUtils::GetServerRealTime : 2
Game 730 method call count for IClientUtils::GetImageSize : 77
Game 730 method call count for IClientUtils::GetAppID : 211
Game 730 method call count for IClientUtils::GetAPICallResult : 22
Game 730 method call count for IClientUtils::GetConnectedUniverse : 7
Game 730 method call count for IClientUtils::RecordSteamInterfaceCreation : 197
Game 730 method call count for IClientUtils::GetIPCountry : 1
Game 730 method call count for IClientAppManager::GetActiveBeta : 1
Game 730 method call count for IClientAppManager::GetAppStateInfo : 49
Game 730 method call count for IClientAppManager::GetCurrentLanguage : 2
Game 730 method call count for IClientUserStats::RequestCurrentStats : 1
Game 730 method call count for IClientUserStats::GetStat : 289
Game 730 method call count for IClientUserStats::GetAchievement : 167
Game 730 method call count for IClientNetworking::AllowP2PPacketRelay : 2
Game 730 method call count for IClientRemoteStorage::GetQuota : 1
Game 730 method call count for IClientRemoteStorage::GetPublishedFileDetails : 4
Game 730 method call count for IClientRemoteStorage::EnumerateUserSubscribedFiles : 1
Game 730 method call count for IClientRemoteStorage::FileWrite : 1
Game 730 method call count for IClientRemoteStorage::FileRead : 4
Game 730 method call count for IClientRemoteStorage::GetFileSize : 4
Game 730 method call count for IClientRemoteStorage::FileExists : 1
Game 730 method call count for IClientRemoteStorage::GetCREItemVoteSummary : 4
Game 730 method call count for IClientGameCoordinator::SendMessage : 5
Game 730 method call count for IClientGameCoordinator::IsMessageAvailable : 12
Game 730 method call count for IClientGameCoordinator::RetrieveMessage : 6
Game 730 method call count for IClientGameStats::GetNewSession : 1
Game 730 method call count for IClientHTTP::GetHTTPResponseBodyData : 11
Game 730 method call count for IClientHTTP::ReleaseHTTPRequest : 11
Game 730 method call count for IClientHTTP::SendHTTPRequest : 11
Game 730 method call count for IClientHTTP::GetHTTPResponseBodySize : 10
Game 730 method call count for IClientHTTP::SetHTTPRequestHeaderValue : 1
Game 730 method call count for IClientHTTP::GetHTTPResponseHeaderValue : 1
Game 730 method call count for IClientHTTP::CreateHTTPRequest : 11
Game 730 method call count for IClientControllerSerialized::HasGameMapping : 51
Game 730 method call count for IClientControllerSerialized::GetActionSetHandle : 1
Game 730 method call count for IClientAppDisableUpdate::SetAppUpdateDisabledSecondsRemaining : 1
Uploaded AppInterfaceStats to Steam
Exiting app 730
No cached sticky mapping in ActivateActionSet.
danielkrupinski commented 4 years ago

Check what dlsym() returns.

bruhmoment21 commented 4 years ago

Both returned 0. Screenshot from 2020-08-03 12-33-54

danielkrupinski commented 4 years ago

Maybe you're injecting too early - wait until you see the main menu and then inject. Could you show your CMakeLists.txt/Makefile?

bruhmoment21 commented 4 years ago

Maybe you're injecting too early - wait until you see the main menu and then inject. Could you show your CMakeLists.txt/Makefile?

I tried injecting in match still got 0. CMakeLists.txt


project(hygenium)

find_package(SDL2 REQUIRED) ## delete my if i dont fix anything
include_directories(${SDL2_INCLUDE_DIRS}) ## delete my if i dont fix anything

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -std=c++17 -Wall -Wno-maybe-uninitialized -Wno-unused-result")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG -std=c++17 -Wall -Wno-maybe-uninitialized -Wno-unused-result")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -DNDEBUG -std=c++17 -Wall -Wno-maybe-uninitialized -Wno-unused-result")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG -std=c++17 -Wall -Wno-maybe-uninitialized -Wno-unused-result")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")

set(CMAKE_BUILD_TYPE DEBUG)

file(GLOB_RECURSE SOURCE_FILES "${CMAKE_SOURCE_DIR}/src/*.cpp") #make gl3w .cpp or do workaround if including

add_library(hygenium SHARED ${SOURCE_FILES})

target_compile_definitions(hygenium PRIVATE -D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")

target_link_libraries(hygenium ${SDL2_LIBRARIES})

include_directories(${CMAKE_CURRENT_BINARY_DIR})

MakeFile

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.16

# Default target executed when no arguments are given to make.
default_target: all

.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:

.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/illegalcsx/Documents/Hygenium

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/illegalcsx/Documents/Hygenium

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target rebuild_cache
rebuild_cache:
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
    /usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache

.PHONY : rebuild_cache/fast

# Special rule for the target edit_cache
edit_cache:
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
    /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache

.PHONY : edit_cache/fast

# The main all target
all: cmake_check_build_system
    $(CMAKE_COMMAND) -E cmake_progress_start /home/illegalcsx/Documents/Hygenium/CMakeFiles /home/illegalcsx/Documents/Hygenium/CMakeFiles/progress.marks
    $(MAKE) -f CMakeFiles/Makefile2 all
    $(CMAKE_COMMAND) -E cmake_progress_start /home/illegalcsx/Documents/Hygenium/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
    $(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean

.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
    $(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
    $(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
    $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named hygenium

# Build rule for target.
hygenium: cmake_check_build_system
    $(MAKE) -f CMakeFiles/Makefile2 hygenium
.PHONY : hygenium

# fast build rule for target.
hygenium/fast:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/build
.PHONY : hygenium/fast

src/hooks.o: src/hooks.cpp.o

.PHONY : src/hooks.o

# target to build an object file
src/hooks.cpp.o:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/hooks.cpp.o
.PHONY : src/hooks.cpp.o

src/hooks.i: src/hooks.cpp.i

.PHONY : src/hooks.i

# target to preprocess a source file
src/hooks.cpp.i:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/hooks.cpp.i
.PHONY : src/hooks.cpp.i

src/hooks.s: src/hooks.cpp.s

.PHONY : src/hooks.s

# target to generate assembly for a file
src/hooks.cpp.s:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/hooks.cpp.s
.PHONY : src/hooks.cpp.s

src/install.o: src/install.cpp.o

.PHONY : src/install.o

# target to build an object file
src/install.cpp.o:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/install.cpp.o
.PHONY : src/install.cpp.o

src/install.i: src/install.cpp.i

.PHONY : src/install.i

# target to preprocess a source file
src/install.cpp.i:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/install.cpp.i
.PHONY : src/install.cpp.i

src/install.s: src/install.cpp.s

.PHONY : src/install.s

# target to generate assembly for a file
src/install.cpp.s:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/install.cpp.s
.PHONY : src/install.cpp.s

src/memory.o: src/memory.cpp.o

.PHONY : src/memory.o

# target to build an object file
src/memory.cpp.o:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/memory.cpp.o
.PHONY : src/memory.cpp.o

src/memory.i: src/memory.cpp.i

.PHONY : src/memory.i

# target to preprocess a source file
src/memory.cpp.i:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/memory.cpp.i
.PHONY : src/memory.cpp.i

src/memory.s: src/memory.cpp.s

.PHONY : src/memory.s

# target to generate assembly for a file
src/memory.cpp.s:
    $(MAKE) -f CMakeFiles/hygenium.dir/build.make CMakeFiles/hygenium.dir/src/memory.cpp.s
.PHONY : src/memory.cpp.s

# Help Target
help:
    @echo "The following are some of the valid targets for this Makefile:"
    @echo "... all (the default if no target is provided)"
    @echo "... clean"
    @echo "... depend"
    @echo "... rebuild_cache"
    @echo "... edit_cache"
    @echo "... hygenium"
    @echo "... src/hooks.o"
    @echo "... src/hooks.i"
    @echo "... src/hooks.s"
    @echo "... src/install.o"
    @echo "... src/install.i"
    @echo "... src/install.s"
    @echo "... src/memory.o"
    @echo "... src/memory.i"
    @echo "... src/memory.s"
.PHONY : help

#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
    $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
danielkrupinski commented 4 years ago

Looks like you're not linking properly against SDL2. Try adding this to your CMakeLists:

target_link_libraries(GOESP SDL2 GL)
bruhmoment21 commented 4 years ago

Looks like you're not linking properly against SDL2. Try adding this to your CMakeLists:

target_link_libraries(GOESP SDL2 GL)

Still not fixed.

bruhmoment21 commented 4 years ago

Fixed by replacing RTLD_NEXT with this var: void* sdl_library = dlopen("libSDL2-2.0.so.0", RTLD_LAZY);