diff --git a/README.md b/README.md index 4d622a26..7f0c43c7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Ubuntu (and probably Debian) users can run this script: sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install libc6-dev gcc-6 g++-6 g++-6-multilib gdb -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4 ``` -**Errors while installing?** +**Errors while installing?** `/usr/include/c++/5/string:38:28: fatal error: bits/c++config.h: No such file or directory` - You don't have g++6 or g++6 multilib installed correctly diff --git a/TODO b/TODO index 45290e6f..6e1921f0 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,7 @@ inspect shit TTS noise spam team name spam (pre round team name spam thing) -insta taunt (taunts for like .5 ms and then you can do it again lithium has it) +insta taunt (taunts for like .5 ms and then you can do it again lithium has it) auto vacc namesteal autovote diff --git a/attach b/attach index 5d2d2608..29d457f6 100755 --- a/attach +++ b/attach @@ -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 +if [ $# == 0 ]; then + 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" \ diff --git a/attach-backtrace b/attach-backtrace index 84e164db..52616dbf 100755 --- a/attach-backtrace +++ b/attach-backtrace @@ -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 +if [ $# == 0 ]; then + 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" \ @@ -38,4 +38,4 @@ gdb -n -q -batch \ -ex 'print (char *) $2' \ -ex "catch syscall exit exit_group" \ -ex "continue" \ - -ex "backtrace" \ No newline at end of file + -ex "backtrace" diff --git a/detach b/detach index 2545fc8d..c1f22a32 100755 --- a/detach +++ b/detach @@ -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 +if [ $# == 0 ]; then + 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 diff --git a/install-resources.sh b/install-resources.sh index f472d783..7523a5eb 100755 --- a/install-resources.sh +++ b/install-resources.sh @@ -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 \ No newline at end of file +echo "Default killsay/spam files installed, EDIT THEM!" +xdg-open "$HOME"/.cathook diff --git a/makefile b/makefile index 2143f0cd..9d601e73 100644 --- a/makefile +++ b/makefile @@ -29,10 +29,10 @@ CXXFLAGS += -DGIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" -DGIT_COMMIT_DATE="\"$(GI all: mkdir -p $(TARGET_DIR) $(MAKE) $(TARGET) - + .cpp.o: $(CXX) $(CXXFLAGS) -c $< -o $@ - + %.d: %.cpp $(CXX) -M $(CXXFLAGS) $< > $@ @@ -43,7 +43,7 @@ clean: find src -type f -name '*.o' -delete find src -type f -name '*.d' -delete rm -rf ./bin - + ifneq ($(MAKECMDGOALS), clean) -include $(DEPENDS) endif diff --git a/reattach b/reattach index de1852f0..d385fb8d 100755 --- a/reattach +++ b/reattach @@ -1,4 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash -sudo ./detach $1 -sudo ./attach $1 \ No newline at end of file +sudo ./detach "$1" && sudo ./attach "$1" diff --git a/res/.gitignore b/res/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/res/convert.sh b/res/convert.sh index 45f7f528..74158ff5 100755 --- a/res/convert.sh +++ b/res/convert.sh @@ -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 \ No newline at end of file +#!/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 diff --git a/update b/update index a0b91a55..9f2f95e3 100755 --- a/update +++ b/update @@ -1,4 +1,6 @@ +#!/usr/bin/env bash + git pull origin master && \ git submodule update --remote --recursive && \ make clean && \ -make -j4 \ No newline at end of file +make -j4