文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>转来的一个接口劫持驱动

转来的一个接口劫持驱动

时间:2006-10-23  来源:火鸡

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <asm/semaphore.h>

DECLARE_MUTEX(test_lock);

MODULE_LICENSE("GPL");

static char old_code[5];
static char ret_code[] = {0xE9,0x00,0x00,0x00,0x00};//jmp 到我们的代码

void (*old_free_module)(struct module *mod);

void my_free_module(struct module *mod)
{
 down(&test_lock);
 memcpy(old_free_module,old_code,5);
 printk("no,i do't want to free module %s\n",mod->name);
 old_free_module(mod);
 memcpy(old_free_module,ret_code,5);
 up(&test_lock);
}
int test_init(void)
{
 long *p = &ret_code[1];
 long offset;
 old_free_module = kallsyms_lookup_name("free_module");
 if(!old_free_module)
  return -1;
 
 offset = my_free_module - old_free_module;
 if(offset>0)
  *p = offset - 5;

 printk("%lx\n",*p);
 memcpy(old_code,old_free_module,5);
 memcpy(old_free_module,ret_code,5);
 return 0;
}
void test_exit(void)
{
 memcpy(old_free_module,old_code,5);
}
module_init(test_init);
module_exit(test_exit);
相关阅读 更多 +
排行榜 更多 +
狂热战车

狂热战车

飞行射击 下载
士兵和小鸡

士兵和小鸡

飞行射击 下载
西部枪射击目标

西部枪射击目标

飞行射击 下载