Files
NeuroSploit/setup.bat
T

86 lines
3.2 KiB
Batchfile

@echo off
REM NeuroSploit installer for Windows (CMD) - by Joas A Santos & Red Team Leaders
REM
REM Double-click setup.bat and pick CLI, Web console or Everything, or run:
REM setup.bat cli | web | all [/y] [/build] [/nodeps] [/run]
REM
REM It runs install.ps1 (next to this file, or the published copy), which
REM installs what a fresh machine is missing with winget (Git, Node.js LTS,
REM Nmap, typst, build tools when compiling), downloads or builds the binary,
REM deploys the web console and sets PATH + NEUROSPLOIT_BASE for your user.
setlocal EnableExtensions
title NeuroSploit installer
echo.
echo NeuroSploit installer (Windows)
echo -------------------------------
where powershell >nul 2>&1
if errorlevel 1 (
echo [x] Windows PowerShell not found. Install PowerShell, or use WSL with setup.sh.
goto :fail
)
set "ARGS="
:parse
if "%~1"=="" goto :run
set "A=%~1"
if /i "%A%"=="cli" set "ARGS=%ARGS% -Mode cli"
if /i "%A%"=="--cli" set "ARGS=%ARGS% -Mode cli"
if /i "%A%"=="web" set "ARGS=%ARGS% -Mode web"
if /i "%A%"=="--web" set "ARGS=%ARGS% -Mode web"
if /i "%A%"=="all" set "ARGS=%ARGS% -Mode all"
if /i "%A%"=="--all" set "ARGS=%ARGS% -Mode all"
if /i "%A%"=="/y" set "ARGS=%ARGS% -Yes"
if /i "%A%"=="--yes" set "ARGS=%ARGS% -Yes"
if /i "%A%"=="/build" set "ARGS=%ARGS% -Build"
if /i "%A%"=="--build" set "ARGS=%ARGS% -Build"
if /i "%A%"=="/nodeps" set "ARGS=%ARGS% -NoDeps"
if /i "%A%"=="--no-deps" set "ARGS=%ARGS% -NoDeps"
if /i "%A%"=="/run" set "ARGS=%ARGS% -Run"
if /i "%A%"=="--run" set "ARGS=%ARGS% -Run"
if /i "%A%"=="/?" goto :help
if /i "%A%"=="-h" goto :help
if /i "%A%"=="--help" goto :help
shift
goto :parse
:run
REM Prefer the install.ps1 next to this file; otherwise download it to %TEMP% and run it as a file.
set "PS1=%~dp0install.ps1"
if not exist "%PS1%" (
echo Fetching installer from GitHub...
set "PS1=%TEMP%\neurosploit-install.ps1"
powershell -NoProfile -ExecutionPolicy Bypass -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/JoasASantos/NeuroSploit/main/install.ps1' -OutFile $env:TEMP\neurosploit-install.ps1"
if errorlevel 1 (
echo [x] Could not download install.ps1 - check your internet connection.
goto :fail
)
)
powershell -NoProfile -ExecutionPolicy Bypass -File "%PS1%" %ARGS%
set "RC=%ERRORLEVEL%"
echo.
if "%RC%"=="0" (
echo [ok] Done. Open a NEW terminal, then run: neurosploit or neurosploit-web --open
) else (
echo [x] Installer exited with code %RC%.
)
REM Keep the window open when launched by double-click.
echo %CMDCMDLINE% | find /i "/c" >nul && pause
endlocal & exit /b %RC%
:help
echo.
echo setup.bat [cli^|web^|all] [/y] [/build] [/nodeps] [/run]
echo cli CLI only
echo web web console + CLI
echo all everything (web console, CLI, recon tools) [default]
echo /y no questions
echo /build build from source instead of downloading
echo /nodeps do not install anything with winget
echo /run launch when done
endlocal & exit /b 0
:fail
echo %CMDCMDLINE% | find /i "/c" >nul && pause
endlocal & exit /b 1