lewisclark / glua-steal

Retrieves client-sided Lua files from Garry's Mod game servers
GNU General Public License v3.0
154 stars 15 forks source link

not working #10

Closed ghost closed 4 years ago

ghost commented 4 years ago

./inject -p 237297 /home/user/Desktop/ceee/glua-steal/build/src/libgluasteal.so targeting process with pid 237297 ptrace(PTRACE_ATTACH) failed

No further output...

Running in ROOT

./inject -p 237297 /home/user/Desktop/ceee/glua-steal/build/src/libgluasteal.so targeting process with pid 237297 instead of expected SIGTRAP, target stopped with signal 11: Segmentation fault sending process 237297 a SIGSTOP signal for debugging purposes

Game crashes

No further output

Gluasteal folder is not created... Any ideas?

t3r00t commented 4 years ago

Are using the default gmod ( all BETAs are not supported yet )

ghost commented 4 years ago

Yes, I'm using default gmod.

lewisclark commented 4 years ago

Could you try using one of the alternative injection methods listed in the readme, such as gdb? I've had some trouble with using linux-inject before on gmod.

ghost commented 4 years ago

I'm not exactly sure what to do with gdb, thats why I went for linux-inject...

lewisclark commented 4 years ago

This is a script to inject a library into a process using gdb. I modified it from another repository but I haven't tested it. Requires root.

./gdb_inject \<pid> \<librarypath>

#Credit: Aixxe @ aixxe.net from aimtux repo
input="$(
sudo gdb -n -q -batch \
    -ex "attach $1" \
    -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
    -ex "call \$dlopen(\"$2\", 1)" \
    -ex "detach" \
    -ex "quit"
)"

last_line="${input##*$'\n'}"

if [ "$last_line" != "$1 = (void *) 0x0" ]; then
/bin/echo -e "\e[32mSuccessfully injected!\e[0m"
else
/bin/echo -e "\e[31mInjection failed\e[0m"
fi
ghost commented 4 years ago

[user ceee]# ./gdb_inject 287034 /home/user/Desktop/ceee/glua-steal/build/src/libgluasteal.so ./gdb_inject: line 13: -ex: command not found ./gdb_inject: line 14: -ex: command not found ./gdb_inject: line 15: -ex: command not found ./gdb_inject: line 16: -ex: command not found ./gdb_inject: line 17: -ex: command not found Successfully injected! [user ceee]#

I do have GDB, the exploit directory thing was not created.

ghost commented 4 years ago

Just to be clear am I supposed to be targeting the "hl2_linux" or the "Garry's Mod - OpenGL" process?

lewisclark commented 4 years ago

I've just updated the gdb script. Just tested it and it worked perfectly for me. Inject into the first hl2_linux process (there are two).

ghost commented 4 years ago

It injects! But it doesn't work..

Log file:

[27-04-20 - 10:00:53.053] [info] Initializing gluasteal v1.4 [27-04-20 - 10:00:53.053] [info] Successfully initialized [27-04-20 - 10:00:53.053] [info] Join a server to retrieve the lua files [27-04-20 - 10:00:53.053] [info] Lua files will be saved to '/home/user/gluasteal/servers'

After joining a server nothing appears in the log, no lua files are saved.

Injection:

[user ceee]# ./gdb_inject /home/user/Desktop/ceee/libgluasteal.so warning: Could not load shared library symbols for bin/launcher.so. Do you need "set solib-search-path" or "set sysroot"? Successfully injected! [user ceee]#

Injection script:

Credit: Aixxe @ aixxe.net from aimtux repo

gmod_pid=$(pidof -s hl2_linux) if [ -z "$gmod_pid" ]; then /bin/echo -e "\e[31mGMOD needs to be open before you can inject...\e[0m" exit 1 fi

input="$( sudo gdb -n -q -batch \ -ex "attach $gmod_pid" \ -ex "set \$dlopen = (void()(char*, int)) dlopen" \ -ex "call \$dlopen(\"$1\", 1)" \ -ex "detach" \ -ex "quit" )"

last_line="${input##*$'\n'}"

if [ "$last_line" != "$1 = (void *) 0x0" ]; then /bin/echo -e "\e[32mSuccessfully injected!\e[0m" else /bin/echo -e "\e[31mInjection failed\e[0m" fi

lewisclark commented 4 years ago

That's odd. I was able to retrieve lua files from a few servers with a freshly built library. Not really too sure what could be going on here but I'll do some testing.

ghost commented 4 years ago

Thank you for your time and help!

lewisclark commented 4 years ago

I'm still not able to recreate the issue. v1.5 has been released which might work better for you.

ghost commented 4 years ago

Okay I will it.

LuaFan2 commented 4 years ago

I had a similar problem, but I tried to inject through LD_PRELOAD, and it worked.

LD_PRELOAD=/path/to/gluasteal.so %command% in GMOD launch options in Steam