couple-repo/network_scan.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

429 lines
24 KiB
Batchfile

@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: ═══════════════════════════════════════════════════════════════════
:: NETWORK DIAGNOSTIC ULTIMATE - Text Only Version
:: ═══════════════════════════════════════════════════════════════════
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
if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%"
cls
echo.
echo ╔════════════════════════════════════════════════════════════════╗
echo ║ NETWORK DIAGNOSTIC ULTIMATE v2.0 ║
echo ║ Full Network Analysis - Text Report ║
echo ╚════════════════════════════════════════════════════════════════╝
echo.
:: Start report
(
echo ═══════════════════════════════════════════════════════════════════
echo NETWORK DIAGNOSTIC REPORT
echo Generated: %date% %time%
echo ═══════════════════════════════════════════════════════════════════
echo.
) > "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [1/15] System Information
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 1. SYSTEM INFORMATION │
echo └─────────────────────────────────────────────────────────────────┘
echo.
systeminfo | findstr /C:"Host Name" /C:"OS Name" /C:"OS Version" /C:"System Type" /C:"System Locale"
echo.
) >> "%REPORT%"
type "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [2/15] Network Interfaces (Full Details)
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 2. NETWORK INTERFACES - FULL CONFIGURATION │
echo └─────────────────────────────────────────────────────────────────┘
echo.
ipconfig /all
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [3/15] Active Network Connections
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 3. ACTIVE NETWORK CONNECTIONS │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ All Connections:
netstat -ano
echo.
echo ▸ Established Connections Only:
netstat -ano | findstr ESTABLISHED
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [4/15] Routing Table
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 4. ROUTING TABLE │
echo └─────────────────────────────────────────────────────────────────┘
echo.
route print
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [5/15] ARP Cache - Local Network Devices
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 5. ARP CACHE - DEVICES ON LOCAL NETWORK │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ All discovered devices (MAC addresses):
arp -a
echo.
) >> "%REPORT%"
:: Count devices
for /f %%a in ('arp -a ^| find /c "dynamic"') do (
echo ▸ Total devices detected: %%a >> "%REPORT%"
echo. >> "%REPORT%"
)
:: ═══════════════════════════════════════════════════════════════════
echo [6/15] DNS Configuration
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 6. DNS CONFIGURATION ^& TESTS │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ DNS Servers in use:
ipconfig /all | findstr /C:"DNS Servers"
echo.
echo ▸ DNS Resolution Test - google.com:
nslookup google.com
echo.
echo ▸ DNS Resolution Test - baidu.com:
nslookup baidu.com
echo.
echo ▸ DNS Cache (last 50 entries):
ipconfig /displaydns | findstr /C:"Record Name" /C:"A (Host)" | more
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [7/15] VPN Detection
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 7. VPN DETECTION │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ RAS/Dial-up Connections:
rasdial
echo.
echo ▸ Windows VPN Connections:
powershell -Command "Get-VpnConnection 2>$null | Format-Table Name, ConnectionStatus, ServerAddress, TunnelType -AutoSize"
echo.
echo ▸ VPN Network Adapters:
ipconfig /all | findstr /I "VPN TAP Tunnel WireGuard OpenVPN" /C:"Adapter"
echo.
echo ▸ All Virtual Adapters:
ipconfig /all | findstr /I "Virtual Hyper-V VMware"
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [8/15] Gateway Detection ^& Test
:: ═══════════════════════════════════════════════════════════════════
:: Extract default gateway
set 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 ┌─────────────────────────────────────────────────────────────────┐
echo │ 8. GATEWAY DETECTION ^& CONNECTIVITY TEST │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Default Gateway IP: %GATEWAY%
echo.
echo ▸ Ping Gateway (Latency Test):
ping -n 10 %GATEWAY%
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [9/15] Internet Connectivity Tests
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 9. INTERNET CONNECTIVITY TESTS │
echo └─────────────────────────────────────────────────────────────────┘
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 ▸ China - Baidu.com:
ping -n 4 baidu.com
echo.
echo ▸ International - Google.com:
ping -n 4 google.com
echo.
echo ▸ DNS Speed - WeChat Servers:
ping -n 4 wechat.com
echo.
echo ▸ TikTok/Douyin Infrastructure:
ping -n 4 douyin.com
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [10/15] Traceroute Analysis
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 10. TRACEROUTE - NETWORK PATH ANALYSIS │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Trace to Google DNS (8.8.8.8):
echo [Shows number of hops = number of network devices]
tracert -d -h 20 8.8.8.8
echo.
echo ▸ Trace to Baidu.com:
tracert -d -h 20 baidu.com
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [11/15] Open Ports ^& Listening Services
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 11. OPEN PORTS ^& LISTENING SERVICES │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ All Listening Ports:
netstat -ano | findstr LISTENING
echo.
echo ▸ Services by Protocol:
netstat -ano -p TCP | findstr LISTENING
echo.
netstat -ano -p UDP
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [12/15] Wireless Information
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 12. WIRELESS NETWORK INFORMATION │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Current WiFi Connection Status:
netsh wlan show interfaces
echo.
echo ▸ WiFi Signal Quality ^& Speed:
netsh wlan show interfaces | findstr /C:"Signal" /C:"Receive rate" /C:"Transmit rate" /C:"Channel" /C:"SSID"
echo.
echo ▸ Available WiFi Networks (Detailed):
netsh wlan show networks mode=bssid
echo.
echo ▸ Saved WiFi Profiles:
netsh wlan show profiles
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [13/15] Firewall Status
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 13. WINDOWS FIREWALL STATUS │
echo └─────────────────────────────────────────────────────────────────┘
echo.
netsh advfirewall show allprofiles
echo.
echo ▸ Firewall Rules (Inbound - First 30):
netsh advfirewall firewall show rule name=all dir=in | more
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [14/15] Network Shares ^& Resources
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 14. NETWORK SHARES ^& RESOURCES │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Local Shares:
net share
echo.
echo ▸ Network Statistics:
netstat -e
echo.
echo ▸ Network Adapter Statistics:
netsh interface ipv4 show interfaces
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
echo [15/15] Public IP ^& Geolocation
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ 15. PUBLIC IP ^& GEOLOCATION │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Your Public IP Address:
) >> "%REPORT%"
powershell -Command "try { (Invoke-WebRequest -Uri 'https://api.ipify.org' -UseBasicParsing -TimeoutSec 5).Content } catch { 'Unable to fetch (firewall/VPN blocking?)' }" >> "%REPORT%" 2>nul
(
echo.
echo ▸ Geolocation Info:
) >> "%REPORT%"
powershell -Command "try { (Invoke-WebRequest -Uri 'https://ipinfo.io/json' -UseBasicParsing -TimeoutSec 5).Content | ConvertFrom-Json | Format-List ip, city, region, country, org } catch { 'Unable to fetch geolocation data' }" >> "%REPORT%" 2>nul
(
echo.
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: NETWORK ANALYSIS SUMMARY
:: ═══════════════════════════════════════════════════════════════════
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ NETWORK ARCHITECTURE SUMMARY │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Network Flow Diagram:
echo.
echo Internet
echo ^|
echo v
echo ISP Modem/Box
echo ^|
echo v
echo Gateway: %GATEWAY%
echo ^|
echo v
echo Your Windows PC
echo.
) >> "%REPORT%"
:: Analyze traceroute hops
for /f %%a in ('tracert -d -h 5 8.8.8.8 2^>nul ^| find /c " ms "') do (
set HOPS=%%a
)
(
echo ▸ Network Hops to Internet: %HOPS%
echo └─ 1 hop = Direct connection (no router)
echo └─ 2 hops = Box + Router (possible double NAT)
echo └─ 3+ hops = Additional network equipment
echo.
) >> "%REPORT%"
:: Device count
for /f %%a in ('arp -a ^| find /c "dynamic"') do (
echo ▸ Total Local Devices Detected: %%a >> "%REPORT%"
)
(
echo.
echo ┌─────────────────────────────────────────────────────────────────┐
echo │ RECOMMENDATIONS FOR RASPBERRY PI SETUP │
echo └─────────────────────────────────────────────────────────────────┘
echo.
echo ▸ Gateway to use: %GATEWAY%
echo ▸ Connect Raspberry Pi via Ethernet to the device at: %GATEWAY%
echo ▸ Raspberry Pi should get IP in same subnet (e.g., 192.168.x.x)
echo.
) >> "%REPORT%"
:: Connection type
for /f "tokens=*" %%a in ('ipconfig ^| findstr /I "Wireless Ethernet"') do (
echo ▸ Your current connection: %%a >> "%REPORT%"
)
(
echo.
echo ═══════════════════════════════════════════════════════════════════
echo DIAGNOSTIC COMPLETED
echo %date% %time%
echo ═══════════════════════════════════════════════════════════════════
) >> "%REPORT%"
:: ═══════════════════════════════════════════════════════════════════
:: Display summary in terminal
:: ═══════════════════════════════════════════════════════════════════
cls
type "%REPORT%"
echo.
echo.
echo ╔════════════════════════════════════════════════════════════════╗
echo ║ DIAGNOSTIC COMPLETED ║
echo ╚════════════════════════════════════════════════════════════════╝
echo.
echo [✓] Full report saved to:
echo %REPORT%
echo.
echo [*] Key Information:
echo - Gateway: %GATEWAY%
echo - Hops to Internet: %HOPS%
echo.
echo [?] Next Steps:
echo 1. Review the report above
echo 2. Check Section 5 (ARP Cache) to identify Box vs Router
echo 3. Check Section 10 (Traceroute) to see network structure
echo 4. Use this info to configure Raspberry Pi placement
echo.
echo Press any key to open the full report in Notepad...
pause >nul
notepad "%REPORT%"