]> Projects - linux-game-trainer.git/commitdiff Test
Small changes to the Makefile and the scripts
authorOrfeas <redacted>
Tue, 23 Apr 2024 16:38:50 +0000 (19:38 +0300)
committerOrfeas <redacted>
Tue, 23 Apr 2024 16:38:50 +0000 (19:38 +0300)
Makefile
run.sh
scripts/read.sh
scripts/scan.sh
src/main.c

index 844cc7b61fef87d8275720cd01f500570569cb43..a567d0bdfbda7fda4318e31306b33be48864c911 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 CC = gcc
 CFLAGS = -Wall -g
 OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
-OUT = hack.out
+OUT = trainer
 
 $(OUT): $(OBJS) 
        $(CC) $(CFLAGS) -o $@ $(OBJS)
diff --git a/run.sh b/run.sh
index 6de589798e504fec3666b5220dc64bdc1f6efb07..c0d4886cc21aa9cdd6bab9f055a3e5bd05f8fc82 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -6,5 +6,18 @@ then
     exit 1
 fi
 
-gnome-terminal -- bash ./scripts/scan.sh "$1"
-gnome-terminal -- bash ./scripts/read.sh "$1"
+if [ ! $(cat /proc/sys/kernel/yama/ptrace_scope) -eq 0 ]
+then
+       echo "ptrace_scope is not set to 0 and ptrace attach will subsequently fail
+       To solve this issue you can run the following command:
+
+       echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope"
+       exit 1
+fi
+
+TERM_EMU=gnome-terminal
+
+# The syntax for the startup command may differ per terminal emulator.
+make && \
+${TERM_EMU} -- bash ./scripts/scan.sh "$1" && \
+${TERM_EMU} -- bash ./scripts/read.sh "$1"
index 38535e6f5b696fa6edf8ad37c53959243b819428..f26ba113ca1a4a692ee04996db814e3e1e98b53a 100644 (file)
@@ -8,4 +8,4 @@ fi
 
 scanfile=${SCANFILE:-/tmp/scanfile}
 pid="$1"
-watch -d -n 1 "xargs -r -a ${scanfile} ./hack.out ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out"
+watch -d -n 1 "xargs -r -a ${scanfile} ./trainer ${pid} read 8 > /tmp/out 2> /dev/null && pr -t -m ${scanfile} /tmp/out"
index c7000113688474cfd9706708dad7225489867730..bb4f77c0191c3086a615ff8968a17722f362938e 100644 (file)
@@ -25,7 +25,7 @@ while true
 do
     read -p "Scan pattern (hex): " pattern
     newscan=$(mktemp)
-    ./hack.out ${pid} scan ${pattern} > ${newscan} 2> /dev/null
+    ./trainer ${pid} scan ${pattern} > ${newscan} 2> /dev/null
     if [ ! -f ${scanfile} ]
     then
        mv ${newscan} ${scanfile}
index 623d767df36367dcf85450dc9c2f6a44f99e21c0..efc30d33e8543e17ec865d1da8a13c50b4c0bc6b 100644 (file)
@@ -80,7 +80,6 @@ void action_write(int pid, int argc, const char *argv[])
   }
 
   Bytes aob = hex2bytes(argv[0]);
-  printf("%s\n", aob.data);
   void *address[argc-1];
   for (size_t i = 0; i < argc-1; ++i) {
     sscanf(argv[i+1], "%p", &address[i]);