Nitpicking

Signed-off-by: mpmjcvuut <mpmjcvuut@protonmail.ch>
This commit is contained in:
mpmjcvuut 2017-05-01 20:07:10 +01:00
parent ae80783ed3
commit d4e1c330e8
No known key found for this signature in database
GPG Key ID: CCF4A085CE587F53
11 changed files with 63 additions and 60 deletions

22
attach
View File

@ -1,35 +1,35 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
proc=${arr[$inst]}
echo Running instances: ${arr[@]}
echo Attaching to $proc
echo Running instances: "${arr[@]}"
echo Attaching to "$proc"
#sudo ./detach $inst bin/libcathook.so
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
echo already loaded
exit
fi
echo loading $(realpath bin/libcathook.so) to $proc
echo loading "$(realpath bin/libcathook.so)" to "$proc"
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \

View File

@ -1,35 +1,35 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo tf2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
proc=${arr[$inst]}
echo Running instances: ${arr[@]}
echo Attaching to $proc
echo Running instances: "${arr[@]}"
echo Attaching to "$proc"
sudo ./detach $inst bin/libcathook.so
if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then
if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
echo already loaded
exit
fi
echo loading $(realpath bin/libcathook.so) to $proc
echo loading "$(realpath bin/libcathook.so)" to "$proc"
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \

24
detach
View File

@ -1,37 +1,37 @@
#!/bin/bash
#!/usr/bin/env bash
line=`pidof hl2_linux`
line=$(pidof hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then
inst=0
inst=0
fi
if [ ${#arr[@]} == 0 ]; then
echo tf2 isn\'t running!
exit
echo TF2 isn\'t running!
exit
fi
if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then
echo wrong index!
exit
echo wrong index!
exit
fi
echo Running instances: ${arr[@]}
echo Detaching from ${arr[$1]}
echo Running instances: "${arr[@]}"
echo Detaching from "${arr[$1]}"
if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then
if grep -q "$(realpath bin/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 bin/libcathook.so)\", 6)" \
-ex "print \$library" \
-ex "sharedlibrary ." \
-ex "sharedlibrary ." \
-ex "call \$dlclose(\$library)" \
-ex "call \$dlclose(\$library)" \
-ex "detach"
echo "Detached"
else
echo "not found!"
echo "not found!"
fi

View File

@ -1,14 +1,16 @@
if [ ! -d "~/.cathook" ]; then
mkdir ~/.cathook
#!/usr/bin/env bash
if [ ! -d "$HOME/.cathook" ]; then
mkdir "$HOME"/.cathook
fi
if [ ! -f "~/.cathook/killsays.txt" ]; then
cp res/killsays.txt ~/.cathook
if [ ! -f "$HOME/.cathook/killsays.txt" ]; then
cp res/killsays.txt "$HOME"/.cathook
fi
if [ ! -f "~/.cathook/spam.txt" ]; then
cp res/spam.txt ~/.cathook
if [ ! -f "$HOME/.cathook/spam.txt" ]; then
cp res/spam.txt "$HOME"/.cathook
fi
echo Default killsay/spam files installed, EDIT THEM!
gnome-open ~/.cathook
echo "Default killsay/spam files installed, EDIT THEM!"
xdg-open "$HOME"/.cathook

View File

@ -1,4 +1,3 @@
#!/bin/bash
#!/usr/bin/env bash
sudo ./detach $1
sudo ./attach $1
sudo ./detach "$1" && sudo ./attach "$1"

0
res/.gitignore vendored
View File

View File

@ -1,5 +1,5 @@
#!/bin/sh
convert $1.png -depth 8 -format rgba $1.rgba
mv $1.rgba $1
objcopy --input binary --output elf32-i386 --binary-architecture i386 $1 $1.o
mv $1.o bin/$1.o
#!/usr/bin/env bash
convert "$1".png -depth 8 -format rgba "$1".rgba
mv "$1".rgba "$1"
objcopy --input binary --output elf32-i386 --binary-architecture i386 "$1" "$1".o
mv "$1".o bin/"$1".o

2
update
View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
git pull origin master && \
git submodule update --remote --recursive && \
make clean && \