Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Bruteforcer Alert

Detect failed connections and notify you with the IP of the person attempting to hack/connect to your PC. This script only works on Windows.
Detect failed connection attempts and get notified with the IP address of the person trying to hack/connect to your PC. This script works only on Windows.

![Capture d'écran 2023-10-25 205813](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/3e607aa6-547b-4b40-9066-1641330c7e6b)
![Screenshot 2023-10-25 205813](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/3e607aa6-547b-4b40-9066-1641330c7e6b)

## How to Set Up (A Little Bit Long)
## How to Set Up (A Bit Long)

### Step 1: Download and Extract Files

Expand All @@ -19,9 +19,9 @@ Detect failed connections and notify you with the IP of the person attempting to

### Step 3: Configure Local Group Policy

1. Open Local Group Policy Editor (Win + R > `gpedit.msc`).
1. Open the Local Group Policy Editor (Win + R > `gpedit.msc`).
2. Navigate to: `Windows settings > Security settings > Advanced Audit Policy Configuration > System Audit Policies > Logon/Logoff`.
3. Double-click on `Audit Logon` and configure as follows:
3. Double-click on `Audit Logon` and configure it as follows:
- Select "Configure the following audit events:"
- Check both "Success" and "Failure".

Expand All @@ -38,7 +38,7 @@ Detect failed connections and notify you with the IP of the person attempting to
#### Triggers Tab

1. Click "New".
2. Configure as follows:
2. Configure it as follows:
- Begin the task: "On an event".
- Log: "Security".
- Source: "Microsoft Windows security auditing".
Expand All @@ -49,7 +49,7 @@ Detect failed connections and notify you with the IP of the person attempting to
#### Actions Tab

1. Click "New".
2. Configure as follows:
2. Configure it as follows:
- Action: "Start a program".
- Program/script: Browse to `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`.
- Add arguments: Add the path to your `bruteforcealert.bat` file.
Expand Down Expand Up @@ -79,4 +79,4 @@ To test the setup:

### Enjoy!

If you encounter any issues or have suggestions for improvement, feel free to open an issue on GitHub.
If you encounter any issues or have suggestions for improvement, feel free to open an issue on GitHub.
78 changes: 78 additions & 0 deletions READMEFR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Alerte Bruteforcer

Détectez les tentatives de connexion échouées et recevez une notification avec l'adresse IP de la personne essayant de pirater/se connecter à votre PC. Ce script fonctionne uniquement sur Windows.

![Capture d'écran 2023-10-25 205813](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/3e607aa6-547b-4b40-9066-1641330c7e6b)

## Comment configurer (un peu long)

### Étape 1 : Télécharger et extraire les fichiers

1. Téléchargez et extrayez le package `Bruteforcer_Alert`.
2. Trouvez `bruteforcealert.ps1` et `bruteforcealert.bat` dans le répertoire `ps1_file/English` ou `ps1_file/French`.

### Étape 2 : Modifier le fichier .bat

1. Modifiez le fichier `bruteforcealert.bat` pour ajouter le chemin vers votre fichier `bruteforcealert.ps1`.

![Modifier le fichier .bat](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/af9555da-e4f2-49fb-b71e-4dd9ba65c87c)

### Étape 3 : Configurer la stratégie de groupe locale

1. Ouvrez l'éditeur de stratégie de groupe locale (Win + R > `gpedit.msc`).
2. Naviguez jusqu'à : `Paramètres Windows > Paramètres de sécurité > Configuration avancée des stratégies d'audit > Stratégies d'audit du système > Connexion/Déconnexion`.
3. Double-cliquez sur `Audit des connexions` et configurez-le comme suit :
- Sélectionnez "Configurer les événements d'audit suivants :"
- Cochez à la fois "Succès" et "Échec".

### Étape 4 : Configurer le Planificateur de tâches

1. Ouvrez le Planificateur de tâches et cliquez sur "Créer une tâche".
2. Suivez les étapes ci-dessous pour configurer la tâche :

#### Onglet Général

![Onglet Général](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/7580eb5d-8c6d-4fde-ab41-66a37fad0824)
- Assurez-vous que le nom est rempli dans les deux zones encerclées.

#### Onglet Déclencheurs

1. Cliquez sur "Nouveau".
2. Configurez-le comme suit :
- Commencer la tâche : "Lorsqu'un événement est enregistré".
- Journal : "Sécurité".
- Source : "Microsoft Windows security auditing".
- ID de l'événement : `4625`.

![Onglet Déclencheurs](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/b9d15676-7fb1-4cb3-8952-1be568cb1c21)

#### Onglet Actions

1. Cliquez sur "Nouveau".
2. Configurez-le comme suit :
- Action : "Démarrer un programme".
- Programme/script : Parcourez jusqu'à `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`.
- Ajouter des arguments : Ajoutez le chemin vers votre fichier `bruteforcealert.bat`.

![Onglet Actions](https://github.com/Yudaol/Bruteforcer_Alert/assets/92973701/d1403dbe-8b8d-43f3-adad-cb19d43ce1bf)

#### Activation du script

1. Faites un clic droit sur l'un des fichiers, allez dans Propriétés et sélectionnez Débloquer.
2. Faites de même avec l'autre fichier.
3. Ouvrez PowerShell en tant qu'administrateur.
4. Tapez ensuite : et appuyez sur la touche demandée pour oui
```
Set-ExecutionPolicy RemoteSigned
```

### Test

Pour tester la configuration :
1. Activez la connexion Bureau à distance dans les paramètres.
2. Depuis un autre PC, utilisez l'application Connexion Bureau à distance pour tenter une connexion avec le nom d'utilisateur correct mais un mot de passe incorrect.
3. Les deux PC doivent être sur le même réseau.

### Profitez !

Si vous rencontrez des problèmes ou avez des suggestions d'amélioration, n'hésitez pas à ouvrir un ticket sur GitHub.
2 changes: 1 addition & 1 deletion bruteforcealerte.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
powershell.exe -Command "Start-Process powershell.exe -Verb runAs -ArgumentList '-File PATH-TO-bruteforcealert.ps1'"
powershell.exe -Command "Start-Process powershell.exe -Verb runAs -ArgumentList '-File PATH\TO\bruteforcealert.ps1'"
19 changes: 15 additions & 4 deletions ps1_file/English/bruteforcealert.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Retrieve the latest failed logon event (EventID 4625)
$event = Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4625]]" -MaxEvents 1
$ipAdresse = $event.Message -replace ".+Adresse réseau source :\s+(\S+).+", "`$1"
Add-Type -AssemblyName PresentationCore, PresentationFramework;
$message = "Brute Force attack detected.`nIP Adresse of the hunter pc : $ipAdresse"; $title = "Security Alert";
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"); [System.Windows.Forms.MessageBox]::Show($message, $title, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation);

# Extract the attacker's IP address from the event message
$ipAddress = $event.Message -replace ".+Source Network Address:\s+(\S+).+", "`$1"

# Load the necessary assemblies to display a dialog box
Add-Type -AssemblyName PresentationCore, PresentationFramework

# Define the alert message and the dialog box title
$message = "Brute Force attack detected.`nIP Address of the attacking PC: $ipAddress"
$title = "Security Alert"

# Display the dialog box with the alert message
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show($message, $title, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation)
19 changes: 15 additions & 4 deletions ps1_file/Francais/bruteforcealert.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
$event = Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4625]]" -MaxEvents 1
# Récupérer le dernier événement de validation des informations d'identification (EventID 4625) ou 4776 pour Credentials Validation
$event = Get-WinEvent -LogName Security -FilterXPath "*[System[EventID=4776]]" -MaxEvents 1

# Extraire l'adresse IP de l'attaquant à partir du message de l'événement
$ipAdresse = $event.Message -replace ".+Adresse réseau source :\s+(\S+).+", "`$1"
Add-Type -AssemblyName PresentationCore, PresentationFramework;
$message = "Tentative d'attaque par force brute detectee.`nAdresse IP de l'attaquant : $ipAdresse"; $title = "Alerte de securite";
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"); [System.Windows.Forms.MessageBox]::Show($message, $title, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation);

# Charger les bibliothèques nécessaires pour afficher une boîte de dialogue
Add-Type -AssemblyName PresentationCore, PresentationFramework

# Définir le message d'alerte et le titre de la boîte de dialogue
$message = "Tentative d'attaque par force brute detectee.`nAdresse IP de l'attaquant : $ipAdresse"
$title = "Alerte de securite"

# Afficher la boîte de dialogue avec le message d'alerte
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.MessageBox]::Show($message, $title, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation)