Skip to content

Commit eef574a

Browse files
authored
Merge pull request #1 from ahlyel-amine/structure
[init] structure
2 parents 82c369f + 4f6f0a9 commit eef574a

File tree

17 files changed

+201
-0
lines changed

17 files changed

+201
-0
lines changed

.github/workflows/checks.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: NORM AND FLAGS CHECKS
3+
4+
on:
5+
push:
6+
branches:
7+
- '*'
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
check-norm:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.12
23+
24+
- name: Install dependencies
25+
run: |
26+
pip install setuptools norminette
27+
28+
- name: Run norminette checks
29+
run: |
30+
norminette
31+
32+
make-with-flags:
33+
runs-on: ubuntu-latest
34+
needs: check-norm
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v2
38+
39+
- name: install docker-compose
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install -y make gcc
43+
44+
- name: Create Makefile for testing
45+
run: |
46+
echo -e 'SRCS= $(shell find . -type f -name "*.c")\nINCLUDES= $(shell find . -type f -name "*.h")\nOBJS= $(SRCS:.c=.o)\nCC= cc\nCFLAGS= -Wall -Wextra -Werror\nNAME= uniq_name_][\nall: $(NAME)\n$(NAME): $(OBJS)\n\t$(CC) $(OBJS) -o $(NAME)\n%.o: %.c $(INCLUDES)\n\t$(CC) $(CFLAGS) -c $< -o $@' > Makefile
47+
- name: Run Services
48+
run: |
49+
make

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
INCLUDES = -Iinclude
3+
OBJ_DIR = obj
4+
CFLAGS = -Wall -Wextra -Werror
5+
NAME = lsse
6+
SRC = $(shell find src/ -type f -name "*.c")
7+
CC = gcc
8+
OBJ = $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRC))
9+
DEPS = $(patsubst %.c, $(OBJ_DIR)/%.d, $(SRC))
10+
DEPSFLAGS = -MMD -MP
11+
HBLU = '\e[1;94m'
12+
NC = '\e[0m'
13+
14+
all : $(NAME)
15+
16+
$(NAME) : $(OBJ)
17+
$(CC) $(OBJ) -o $(NAME)
18+
19+
$(OBJ_DIR)/%.o : %.c include/
20+
mkdir -p $(dir $@)
21+
printf $(HBLU)"[%-37s] 🕝 \r"$(NC) "Compiling $(notdir $@)"
22+
$(CC) $(CFLAGS) $(DEPSFLAGS) ${INCLUDES} -c $< -o $@
23+
24+
clean :
25+
rm -rf $(OBJ_DIR)
26+
27+
fclean : clean
28+
rm -rf $(NAME)
29+
30+
re : fclean all
31+
32+
.PHONY : clean fclean all bonus
33+
34+
-include : $(DEPS)
35+
36+
.SILENT : $(NAME) clean fclean all ${OBJ}

config/config.lsse

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[log_files]
2+
auth_log = /var/log/auth.log
3+
syslog = /var/log/syslog
4+
5+
[network]
6+
interface = eth0
7+
8+
[alerts]
9+
email = saba@main.com
10+
11+
[rules]
12+
ssh_attempts = 5

include/config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef CONFIG_H
2+
# define CONFIG_H
3+
# include <stdbool.h>
4+
5+
bool load_config(char *conf);
6+
7+
#endif

include/detection.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef DETECTION_H
2+
# define DETECTION_H
3+
4+
void detect_intrusions(void);
5+
6+
#endif

include/init.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef INIT_H
2+
# define INIT_H
3+
4+
void initialize(void);
5+
6+
7+
#endif

include/log_monitor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef LOG_MONITOR_H
2+
# define LOG_MONITOR_H
3+
4+
void monitor_logs(void);
5+
6+
#endif

include/net_monitor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef NET_MONITOR_H
2+
#define NET_MONITOR_H
3+
4+
void monitor_network(void);
5+
6+
#endif

include/report.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef REPORT_H
2+
#define REPORT_H
3+
4+
void generate_report(void);
5+
6+
#endif

logs/basic-logs.logs

Whitespace-only changes.

0 commit comments

Comments
 (0)