execve_hook/src/exec_hook.h

51 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef EXEC_HOOK_H
#define EXEC_HOOK_H
#define _GNU_SOURCE
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <json-c/json.h>
#include <pty.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/select.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "struct.h"
#define CONFIG_FILE "/tmp/exec_hook/config/execve_rules.json"
#define COMMAND_NOT_FOUND "/usr/lib/command-not-found"
#ifdef DEBUG //如果是debug模式在本地目录生成log方便debug
#define LOG_FILE "./logs/execve.log"
#define LOG_OUT_FILE "./logs/execve_out.log"
#else
#define LOG_FILE "/tmp/exec_hook/logs/execve.log"
#define LOG_OUT_FILE "/tmp/exec_hook/logs/execve_out.log"
#endif
#define ANSI_COLOR_RED "\033[31m"
#define ANSI_COLOR_YELLOW "\033[33m"
#define ANSI_COLOR_RESET "\033[0m"
#define SHM_KEY 12345
// Global variable, pointing to the configuration data in shared memory
extern ConfigData *shared_config;
extern int shm_id;
extern time_t last_modified_time;
// extern int is_initialized;
#endif // EXEC_HOOK_H