couple-repo/network_diagnostic_ultimate.bat
StillHammer ab94be513d Add Chinese learning plan + Projects documentation + Tingting work
- couple_backlog/28_octobre_2025.md: Multi-vector plan (Tandem exchange + Aissia)
- couple_backlog/25_octobre_2025.md: Previous backlog entry
- Projects/aissia.md: AISSIA project with LanguageLearningModule integration
- Projects/chinese_audio_tts_pipeline.md, groveengine_framework.md, social_network_manager.md
- Projects/LeBonCoup/: Reorganized into folder
- WorkTingting/28_10_2025-parents/: Parent meeting presentation materials
- ToRemember/Japan_Conducts.md: Cultural notes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 19:36:03 +08:00

526 lines
21 KiB
Batchfile

@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: ═══════════════════════════════════════════════════════════════════
:: NETWORK DIAGNOSTIC ULTIMATE v1.0
:: Analyse complète réseau : Interfaces, VPN, DNS, Routes, Devices, Latency
:: ═══════════════════════════════════════════════════════════════════
set OUTPUT_DIR=%~dp0network_analysis
set TIMESTAMP=%date:~-4%%date:~3,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%
set TIMESTAMP=%TIMESTAMP: =0%
set REPORT=%OUTPUT_DIR%\network_report_%TIMESTAMP%.txt
set HTML_REPORT=%OUTPUT_DIR%\network_report_%TIMESTAMP%.html
:: Create output directory
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"
echo ╔════════════════════════════════════════════════════════════════╗
echo ║ NETWORK DIAGNOSTIC ULTIMATE - Starting... ║
echo ╚════════════════════════════════════════════════════════════════╝
echo.
echo [*] Output: %REPORT%
echo [*] HTML Report: %HTML_REPORT%
echo.
:: Start TXT report
(
echo ═══════════════════════════════════════════════════════════════════
echo NETWORK DIAGNOSTIC REPORT - %date% %time%
echo ═══════════════════════════════════════════════════════════════════
echo.
) > "%REPORT%"
:: Start HTML report
(
echo ^<!DOCTYPE html^>
echo ^<html^>
echo ^<head^>
echo ^<meta charset="UTF-8"^>
echo ^<title^>Network Diagnostic Report^</title^>
echo ^<style^>
echo body { font-family: 'Segoe UI', Tahoma, sans-serif; margin: 20px; background: #f5f5f5; }
echo .container { max-width: 1400px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
echo h1 { color: #2c3e50; border-bottom: 3px solid #3498db; padding-bottom: 10px; }
echo h2 { color: #34495e; margin-top: 30px; border-left: 4px solid #3498db; padding-left: 10px; }
echo h3 { color: #7f8c8d; margin-top: 20px; }
echo .info-box { background: #ecf0f1; padding: 15px; margin: 10px 0; border-radius: 5px; border-left: 4px solid #3498db; }
echo .success { border-left-color: #27ae60; background: #d5f4e6; }
echo .warning { border-left-color: #f39c12; background: #fef5e7; }
echo .error { border-left-color: #e74c3c; background: #fadbd8; }
echo pre { background: #2c3e50; color: #ecf0f1; padding: 15px; border-radius: 5px; overflow-x: auto; font-size: 12px; }
echo table { border-collapse: collapse; width: 100%%; margin: 15px 0; }
echo th, td { border: 1px solid #bdc3c7; padding: 10px; text-align: left; }
echo th { background: #34495e; color: white; }
echo tr:nth-child(even) { background: #ecf0f1; }
echo .badge { display: inline-block; padding: 4px 8px; border-radius: 3px; font-size: 11px; font-weight: bold; }
echo .badge-primary { background: #3498db; color: white; }
echo .badge-success { background: #27ae60; color: white; }
echo .badge-warning { background: #f39c12; color: white; }
echo .badge-danger { background: #e74c3c; color: white; }
echo .network-diagram { margin: 20px 0; padding: 20px; background: #fff; border: 2px solid #3498db; border-radius: 10px; }
echo .device { display: inline-block; padding: 10px 15px; margin: 5px; background: #3498db; color: white; border-radius: 5px; }
echo ^</style^>
echo ^</head^>
echo ^<body^>
echo ^<div class="container"^>
echo ^<h1^>🌐 Network Diagnostic Report^</h1^>
echo ^<p^>Generated: %date% %time%^</p^>
) > "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 1: SYSTEM INFORMATION
:: ═══════════════════════════════════════════════════════════════════
echo [1/15] Collecting System Information...
(
echo.
echo ═══ 1. SYSTEM INFORMATION ═══
echo.
systeminfo | findstr /C:"Host Name" /C:"OS Name" /C:"OS Version" /C:"System Type"
echo.
) >> "%REPORT%"
(
echo ^<h2^>1. System Information^</h2^>
echo ^<div class="info-box"^>
) >> "%HTML_REPORT%"
for /f "tokens=2 delims=:" %%a in ('systeminfo ^| findstr /C:"Host Name"') do (
echo ^<p^>^<strong^>Host Name:^</strong^> %%a^</p^> >> "%HTML_REPORT%"
)
for /f "tokens=2 delims=:" %%a in ('systeminfo ^| findstr /C:"OS Name"') do (
echo ^<p^>^<strong^>OS:^</strong^> %%a^</p^> >> "%HTML_REPORT%"
)
echo ^</div^> >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 2: NETWORK INTERFACES (DETAILED)
:: ═══════════════════════════════════════════════════════════════════
echo [2/15] Analyzing Network Interfaces...
(
echo.
echo ═══ 2. NETWORK INTERFACES (DETAILED) ═══
echo.
ipconfig /all
echo.
) >> "%REPORT%"
(
echo ^<h2^>2. Network Interfaces^</h2^>
echo ^<pre^>
ipconfig /all
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 3: ACTIVE CONNECTIONS
:: ═══════════════════════════════════════════════════════════════════
echo [3/15] Listing Active Connections...
(
echo.
echo ═══ 3. ACTIVE NETWORK CONNECTIONS ═══
echo.
netstat -ano | findstr ESTABLISHED
echo.
) >> "%REPORT%"
(
echo ^<h2^>3. Active Connections^</h2^>
echo ^<pre^>
netstat -ano | findstr ESTABLISHED
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 4: ROUTING TABLE
:: ═══════════════════════════════════════════════════════════════════
echo [4/15] Dumping Routing Table...
(
echo.
echo ═══ 4. ROUTING TABLE ═══
echo.
route print
echo.
) >> "%REPORT%"
(
echo ^<h2^>4. Routing Table^</h2^>
echo ^<pre^>
route print
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 5: ARP CACHE (Connected Devices)
:: ═══════════════════════════════════════════════════════════════════
echo [5/15] Checking ARP Cache (Local Devices)...
(
echo.
echo ═══ 5. ARP CACHE - LOCAL DEVICES ═══
echo.
arp -a
echo.
) >> "%REPORT%"
(
echo ^<h2^>5. Local Devices (ARP Cache^)^</h2^>
echo ^<div class="info-box warning"^>
echo ^<p^>Devices detected on your local network:^</p^>
echo ^</div^>
echo ^<pre^>
arp -a
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 6: DNS CONFIGURATION
:: ═══════════════════════════════════════════════════════════════════
echo [6/15] Analyzing DNS Configuration...
(
echo.
echo ═══ 6. DNS CONFIGURATION ═══
echo.
ipconfig /displaydns | more
echo.
nslookup google.com
echo.
nslookup baidu.com
echo.
) >> "%REPORT%"
(
echo ^<h2^>6. DNS Configuration^</h2^>
echo ^<h3^>DNS Test - google.com^</h3^>
echo ^<pre^>
nslookup google.com
echo ^</pre^>
echo ^<h3^>DNS Test - baidu.com^</h3^>
echo ^<pre^>
nslookup baidu.com
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 7: VPN DETECTION
:: ═══════════════════════════════════════════════════════════════════
echo [7/15] Detecting VPN Connections...
(
echo.
echo ═══ 7. VPN DETECTION ═══
echo.
echo --- RAS Connections ---
rasdial
echo.
echo --- Network Adapters (VPN Search) ---
ipconfig /all | findstr /I "VPN TAP Tunnel WireGuard OpenVPN"
echo.
echo --- PowerShell VPN Check ---
powershell -Command "Get-VpnConnection 2>$null | Format-Table Name, ConnectionStatus, ServerAddress"
echo.
) >> "%REPORT%"
(
echo ^<h2^>7. VPN Detection^</h2^>
echo ^<div class="info-box"^>
echo ^<h3^>Active VPN Connections^</h3^>
echo ^<pre^>
powershell -Command "Get-VpnConnection 2>$null | Format-Table Name, ConnectionStatus, ServerAddress"
echo ^</pre^>
echo ^<h3^>VPN Adapters^</h3^>
echo ^<pre^>
ipconfig /all | findstr /I "VPN TAP Tunnel WireGuard OpenVPN"
echo ^</pre^>
echo ^</div^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 8: GATEWAY DETECTION & PING
:: ═══════════════════════════════════════════════════════════════════
echo [8/15] Testing Gateway Connection...
:: Extract default gateway
for /f "tokens=3" %%a in ('route print ^| findstr "0.0.0.0"') do (
set GATEWAY=%%a
goto :gateway_found
)
:gateway_found
(
echo.
echo ═══ 8. GATEWAY DETECTION ═══
echo.
echo Default Gateway: %GATEWAY%
echo.
echo --- Ping Gateway ---
ping -n 4 %GATEWAY%
echo.
) >> "%REPORT%"
(
echo ^<h2^>8. Gateway Analysis^</h2^>
echo ^<div class="info-box success"^>
echo ^<p^>^<strong^>Default Gateway:^</strong^> %GATEWAY%^</p^>
echo ^</div^>
echo ^<h3^>Gateway Latency Test^</h3^>
echo ^<pre^>
ping -n 4 %GATEWAY%
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 9: INTERNET CONNECTIVITY TESTS
:: ═══════════════════════════════════════════════════════════════════
echo [9/15] Testing Internet Connectivity...
(
echo.
echo ═══ 9. INTERNET CONNECTIVITY TESTS ═══
echo.
echo --- Google DNS (8.8.8.8) ---
ping -n 4 8.8.8.8
echo.
echo --- Cloudflare DNS (1.1.1.1) ---
ping -n 4 1.1.1.1
echo.
echo --- Baidu (China) ---
ping -n 4 baidu.com
echo.
echo --- Google (International) ---
ping -n 4 google.com
echo.
) >> "%REPORT%"
(
echo ^<h2^>9. Internet Connectivity^</h2^>
echo ^<h3^>Google DNS (8.8.8.8^)^</h3^>
echo ^<pre^>
ping -n 4 8.8.8.8
echo ^</pre^>
echo ^<h3^>Cloudflare DNS (1.1.1.1^)^</h3^>
echo ^<pre^>
ping -n 4 1.1.1.1
echo ^</pre^>
echo ^<h3^>Baidu (baidu.com^)^</h3^>
echo ^<pre^>
ping -n 4 baidu.com
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 10: TRACEROUTE
:: ═══════════════════════════════════════════════════════════════════
echo [10/15] Running Traceroute...
(
echo.
echo ═══ 10. TRACEROUTE ANALYSIS ═══
echo.
echo --- Trace to Google (8.8.8.8) ---
tracert -d -h 15 8.8.8.8
echo.
echo --- Trace to Baidu ---
tracert -d -h 15 baidu.com
echo.
) >> "%REPORT%"
(
echo ^<h2^>10. Traceroute Analysis^</h2^>
echo ^<h3^>Route to Google DNS^</h3^>
echo ^<pre^>
tracert -d -h 15 8.8.8.8
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 11: OPEN PORTS
:: ═══════════════════════════════════════════════════════════════════
echo [11/15] Scanning Open Ports...
(
echo.
echo ═══ 11. OPEN PORTS (LISTENING) ═══
echo.
netstat -ano | findstr LISTENING
echo.
) >> "%REPORT%"
(
echo ^<h2^>11. Open Ports^</h2^>
echo ^<pre^>
netstat -ano | findstr LISTENING
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 12: WIRELESS INFO (IF WIFI)
:: ═══════════════════════════════════════════════════════════════════
echo [12/15] Collecting Wireless Information...
(
echo.
echo ═══ 12. WIRELESS INFORMATION ═══
echo.
netsh wlan show interfaces
echo.
echo --- Available WiFi Networks ---
netsh wlan show networks mode=bssid
echo.
echo --- Saved WiFi Profiles ---
netsh wlan show profiles
echo.
) >> "%REPORT%"
(
echo ^<h2^>12. Wireless Information^</h2^>
echo ^<h3^>Current WiFi Connection^</h3^>
echo ^<pre^>
netsh wlan show interfaces
echo ^</pre^>
echo ^<h3^>Available Networks^</h3^>
echo ^<pre^>
netsh wlan show networks mode=bssid
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 13: FIREWALL STATUS
:: ═══════════════════════════════════════════════════════════════════
echo [13/15] Checking Firewall Status...
(
echo.
echo ═══ 13. FIREWALL STATUS ═══
echo.
netsh advfirewall show allprofiles
echo.
) >> "%REPORT%"
(
echo ^<h2^>13. Firewall Status^</h2^>
echo ^<pre^>
netsh advfirewall show allprofiles
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 14: NETWORK SHARES
:: ═══════════════════════════════════════════════════════════════════
echo [14/15] Listing Network Shares...
(
echo.
echo ═══ 14. NETWORK SHARES ═══
echo.
net share
echo.
) >> "%REPORT%"
(
echo ^<h2^>14. Network Shares^</h2^>
echo ^<pre^>
net share
echo ^</pre^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SECTION 15: PUBLIC IP & GEOLOCATION
:: ═══════════════════════════════════════════════════════════════════
echo [15/15] Detecting Public IP...
(
echo.
echo ═══ 15. PUBLIC IP DETECTION ═══
echo.
echo --- Your Public IP ---
) >> "%REPORT%"
:: Try multiple services
powershell -Command "(Invoke-WebRequest -Uri 'https://api.ipify.org' -UseBasicParsing).Content" >> "%REPORT%" 2>nul
if errorlevel 1 (
powershell -Command "(Invoke-WebRequest -Uri 'https://ifconfig.me' -UseBasicParsing).Content" >> "%REPORT%" 2>nul
)
echo. >> "%REPORT%"
echo --- IP Geolocation Info --- >> "%REPORT%"
powershell -Command "(Invoke-WebRequest -Uri 'https://ipinfo.io/json' -UseBasicParsing).Content | ConvertFrom-Json | Format-List" >> "%REPORT%" 2>nul
(
echo ^<h2^>15. Public IP ^&amp; Geolocation^</h2^>
echo ^<div class="info-box"^>
echo ^<p^>^<strong^>Public IP:^</strong^>
) >> "%HTML_REPORT%"
powershell -Command "(Invoke-WebRequest -Uri 'https://api.ipify.org' -UseBasicParsing).Content" >> "%HTML_REPORT%" 2>nul
echo ^</p^> >> "%HTML_REPORT%"
echo ^</div^> >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: NETWORK DIAGRAM GENERATION
:: ═══════════════════════════════════════════════════════════════════
echo [*] Generating Network Diagram...
(
echo ^<h2^>Network Architecture Diagram^</h2^>
echo ^<div class="network-diagram"^>
echo ^<h3^>Detected Network Flow^</h3^>
echo ^<p style="font-family: monospace; font-size: 14px;"^>
echo Internet ^<---^> ISP Box/Modem ^<---^> Gateway (%GATEWAY%^) ^<---^> Your PC
echo ^</p^>
) >> "%HTML_REPORT%"
:: Count devices
for /f %%a in ('arp -a ^| find /c "dynamic"') do set DEVICE_COUNT=%%a
echo ^<p^>^<span class="badge badge-primary"^>%DEVICE_COUNT% devices detected on local network^</span^>^</p^> >> "%HTML_REPORT%"
echo ^</div^> >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: FINALIZE REPORTS
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ═══════════════════════════════════════════════════════════════════
echo DIAGNOSTIC COMPLETED - %date% %time%
echo ═══════════════════════════════════════════════════════════════════
) >> "%REPORT%"
(
echo ^<hr^>
echo ^<p style="text-align: center; color: #7f8c8d;"^>Report generated by Network Diagnostic Ultimate^</p^>
echo ^</div^>
echo ^</body^>
echo ^</html^>
) >> "%HTML_REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: SUMMARY
:: ═══════════════════════════════════════════════════════════════════
echo.
echo ╔════════════════════════════════════════════════════════════════╗
echo ║ DIAGNOSTIC COMPLETED! ║
echo ╚════════════════════════════════════════════════════════════════╝
echo.
echo [✓] Text Report: %REPORT%
echo [✓] HTML Report: %HTML_REPORT%
echo.
echo [*] Opening HTML report in browser...
start "" "%HTML_REPORT%"
echo.
echo Press any key to exit...
pause >nul