-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b639c1
commit 9de57b1
Showing
18 changed files
with
136 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "source-sdk-2013"] | ||
path = source-sdk-2013 | ||
url = https://github.com/ValveSoftware/source-sdk-2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# Disclaimer | ||
I know that the style sucks. There is a lot of design errors and cancerous patterns. Most of the code was intended to be *temporary*. | ||
I know that the style sucks. There is a lot of design errors and cancerous patterns. Most of the code was intended to be *temporary*. | ||
|
||
# Compilation | ||
`make` | ||
|
||
# Injection | ||
`sudo ./attach-backtrace` if you want to see backtrace after the game crashes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
line=`pidof hl2_linux` | ||
arr=($line) | ||
inst=$1 | ||
if [ $# == 0 ]; then | ||
inst=0 | ||
fi | ||
|
||
if [ ${#arr[@]} == 0 ]; then | ||
echo tf2 isn\'t running! | ||
exit | ||
fi | ||
|
||
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then | ||
echo wrong index! | ||
exit | ||
fi | ||
|
||
echo Running instances: ${arr[@]} | ||
echo Attaching to ${arr[$1]} | ||
|
||
if grep -q $(realpath libcathook.so) /proc/${arr[$1]}/maps; then | ||
echo already loaded | ||
exit | ||
fi | ||
|
||
echo loading $(realpath libcathook.so) to ${arr[$1]} | ||
gdb -n -q -batch \ | ||
-ex "attach ${arr[$1]}" \ | ||
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ | ||
-ex "call \$dlopen(\"$(realpath libcathook.so)\", 1)" \ | ||
-ex "call dlerror()" \ | ||
-ex 'print (char *) $2' \ | ||
-ex "detach" \ | ||
-ex "quit" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
line=`pidof hl2_linux` | ||
arr=($line) | ||
inst=$1 | ||
if [ $# == 0 ]; then | ||
inst=0 | ||
fi | ||
|
||
if [ ${#arr[@]} == 0 ]; then | ||
echo tf2 isn\'t running! | ||
exit | ||
fi | ||
|
||
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then | ||
echo wrong index! | ||
exit | ||
fi | ||
|
||
proc=${arr[$inst]} | ||
|
||
echo Running instances: ${arr[@]} | ||
echo Attaching to $proc | ||
|
||
sudo ./detach $inst libcathook.so | ||
|
||
if grep -q $(realpath libcathook.so) /proc/$proc/maps; then | ||
echo already loaded | ||
exit | ||
fi | ||
|
||
echo loading $(realpath libcathook.so) to $proc | ||
gdb -n -q -batch \ | ||
-ex "attach $proc" \ | ||
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ | ||
-ex "call \$dlopen(\"$(realpath libcathook.so)\", 1)" \ | ||
-ex "call dlerror()" \ | ||
-ex 'print (char *) $2' \ | ||
-ex "continue" \ | ||
-ex "backtrace" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
line=`pidof hl2_linux` | ||
arr=($line) | ||
inst=$1 | ||
if [ $# == 0 ]; then | ||
inst=0 | ||
fi | ||
|
||
if [ ${#arr[@]} == 0 ]; then | ||
echo tf2 isn\'t running! | ||
exit | ||
fi | ||
|
||
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then | ||
echo wrong index! | ||
exit | ||
fi | ||
|
||
echo Running instances: ${arr[@]} | ||
echo Detaching from ${arr[$1]} | ||
|
||
if grep -q $(realpath libcathook.so) /proc/${arr[$1]}/maps; then | ||
gdb -n -q -batch \ | ||
-ex "attach ${arr[$1]}" \ | ||
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ | ||
-ex "set \$dlclose = (int(*)(void*)) dlclose" \ | ||
-ex "set \$library = \$dlopen(\"$(realpath libcathook.so)\", 6)" \ | ||
-ex "print \$library" \ | ||
-ex "call \$dlclose(\$library)" \ | ||
-ex "call \$dlclose(\$library)" \ | ||
-ex "detach" \ | ||
-ex "quit" | ||
echo "Detached" | ||
else | ||
echo "not found!" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
sudo ./detach $1 | ||
sudo ./attach $1 |
Submodule source-sdk-2013
added at
0d8dce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.