GotExx 1 year ago
parent
commit
a47ae73414

BIN
.new-check-empreintes.sh.swp View File


+ 18
- 6
calcul-empreintes-hids.sh View File

@@ -5,10 +5,22 @@
5 5
 ##   HIDS By GotExx  ##
6 6
 ##                   ##
7 7
 #######################
8
-
9
-path=/home/gotexx/sites/wordpress
8
+NC='\033[0m'
9
+current_datetime=$(date +%D-%T)
10
+path=/home/hugo/sites/wordpress
10 11
 text_file=$1
11
-for line in $(cat $text_file);
12
-do 
13
-	sha1sum $path/$line >> ./checkedfile.checksum		
14
-done 
12
+if [ -d $path ];then
13
+	for line in $(cat $text_file);
14
+	do 
15
+		if [ -f $path/$line ];then
16
+			sha1sum $path/$line > ./checkedfile.checksum
17
+		elif [ -d $path/$line ];then
18
+			echo "$path/$line n'est pas un fichier valide"
19
+		else
20
+			echo "erreur NC"
21
+		fi
22
+	done
23
+	echo -e "Empreintes calculées."
24
+else
25
+	echo -e "Chemin inconnu"
26
+fi

+ 28
- 0
calcul-empreintes-hids.sh~ View File

@@ -0,0 +1,28 @@
1
+#!/bin/bash
2
+
3
+#######################
4
+##                   ##
5
+##   HIDS By GotExx  ##
6
+##                   ##
7
+#######################
8
+RED='\033[0;31m'
9
+GREEN='\033[0;32m'
10
+NC='\033[0m'
11
+current_datetime=$(date +%D-%T)
12
+path=/home/hugo/sites/wordpress
13
+text_file=$1
14
+if [ -d $path ];then
15
+	for line in $(cat $text_file);
16
+	do 
17
+		if [ -f $path/$line ];then
18
+			sha1sum $path/$line > ./checkedfile.checksum
19
+		elif [ -d $path/$line ];then
20
+			echo "$path/$line n'est pas un fichier valide"
21
+		else
22
+			echo "erreur NC"
23
+		fi
24
+	done
25
+	echo -e "${GREEN}Empreintes calculées.${NC}"
26
+else
27
+	echo -e "${RED}Chemin inconnu${NC}"
28
+fi

+ 1
- 3
checkedfile.checksum View File

@@ -1,3 +1 @@
1
-85a683557e80c178c0da587c6efd149b8c6c6d7e  /home/gotexx/sites/wordpress/wp-config.php
2
-db17ba0f8f48f5ce80e5daac59f6b78176b5f59c  /home/gotexx/sites/wordpress/wp-settings.php
3
-7373ba8fb55183f59ce6b5816eeb5607826386c8  /home/gotexx/sites/wordpress/wp-login.php
1
+e7d0d3165abc87c1f60be176db6f57f9dcfcce89  /home/hugo/sites/wordpress/wp-config.php

+ 1
- 0
file.txt View File

@@ -0,0 +1 @@
1
+wp-config.php

+ 0
- 3
files.txt View File

@@ -1,3 +0,0 @@
1
-wp-config.php
2
-wp-settings.php
3
-wp-login.php

+ 3
- 0
history.txt View File

@@ -0,0 +1,3 @@
1
+01/24/18-15:36:02 True
2
+01/24/18-15:36:04 True
3
+01/24/18-15:36:08 True

+ 6
- 4
new-check-empreintes.sh View File

@@ -6,7 +6,8 @@
6 6
 ##                   ##
7 7
 #######################
8 8
 
9
-path=/home/gotexx/sites/wordpress
9
+NC='\033[0m'
10
+path=/home/hugo/sites/wordpress
10 11
 check_file="checkedfile.checksum"
11 12
 new_check_file="new-checkedfile.checksum"
12 13
 text_file=$1
@@ -15,6 +16,7 @@ rm -f $new_check_file
15 16
 
16 17
 for line in $(cat $text_file);
17 18
 do
19
+	current_time=$(date +%D-%T)
18 20
 	sha1sum $path/$line  >> ./$new_check_file
19 21
 done
20 22
 
@@ -22,9 +24,9 @@ empreinte_file=`sha1sum $check_file`
22 24
 empreinte_new_file=`sha1sum $new_check_file`
23 25
 
24 26
 if [ `echo "$empreinte_file" | awk -F' ' {'print $1'}` != `echo "$empreinte_new_file" | awk -F' ' {'print $1'}`  ];then
25
-	echo "Attention les empreintes sont différentes!"
27
+	echo "$current_time : Attention les empreintes sont différentes !" >> history.txt
26 28
 elif [ `echo "$empreinte_file" | awk -F' ' {'print $1'}` == `echo "$empreinte_new_file" | awk -F' ' {'print $1'}` ];then
27
-	echo "Les empreintes sont valides."
29
+	echo "$current_time True" >> history.txt
28 30
 else
29
-	echo "Erreur lors de la vérification des empreintes"
31
+	echo "$current_time False" >> history.txt
30 32
 fi

+ 32
- 0
new-check-empreintes.sh~ View File

@@ -0,0 +1,32 @@
1
+#!/bin/bash
2
+
3
+#######################
4
+##                   ##
5
+##   HIDS By GotExx  ##
6
+##                   ##
7
+#######################
8
+
9
+NC='\033[0m'
10
+path=/home/hugo/sites/wordpress
11
+check_file="checkedfile.checksum"
12
+new_check_file="new-checkedfile.checksum"
13
+text_file=$1
14
+
15
+rm -f $new_check_file
16
+
17
+for line in $(cat $text_file);
18
+do
19
+	current_time=$(date +%D-%T)
20
+	sha1sum $path/$line  >> ./$new_check_file
21
+done
22
+
23
+empreinte_file=`sha1sum $check_file`
24
+empreinte_new_file=`sha1sum $new_check_file`
25
+
26
+if [ `echo "$empreinte_file" | awk -F' ' {'print $1'}` != `echo "$empreinte_new_file" | awk -F' ' {'print $1'}`  ];then
27
+	echo "$current_time : Attention les empreintes sont différentes !" >> history.txt
28
+elif [ `echo "$empreinte_file" | awk -F' ' {'print $1'}` == `echo "$empreinte_new_file" | awk -F' ' {'print $1'}` ];then
29
+	echo "$current_time = True" >> history.txt
30
+else
31
+	echo "$current_time = False" >> history.txt
32
+fi

+ 1
- 3
new-checkedfile.checksum View File

@@ -1,3 +1 @@
1
-85a683557e80c178c0da587c6efd149b8c6c6d7e  /home/gotexx/sites/wordpress/wp-config.php
2
-db17ba0f8f48f5ce80e5daac59f6b78176b5f59c  /home/gotexx/sites/wordpress/wp-settings.php
3
-7373ba8fb55183f59ce6b5816eeb5607826386c8  /home/gotexx/sites/wordpress/wp-login.php
1
+e7d0d3165abc87c1f60be176db6f57f9dcfcce89  /home/hugo/sites/wordpress/wp-config.php

Loading…
Cancel
Save