#!/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 "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 "extern struct file_operations* proc_modules_operations;">> "$SGENH" echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENS"