Actualiser Script/audit_sw.sh
This commit is contained in:
		
							
								
								
									
										77
									
								
								Script/audit_sw.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								Script/audit_sw.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,77 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Fonction pour vérifier si un service est installé et actif
 | 
			
		||||
check_service() {
 | 
			
		||||
    local service=$1
 | 
			
		||||
    if systemctl is-active --quiet "$service"; then
 | 
			
		||||
        echo "$service est actif"
 | 
			
		||||
    else
 | 
			
		||||
        if systemctl list-unit-files --type=service | grep -q "$service"; then
 | 
			
		||||
            echo "$service est installé mais inactif"
 | 
			
		||||
        else
 | 
			
		||||
            echo "$service n'est pas installé"
 | 
			
		||||
        fi
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Vérification des services Web courants
 | 
			
		||||
echo "=== Vérification des services Web ==="
 | 
			
		||||
check_service apache2
 | 
			
		||||
check_service httpd  # Pour les distributions Red Hat/CentOS
 | 
			
		||||
check_service nginx
 | 
			
		||||
check_service lighttpd
 | 
			
		||||
 | 
			
		||||
# Vérification des bases de données courantes
 | 
			
		||||
echo "=== Vérification des services de bases de données ==="
 | 
			
		||||
check_service mysql
 | 
			
		||||
check_service mariadb
 | 
			
		||||
check_service postgresql
 | 
			
		||||
 | 
			
		||||
# Vérification des serveurs FTP
 | 
			
		||||
echo "=== Vérification des services FTP ==="
 | 
			
		||||
check_service vsftpd
 | 
			
		||||
check_service proftpd
 | 
			
		||||
 | 
			
		||||
# Vérification des outils liés au développement web
 | 
			
		||||
echo "=== Vérification des outils courants de développement web ==="
 | 
			
		||||
if command -v php > /dev/null; then
 | 
			
		||||
    echo "PHP est installé : $(php -v | head -n 1)"
 | 
			
		||||
else
 | 
			
		||||
    echo "PHP n'est pas installé"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if command -v python > /dev/null; then
 | 
			
		||||
    echo "Python est installé : $(python --version)"
 | 
			
		||||
else
 | 
			
		||||
    echo "Python n'est pas installé"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if command -v node > /dev/null; then
 | 
			
		||||
    echo "Node.js est installé : $(node -v)"
 | 
			
		||||
else
 | 
			
		||||
    echo "Node.js n'est pas installé"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if command -v ruby > /dev/null; then
 | 
			
		||||
    echo "Ruby est installé : $(ruby -v)"
 | 
			
		||||
else
 | 
			
		||||
    echo "Ruby n'est pas installé"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Vérification des ports ouverts
 | 
			
		||||
echo "=== Vérification des ports ouverts ==="
 | 
			
		||||
ss -tuln | grep LISTEN
 | 
			
		||||
 | 
			
		||||
# Vérification des processus actifs
 | 
			
		||||
echo "=== Processus actifs liés au web ==="
 | 
			
		||||
ps aux | grep -E 'apache|nginx|lighttpd|mysql|mariadb|postgresql' | grep -v grep
 | 
			
		||||
 | 
			
		||||
# Vérification de l'espace disque disponible
 | 
			
		||||
echo "=== Espace disque disponible ==="
 | 
			
		||||
df -h
 | 
			
		||||
 | 
			
		||||
# Vérification des paquets installés liés au web
 | 
			
		||||
echo "=== Paquets installés liés au web ==="
 | 
			
		||||
dpkg -l | grep -E 'apache2|nginx|lighttpd|php|mysql|mariadb|postgresql|nodejs|ruby'
 | 
			
		||||
 | 
			
		||||
echo "=== Audit terminé ==="
 | 
			
		||||
		Reference in New Issue
	
	Block a user