Skip to content
Open
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
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PID> -ex "call (void*)dlopen(\"$PWD/build/Source/libOsiris.so\", 2)"
```

#### 2. **Using ptrace injector (if available)**
```
sudo injectso <PID> "$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?
Expand Down
31 changes: 31 additions & 0 deletions linux-inject.py
Original file line number Diff line number Diff line change
@@ -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 <PID> -ex \"call (void*)dlopen(\\\"{lib_path}\\\", 2)\"",
"2": f"sudo injectso <PID> \"{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 '<PID>'} -ex \"call (void*)dlopen(\\\"$(realpath {lib_path})\\\", 2)\"",
"6": f"sudo gdb -batch-silent -p {pid if pid else '<PID>'} -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 <PID> manually.")