I was using https://github.com/croemheld/lkm-rootkit
with the following tree under pwd
├── LICENSE
├── Makefile
├── README.md
└── src
├── core.c
├── getdents_hook.c
├── headers
│ ├── core.h
│ ├── getdents_hook.h
│ ├── module_hiding.h
│ ├── network_keylog.h
│ ├── packet_hiding.h
│ ├── port_knocking.h
│ ├── privilege_escalation.h
│ ├── server.h
│ └── socket_hiding.h
├── include
│ ├── headers
│ │ └── utils.h -->this is where the error happens
│ └── utils.c
├── libs
│ ├── headers
│ │ └── syscalltable.h
│ └── syscalltable.c
├── module_hiding.c
├── network_keylog.c
├── packet_hiding.c
├── port_knocking.c
├── privilege_escalation.c
├── server.c
└── socket_hiding.c
6 directories, 25 files
----------------------------------------------------------
with the following Makefile
# Module name
ROOTKIT := rootkit
# Build
MODULEDIR := /lib/modules/$(shell uname -r)
BUILDDIR := $(MODULEDIR)/build
KERNELDIR := $(MODULEDIR)/kernel
# Source files
SRCS_S := src
LIBS_S := src/libs
INCL_S := src/include
# Header files
SRCS_H := $(shell pwd)/$(SRCS_S)/headers
LIBS_H := $(shell pwd)/$(LIBS_S)/headers
INCL_H := $(shell pwd)/$(INCL_S)/headers
# Module
obj-m := $(ROOTKIT).o
# Core
$(ROOTKIT)-y += src/core.o
# Source
$(ROOTKIT)-y += src/server.o
$(ROOTKIT)-y += src/network_keylog.o
$(ROOTKIT)-y += src/getdents_hook.o
$(ROOTKIT)-y += src/socket_hiding.o
$(ROOTKIT)-y += src/packet_hiding.o
$(ROOTKIT)-y += src/port_knocking.o
$(ROOTKIT)-y += src/privilege_escalation.o
$(ROOTKIT)-y += src/module_hiding.o
# Libs
$(ROOTKIT)-y += src/libs/syscalltable.o
# Include
$(ROOTKIT)-y += src/include/utils.o
ccflags-y := -I$(SRCS_H) -I$(LIBS_H) -I$(INCL_H)
subdir-ccflags-y := -I$(SRCS_H) -I$(LIBS_H) -I$(INCL_H)
# Recipes
all: print_file_vars
$(MAKE) -C $(BUILDDIR) M=$(shell pwd) modules
load:
insmod $(KERNELDIR)/net/ipv4/netfilter/nf_reject_ipv4.ko
insmod $(KERNELDIR)/net/ipv6/netfilter/nf_reject_ipv6.ko
insmod rootkit.ko
clean:
$(MAKE) -C $(BUILDDIR) M=$(shell pwd) clean
print_file_vars:
$(foreach v, $(.VARIABLES), $(info $(v) = $($(v))))
But when I sudo make,there is an error:
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-106-generic'
CC [M] /home/eric/Code/linux/module/lkm-rootkit/src/core.o /home/eric/Code/linux/module/lkm-rootkit/src/core.c:1:19: fatal error: utils.h: No such file or directory compilation terminated.
However ccflags-y has been set,include path has been add to ccflags-y,can someone help me,mercy