diff options
| author | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2024-04-23 19:38:50 +0300 |
|---|---|---|
| committer | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2024-04-23 19:38:50 +0300 |
| commit | 6bf809731abfd1893e73f6c6b35d0a22dacd6fb2 (patch) | |
| tree | 2badb20131925d49384ae4f81924f02bcff58617 | |
| parent | Added the presentation (diff) | |
| download | linux-game-trainer-6bf809731abfd1893e73f6c6b35d0a22dacd6fb2.tar.gz linux-game-trainer-6bf809731abfd1893e73f6c6b35d0a22dacd6fb2.zip | |
Small changes to the Makefile and the scripts
| -rw-r--r-- | Makefile | 2 | ||||
| -rwxr-xr-x | run.sh | 17 | ||||
| -rw-r--r-- | scripts/read.sh | 2 | ||||
| -rw-r--r-- | scripts/scan.sh | 2 | ||||
| -rw-r--r-- | src/main.c | 1 |
5 files changed, 18 insertions, 6 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | CC = gcc | 1 | CC = gcc |
| 2 | CFLAGS = -Wall -g | 2 | CFLAGS = -Wall -g |
| 3 | OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c)) | 3 | OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c)) |
| 4 | OUT = hack.out | 4 | OUT = trainer |
| 5 | 5 | ||
| 6 | $(OUT): $(OBJS) | 6 | $(OUT): $(OBJS) |
| 7 | $(CC) $(CFLAGS) -o $@ $(OBJS) | 7 | $(CC) $(CFLAGS) -o $@ $(OBJS) |
| @@ -6,5 +6,18 @@ then | |||
| 6 | exit 1 | 6 | exit 1 |
| 7 | fi | 7 | fi |
| 8 | 8 | ||
| 9 | gnome-terminal -- bash ./scripts/scan.sh "$1" | 9 | if [ ! $(cat /proc/sys/kernel/yama/ptrace_scope) -eq 0 ] |
| 10 | gnome-terminal -- bash ./scripts/read.sh "$1" | 10 | then |
| 11 | echo "ptrace_scope is not set to 0 and ptrace attach will subsequently fail | ||
| 12 | To solve this issue you can run the following command: | ||
| 13 | |||
| 14 | echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope" | ||
| 15 | exit 1 | ||
| 16 | fi | ||
| 17 | |||
| 18 | TERM_EMU=gnome-terminal | ||
| 19 | |||
| 20 | # The syntax for the startup command may differ per terminal emulator. | ||
| 21 | make && \ | ||
| 22 | ${TERM_EMU} -- bash ./scripts/scan.sh "$1" && \ | ||
| 23 | ${TERM_EMU} -- bash ./scripts/read.sh "$1" | ||
diff --git a/scripts/read.sh b/scripts/read.sh index 38535e6..f26ba11 100644 --- a/scripts/read.sh +++ b/scripts/read.sh | |||
| @@ -8,4 +8,4 @@ fi | |||
| 8 | 8 | ||
| 9 | scanfile=${SCANFILE:-/tmp/scanfile} | 9 | scanfile=${SCANFILE:-/tmp/scanfile} |
| 10 | pid="$1" | 10 | pid="$1" |
| 11 | watch -d -n 1 "xargs -r -a ${scanfile} ./hack.out ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out" | 11 | watch -d -n 1 "xargs -r -a ${scanfile} ./trainer ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out" |
diff --git a/scripts/scan.sh b/scripts/scan.sh index c700011..bb4f77c 100644 --- a/scripts/scan.sh +++ b/scripts/scan.sh | |||
| @@ -25,7 +25,7 @@ while true | |||
| 25 | do | 25 | do |
| 26 | read -p "Scan pattern (hex): " pattern | 26 | read -p "Scan pattern (hex): " pattern |
| 27 | newscan=$(mktemp) | 27 | newscan=$(mktemp) |
| 28 | ./hack.out ${pid} scan ${pattern} > ${newscan} 2> /dev/null | 28 | ./trainer ${pid} scan ${pattern} > ${newscan} 2> /dev/null |
| 29 | if [ ! -f ${scanfile} ] | 29 | if [ ! -f ${scanfile} ] |
| 30 | then | 30 | then |
| 31 | mv ${newscan} ${scanfile} | 31 | mv ${newscan} ${scanfile} |
| @@ -80,7 +80,6 @@ void action_write(int pid, int argc, const char *argv[]) | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | Bytes aob = hex2bytes(argv[0]); | 82 | Bytes aob = hex2bytes(argv[0]); |
| 83 | printf("%s\n", aob.data); | ||
| 84 | void *address[argc-1]; | 83 | void *address[argc-1]; |
| 85 | for (size_t i = 0; i < argc-1; ++i) { | 84 | for (size_t i = 0; i < argc-1; ++i) { |
| 86 | sscanf(argv[i+1], "%p", &address[i]); | 85 | sscanf(argv[i+1], "%p", &address[i]); |
