diff --git a/README.md b/README.md index 7fdcfd919c1..0742626b149 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,53 @@ Counter-Strike 2 blocks LoadLibrary injection method, so you have to use a manua You can simply run the following script in the directory containing **libOsiris.so**: - sudo gdb -batch-silent -p $(pidof cs2) -ex "call (void*)dlopen(\"$PWD/libOsiris.so\", 2)" +``` + +And the `.so` file is located in: +``` +build/Source/libOsiris.so + + +--- + +### **Live Injection Methods** + +#### 1. **Using GDB with explicit PID** +``` +sudo gdb -batch -n -q -p -ex "call (void*)dlopen(\"$PWD/build/Source/libOsiris.so\", 2)" +``` + +#### 2. **Using ptrace injector (if available)** +``` +sudo injectso "$PWD/build/Source/libOsiris.so" +``` + +#### 3. **Using GDB with absolute path** +``` +sudo gdb -batch -n -q -p $(pidof cs2) -ex "call (void*)dlopen(\"$(realpath build/Source/libOsiris.so)\", 2)" +``` + +#### 4. **Using GDB with silent mode** +``` +sudo gdb -batch-silent -p $(pidof cs2) -ex "call (void*)dlopen(\"$PWD/build/Source/libOsiris.so\", 2)" +``` + +### **Launch-Time Injection Methods** + +#### 5. **Using LD_PRELOAD on fresh launch** +``` +LD_PRELOAD="$PWD/build/Source/libOsiris.so" ./cs2 +``` + +#### 6. **Using GDB with run + preload** +``` +sudo gdb -batch -n -q --args ./cs2 -ex "set environment LD_PRELOAD=$PWD/build/Source/libOsiris.so" -ex run +``` However, this injection method might be detected by VAC as gdb is visible under **TracerPid** in `/proc/$(pidof cs2)/status` for the duration of the injection. +sudo gdb -batch-silent -p $(pidof cs2) -ex "call (void*)dlopen(\"$PWD/build/Source/libOsiris.so\", 2)" + ## FAQ ### Where are the settings stored on disk? diff --git a/linux-inject.py b/linux-inject.py new file mode 100644 index 00000000000..0f120aed725 --- /dev/null +++ b/linux-inject.py @@ -0,0 +1,31 @@ +import os +import subprocess + +# Define the path to the shared object +lib_path = os.path.join(os.getcwd(), "build/Source/libOsiris.so") + +# Try to get the PID of the cs2 process +try: + pid = subprocess.check_output(["pidof", "cs2"]).decode().strip() +except subprocess.CalledProcessError: + pid = None + +# Define the menu options +menu = { + "1": f"sudo gdb -batch -n -q -p -ex \"call (void*)dlopen(\\\"{lib_path}\\\", 2)\"", + "2": f"sudo injectso \"{lib_path}\"", + "3": f"LD_PRELOAD=\"{lib_path}\" ./cs2", + "4": f"sudo gdb -batch -n -q --args ./cs2 -ex \"set environment LD_PRELOAD={lib_path}\" -ex run", + "5": f"sudo gdb -batch -n -q -p {pid if pid else ''} -ex \"call (void*)dlopen(\\\"$(realpath {lib_path})\\\", 2)\"", + "6": f"sudo gdb -batch-silent -p {pid if pid else ''} -ex \"call (void*)dlopen(\\\"{lib_path}\\\", 2)\"" +} + +# Display the menu +print("Injection Method Menu:\n") +for key, command in menu.items(): + print(f"{key}. {command}") + +if pid: + print(f"\nDetected cs2 PID: {pid}") +else: + print("\ncs2 process not detected. Please start cs2 or replace manually.")