| Linux webm007.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 Path : /home/eglisebaa/ |
| Current File : /home/eglisebaa/nettoyage-index.php.sh |
#!/bin/bash
#
# Script de nettoyage de index.php
# Supprime le code malveillant et restaure le fichier propre
#
set -e
WP_ROOT="/home/eglisebaa/www"
INDEX_FILE="$WP_ROOT/index.php"
BACKUP_FILE="$WP_ROOT/index.php.backup-$(date +%Y%m%d-%H%M%S)"
echo "🔧 Nettoyage de index.php..."
# Vérifier que le fichier existe
if [ ! -f "$INDEX_FILE" ]; then
echo "❌ Erreur: index.php non trouvé"
exit 1
fi
# Créer une sauvegarde
echo "📦 Création d'une sauvegarde: $BACKUP_FILE"
cp "$INDEX_FILE" "$BACKUP_FILE"
# Créer le fichier index.php propre
cat > "$INDEX_FILE" << 'EOFPHP'
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
EOFPHP
echo "✅ index.php nettoyé avec succès"
echo "📋 Sauvegarde créée: $BACKUP_FILE"