fscan/test/ssh-test-env/test-ssh-plugin.bat
ZacharyZcR de286026e8 refactor: 统一插件超时机制实现Context-First架构
- 重构SSH/MySQL/Redis插件超时控制,移除第三方库超时依赖
- 统一使用Go Context超时机制,提升超时控制可靠性和精确度
- 扩展MySQL/Redis/SSH插件默认端口支持,提升扫描覆盖率
- 修复插件系统中ConcurrentScanConfig超时配置缺失问题
- 优化插件检测逻辑,正确识别新架构插件并显示准确状态信息
- 解决插件在错误端口上长时间等待问题,显著提升扫描效率
2025-08-07 14:01:50 +08:00

93 lines
2.5 KiB
Batchfile

@echo off
echo ========================================
echo fscan SSH Plugin Test Script
echo ========================================
echo.
REM 检查Docker是否运行
docker version >nul 2>&1
if %errorlevel% neq 0 (
echo Error: Docker is not running or not installed
echo Please start Docker Desktop and try again
exit /b 1
)
echo Step 1: Starting SSH test environment...
docker-compose up -d
REM 等待容器启动
echo Waiting for SSH service to start...
timeout /t 10 /nobreak >nul
echo.
echo Step 2: Checking container status...
docker-compose ps
echo.
echo Step 3: Testing SSH connectivity...
echo Testing basic SSH connection (you may need to type 'yes' to accept host key)
echo Password for root user is: password
timeout /t 3 /nobreak >nul
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@localhost -p 2222 "echo 'SSH connection successful'; exit"
if %errorlevel% equ 0 (
echo SSH connection test passed!
) else (
echo SSH connection test failed. Checking logs...
docker-compose logs ssh-test-server
)
echo.
echo Step 4: fscan SSH plugin tests
echo.
REM 检查fscan是否存在
if not exist "..\..\fscan.exe" (
echo Warning: fscan.exe not found in project root
echo Please build fscan first: go build -o fscan.exe
echo.
echo Manual test commands:
echo fscan -h 127.0.0.1:2222 -m ssh
echo fscan -h 127.0.0.1:2222 -m ssh -user root -pwd password
echo fscan -h 127.0.0.1:2222 -m ssh -user admin -pwd 123456
goto :cleanup
)
echo Testing fscan SSH plugin...
echo.
echo Test 1: Basic SSH service detection
..\..\fscan.exe -h 127.0.0.1:2222 -m ssh -np
echo.
echo Test 2: SSH with specific credentials
..\..\fscan.exe -h 127.0.0.1:2222 -m ssh -user root -pwd password
echo.
echo Test 3: SSH with weak password detection
..\..\fscan.exe -h 127.0.0.1:2222 -m ssh -user admin -pwd 123456
echo.
echo Test 4: SSH brute force simulation (limited users)
..\..\fscan.exe -h 127.0.0.1:2222 -m ssh -userfile test-users.txt -pwdfile test-passwords.txt
:cleanup
echo.
echo ========================================
echo Test completed!
echo ========================================
echo.
echo Container is still running for manual testing.
echo.
echo Manual test commands:
echo ssh root@localhost -p 2222 ^(password: password^)
echo ssh admin@localhost -p 2222 ^(password: 123456^)
echo ssh test@localhost -p 2222 ^(password: test123^)
echo.
echo To stop the test environment:
echo docker-compose down
echo.
echo To view SSH server logs:
echo docker-compose logs -f ssh-test-server
echo.
pause