lewisclark / glua-steal

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

Compiling doesn't create the .so file. #21

Closed ghost closed 3 years ago

ghost commented 3 years ago

Okay so, i've tried to compile the glua-stealer. After doing cmake and make, i havent noticed the .so file appearing anywhere. How do i compile this. Im using manjaro 21.04 Everything like cmake and make is up-to-date.

lewisclark commented 3 years ago

It should be at the location build/src/libgluasteal.so if following the README.md instructions.

If it isn't there can you run make --debug=v and post the output here.

ghost commented 3 years ago

Thanks for fast response! i see it! okay, yet one question, why my game crashes when i inject it doe :_:"

ghost commented 3 years ago

image Ive used linux-inject with sudo.

lewisclark commented 3 years ago

Are you matching up the correct architecture for everything? Garry's mod 64-bit requires the 64-bit libgluasteal.so and the 64-bit linux-inject.

ghost commented 3 years ago

Yes, im using x86-64 branch with chromium on gmod, the libgluasteal.so is 64-bit too, the linux-inject is 64 bit too. Ill try with the gdb inject.

ghost commented 3 years ago

Also, does the library automatically create the folder? and do i need to use sudo while injecting with GDB?

lewisclark commented 3 years ago

Yes, the library will automatically create ~/gluasteal. GDB needs to be run with sudo.

If you haven't found it already, here's a script that does it. The second argument must be an absolute path, not relative. Example usage: gdb_inject.sh $(pgrep gmod) /home/user/libgluasteal.so

pid=$1
lib=$2

#Credit: Aixxe @ aixxe.net
if grep -q gluasteal.so /proc/$pid/maps; then
    /bin/echo -e "\e[33mAlready injected... Aborting...\e[0m"
    exit
fi

input="$(
sudo gdb -n -q -batch \
  -ex "attach $pid" \
  -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
  -ex "call \$dlopen(\"$lib\", 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, make sure you've compiled...\e[0m"
fi
ghost commented 3 years ago

Ayy it works, thanks homie!

synesthesium commented 1 year ago

just noting that i've modified the aimtux script to do what the above script does but not requiring either pgrep or absolute paths, might be easier to use realpath is part of the coreutils so nothing needs to be installed

#!/bin/sh

pid=$(/bin/pidof $1)
realpath=$(/bin/realpath $2)

if [ -z "$pid" ]; then
    /bin/echo -e "\e[31mcould not find process by that name\e[0m"
    exit 1
fi

if grep -q $realpath /proc/$pid/maps; then
    /bin/echo -e "\e[33malready injected\e[0m"
    exit
fi

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

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

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

usage: ./whateveryounamedthescript.sh gmod libgluasteal.so