100 lines
2.8 KiB
Batchfile
100 lines
2.8 KiB
Batchfile
@echo off
|
|
REM Set console to UTF-8 encoding to prevent garbled text on Chinese Windows systems
|
|
chcp 65001 >nul 2>&1
|
|
|
|
echo ========================================
|
|
echo MITM Proxy Server Functionality Demo
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Check for Administrator privileges
|
|
net session >nul 2>&1
|
|
if %errorLevel% neq 0 (
|
|
echo Error: Administrator privileges required!
|
|
echo Please right-click this script and select "Run as administrator"
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo ✅ Administrator privileges check passed
|
|
|
|
REM Check program file
|
|
if not exist "mitm.exe" (
|
|
echo ❌ mitm.exe not found, compiling...
|
|
go build -o mitm.exe .
|
|
if %errorLevel% neq 0 (
|
|
echo ❌ Compilation failed!
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo ✅ Compilation successful
|
|
) else (
|
|
echo ✅ Program file exists
|
|
)
|
|
|
|
REM Check configuration file
|
|
if not exist "config.toml" (
|
|
echo ❌ config.toml not found!
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo ✅ Configuration file exists
|
|
|
|
REM Create output directory
|
|
if not exist "traffic_dumps" mkdir traffic_dumps
|
|
echo ✅ Output directory created
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo Function Description
|
|
echo ========================================
|
|
echo 📡 HTTP/HTTPS Proxy: 127.0.0.1:8080
|
|
echo 📁 Traffic Dump Directory: traffic_dumps/
|
|
echo 🔍 Domains of Interest: Configure in config.toml
|
|
echo 🔐 HTTPS Decryption: Uses hardcoded certificates (if configured)
|
|
echo 📄 Full Data Output: Displayed without truncation
|
|
echo.
|
|
|
|
echo ========================================
|
|
echo Test Suggestions
|
|
echo ========================================
|
|
echo 1. After starting the program, visit: http://httpbin.org/get
|
|
echo 2. Visit: https://httpbin.org/get (Test HTTPS)
|
|
echo 3. Check files in traffic_dumps/ directory
|
|
echo 4. Observe the complete data output in the console
|
|
echo.
|
|
|
|
echo ========================================
|
|
echo Certificate Configuration Status
|
|
echo ========================================
|
|
findstr /C:"将您的cert.p12文件转换为base64字符串并粘贴在这里" cert_utils.go >nul
|
|
if %errorLevel% equ 0 (
|
|
echo ⚠️ P12 Certificate: Not configured (using self-signed certificate)
|
|
echo Please refer to certificate_guide.md to configure a real certificate
|
|
) else (
|
|
echo ✅ P12 Certificate: Configured
|
|
)
|
|
|
|
findstr /C:"将您的CA.crt文件内容粘贴在这里" cert_utils.go >nul
|
|
if %errorLevel% equ 0 (
|
|
echo ⚠️ CA Certificate: Not configured
|
|
) else (
|
|
echo ✅ CA Certificate: Configured
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo Start Program
|
|
echo ========================================
|
|
echo Program will start in 5 seconds...
|
|
echo Press Ctrl+C to stop the program
|
|
echo.
|
|
timeout /t 5 /nobreak >nul
|
|
|
|
echo Starting MITM proxy server...
|
|
echo.
|
|
mitm.exe
|
|
|
|
echo.
|
|
echo Program exited.
|
|
pause |