CC = gcc
CFLAGS = -Wall -g
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
-OUT = hack.out
+OUT = trainer
$(OUT): $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS)
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"
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"
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}
}
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]);