|
| 1 | +@echo off |
| 2 | +REM Cleanup script for DeadNet Attacker build artifacts |
| 3 | +REM This removes all build-related temporary files and folders |
| 4 | + |
| 5 | +REM Change to the script's directory |
| 6 | +cd /d "%~dp0" |
| 7 | + |
| 8 | +echo. |
| 9 | +echo ======================================== |
| 10 | +echo DeadNet Attacker - Build Cleanup |
| 11 | +echo ======================================== |
| 12 | +echo. |
| 13 | +echo This will remove all build artifacts: |
| 14 | +echo - build/ folder |
| 15 | +echo - dist/ folder |
| 16 | +echo - __pycache__/ folders |
| 17 | +echo - *.pyc files |
| 18 | +echo - *.pyo files |
| 19 | +echo - *.spec backup files |
| 20 | +echo - PyInstaller cache |
| 21 | +echo. |
| 22 | +echo NOTE: venv/ folder will NOT be removed |
| 23 | +echo. |
| 24 | +echo Current directory: %CD% |
| 25 | +echo. |
| 26 | + |
| 27 | +choice /C YN /M "Do you want to proceed with cleanup" |
| 28 | +if %errorLevel% neq 1 ( |
| 29 | + echo. |
| 30 | + echo [*] Cleanup cancelled. |
| 31 | + pause |
| 32 | + exit /b 0 |
| 33 | +) |
| 34 | + |
| 35 | +echo. |
| 36 | +echo [*] Starting cleanup... |
| 37 | +echo. |
| 38 | + |
| 39 | +REM Remove build folder |
| 40 | +if exist "build" ( |
| 41 | + echo [+] Removing build/ folder... |
| 42 | + rmdir /s /q "build" 2>nul |
| 43 | + if %errorLevel% equ 0 ( |
| 44 | + echo [+] build/ removed successfully |
| 45 | + ) else ( |
| 46 | + echo [!] Could not remove build/ folder |
| 47 | + ) |
| 48 | +) else ( |
| 49 | + echo [-] build/ folder not found |
| 50 | +) |
| 51 | + |
| 52 | +REM Remove dist folder |
| 53 | +if exist "dist" ( |
| 54 | + echo [+] Removing dist/ folder... |
| 55 | + rmdir /s /q "dist" 2>nul |
| 56 | + if %errorLevel% equ 0 ( |
| 57 | + echo [+] dist/ removed successfully |
| 58 | + ) else ( |
| 59 | + echo [!] Could not remove dist/ folder |
| 60 | + ) |
| 61 | +) else ( |
| 62 | + echo [-] dist/ folder not found |
| 63 | +) |
| 64 | + |
| 65 | +REM Remove __pycache__ folders |
| 66 | +echo [+] Removing __pycache__/ folders... |
| 67 | +for /d /r . %%d in (__pycache__) do @if exist "%%d" ( |
| 68 | + echo [+] Removing: %%d |
| 69 | + rmdir /s /q "%%d" 2>nul |
| 70 | +) |
| 71 | + |
| 72 | +REM Remove .pyc files |
| 73 | +echo [+] Removing .pyc files... |
| 74 | +del /s /q *.pyc 2>nul |
| 75 | +if %errorLevel% equ 0 ( |
| 76 | + echo [+] .pyc files removed |
| 77 | +) |
| 78 | + |
| 79 | +REM Remove .pyo files |
| 80 | +echo [+] Removing .pyo files... |
| 81 | +del /s /q *.pyo 2>nul |
| 82 | +if %errorLevel% equ 0 ( |
| 83 | + echo [+] .pyo files removed |
| 84 | +) |
| 85 | + |
| 86 | +REM Remove .spec backup files (but keep DeadNet.spec!) |
| 87 | +echo [+] Removing .spec backup files... |
| 88 | +if exist "*.spec.bak" ( |
| 89 | + del /q *.spec.bak 2>nul |
| 90 | + echo [+] .spec backup files removed |
| 91 | +) else ( |
| 92 | + echo [-] No .spec backup files found |
| 93 | +) |
| 94 | + |
| 95 | +REM Remove PyInstaller cache |
| 96 | +if exist "%LOCALAPPDATA%\pyinstaller" ( |
| 97 | + echo [+] Removing PyInstaller cache... |
| 98 | + rmdir /s /q "%LOCALAPPDATA%\pyinstaller" 2>nul |
| 99 | + if %errorLevel% equ 0 ( |
| 100 | + echo [+] PyInstaller cache removed |
| 101 | + ) |
| 102 | +) |
| 103 | + |
| 104 | +echo. |
| 105 | +echo ======================================== |
| 106 | +echo [SUCCESS] Cleanup completed! |
| 107 | +echo ======================================== |
| 108 | +echo. |
| 109 | +echo Build artifacts have been removed. |
| 110 | +echo Your venv/ folder remains intact. |
| 111 | +echo You can now run build_exe.cmd for a fresh build. |
| 112 | +echo. |
| 113 | +pause |
0 commit comments