diff --git a/src/cr3473_5y563n.sh b/src/cr3473_5y563n.sh index 17d133d..1a1f56c 100755 --- a/src/cr3473_5y563n.sh +++ b/src/cr3473_5y563n.sh @@ -1,19 +1,32 @@ #!/usr/bin/env bash + SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" + SRCS_H="$SCRIPTPATH""/headers" + +SGENS="$SCRIPTPATH""/5y563n.c" SGENH="$SRCS_H""/5y563n.h" smap="/boot/System.map-$(uname -r)" +echo -e '#include "5y563n.h"' > "$SGENS" + echo -e "#pragma once" > "$SGENH" echo -e "#include " >> "$SGENH" + symbline=$(cat $smap | grep '\Wsys_call_table$') set $symbline + [ -z "$symbline" ] && echo "No SysCall Table Value from System.map found" && exit 2; -echo -e "void** sys_call_table = (void**)0x$1;" >> "$SGENH" + +echo -e "extern void** sys_call_table;" >> "$SGENH" + +echo -e "void** sys_call_table = (void**)0x$1;" >> "$SGENS" procline=$(cat $smap | grep '\Wproc_modules_operations$') set $procline -echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENH" \ No newline at end of file +echo -e "extern struct file_operations* proc_modules_operations;">> "$SGENH" + +echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENS" \ No newline at end of file