aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrfeas <38209077+0xfea5@users.noreply.github.com>2024-04-23 19:38:50 +0300
committerOrfeas <38209077+0xfea5@users.noreply.github.com>2024-04-23 19:38:50 +0300
commit6bf809731abfd1893e73f6c6b35d0a22dacd6fb2 (patch)
tree2badb20131925d49384ae4f81924f02bcff58617
parentAdded the presentation (diff)
downloadlinux-game-trainer-6bf809731abfd1893e73f6c6b35d0a22dacd6fb2.tar.gz
linux-game-trainer-6bf809731abfd1893e73f6c6b35d0a22dacd6fb2.zip
Small changes to the Makefile and the scripts
-rw-r--r--Makefile2
-rwxr-xr-xrun.sh17
-rw-r--r--scripts/read.sh2
-rw-r--r--scripts/scan.sh2
-rw-r--r--src/main.c1
5 files changed, 18 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 844cc7b..a567d0b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1CC = gcc 1CC = gcc
2CFLAGS = -Wall -g 2CFLAGS = -Wall -g
3OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c)) 3OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
4OUT = hack.out 4OUT = trainer
5 5
6$(OUT): $(OBJS) 6$(OUT): $(OBJS)
7 $(CC) $(CFLAGS) -o $@ $(OBJS) 7 $(CC) $(CFLAGS) -o $@ $(OBJS)
diff --git a/run.sh b/run.sh
index 6de5897..c0d4886 100755
--- a/run.sh
+++ b/run.sh
@@ -6,5 +6,18 @@ then
6 exit 1 6 exit 1
7fi 7fi
8 8
9gnome-terminal -- bash ./scripts/scan.sh "$1" 9if [ ! $(cat /proc/sys/kernel/yama/ptrace_scope) -eq 0 ]
10gnome-terminal -- bash ./scripts/read.sh "$1" 10then
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
16fi
17
18TERM_EMU=gnome-terminal
19
20# The syntax for the startup command may differ per terminal emulator.
21make && \
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
9scanfile=${SCANFILE:-/tmp/scanfile} 9scanfile=${SCANFILE:-/tmp/scanfile}
10pid="$1" 10pid="$1"
11watch -d -n 1 "xargs -r -a ${scanfile} ./hack.out ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out" 11watch -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
25do 25do
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}
diff --git a/src/main.c b/src/main.c
index 623d767..efc30d3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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]);