Metadata-Version: 2.4
Name: wifidoctorchs
Version: 1.0.0
Summary: A comprehensive Python package for WiFi configuration, diagnostics, speed testing, and automated troubleshooting on Windows.
Author-email: CHS <chs@wifidoctor.dev>
License: MIT
Project-URL: Homepage, https://github.com/chs/wifidoctorchs
Project-URL: Issues, https://github.com/chs/wifidoctorchs/issues
Keywords: wifi,networking,diagnostics,troubleshooting,windows,netsh
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Requires-Dist: speedtest-cli>=2.1.3
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: pytest-mock>=3.0; extra == "dev"
Dynamic: license-file

# WiFiDoctorCHS

**A comprehensive Python package for WiFi configuration, diagnostics, speed testing, and automated troubleshooting on Windows.**

WiFiDoctorCHS gives you full control over your WiFi -- scan networks, connect/disconnect, manage saved profiles, run diagnostics, test speed, and automatically fix common problems. Works as both a **Python library** and a **command-line tool**.

---

## Features

| Feature | Description |
|---------|-------------|
| **Network Scanning** | Scan for available WiFi networks with signal strength, security, channel, and band info |
| **Connection Management** | Connect, disconnect, and reconnect to WiFi networks |
| **Profile Management** | List, view, export, import, and delete saved WiFi profiles |
| **Password Retrieval** | View saved WiFi passwords (requires admin) |
| **Network Diagnostics** | Ping, DNS resolution, gateway, internet connectivity, traceroute, port checks |
| **Speed Testing** | Download/upload speed tests with latency measurement |
| **Adapter Management** | Enable, disable, reset WiFi adapter |
| **DNS Management** | Compare DNS servers, switch to Google/Cloudflare DNS |
| **Doctor Mode** | Auto-diagnose and fix common WiFi problems |
| **Network Reset** | Flush DNS, release/renew IP, reset TCP/IP, reset Winsock |

---

## Installation

```bash
pip install wifidoctorchs
```

Or install from source:

```bash
pip install -e .
```

With development dependencies:

```bash
pip install -e ".[dev]"
```

---

## CLI Usage

After installation, the `wifidoctorchs` command is available:

### Scan for Networks
```bash
wifidoctorchs scan
```

### Check Connection Status
```bash
wifidoctorchs status
```

### Connect to a Network
```bash
wifidoctorchs connect "MyNetwork"
wifidoctorchs connect "MyNetwork" --password "mypassword"
```

### Run Diagnostics
```bash
wifidoctorchs diagnose
```

### Doctor Mode (Diagnose + Auto-Fix)
```bash
wifidoctorchs doctor                    # Diagnosis only
wifidoctorchs doctor --auto-fix         # Diagnose and fix
wifidoctorchs doctor --auto-fix --speed-test  # Full exam with speed test
```

### Speed Test
```bash
wifidoctorchs speedtest
```

### Manage Profiles
```bash
wifidoctorchs profiles                  # List profiles
wifidoctorchs profiles --passwords      # List with passwords (admin)
wifidoctorchs password "MyNetwork"      # Get specific password
wifidoctorchs export --folder ./backup  # Export all profiles
```

### DNS Tools
```bash
wifidoctorchs dns                       # Compare DNS servers
wifidoctorchs dns --set google          # Switch to Google DNS
wifidoctorchs dns --set cloudflare      # Switch to Cloudflare DNS
wifidoctorchs dns --set auto            # Reset to DHCP DNS
```

### Network Reset
```bash
wifidoctorchs flush-dns                 # Flush DNS cache
wifidoctorchs reset --dns               # Flush DNS
wifidoctorchs reset --ip                # Release/renew IP
wifidoctorchs reset --adapter           # Reset WiFi adapter
wifidoctorchs reset --all               # Full network reset
```

### Traceroute
```bash
wifidoctorchs traceroute 8.8.8.8
wifidoctorchs traceroute google.com --hops 20
```

### Adapter Info
```bash
wifidoctorchs adapter                   # Show adapter info
wifidoctorchs adapter --reset           # Reset adapter
wifidoctorchs adapter --disable         # Disable WiFi
wifidoctorchs adapter --enable          # Enable WiFi
```

---

## Python Library Usage

```python
import wifidoctorchs as wifi

# -- Scan Networks --
networks = wifi.scan_networks()
for net in networks:
    print(f"{net.ssid}: {net.signal_strength}% {net.signal_bars} ({net.security.value})")

# -- Connection Status --
status = wifi.get_current_connection()
if status.is_connected:
    print(f"Connected to: {status.ssid}")
    print(f"Signal: {status.signal_strength}%")
    print(f"IP: {status.ip_address}")

# -- Connect / Disconnect --
wifi.connect("MyNetwork", password="mypassword")
wifi.disconnect()
wifi.reconnect()

# -- Profiles --
profiles = wifi.list_profiles()
password = wifi.get_profile_password("MyNetwork")

# -- Diagnostics --
results = wifi.run_all_diagnostics()
for r in results:
    print(f"{r.test_name}: {r.status.value} -- {r.message}")

# -- Individual Tests --
ping = wifi.ping_test("8.8.8.8")
print(f"Ping: {ping.avg_ms}ms, Loss: {ping.loss_percent}%")

dns = wifi.dns_test("google.com")
print(f"DNS: {dns.resolution_time_ms}ms")

# -- Speed Test --
speed = wifi.run_speed_test()
print(f"Download: {speed.download_mbps} Mbps")
print(f"Upload: {speed.upload_mbps} Mbps")

# -- Doctor Mode --
report = wifi.diagnose()
print(f"Health: {report.overall_health}")
print(f"Issues: {report.issue_count}")

# Auto-fix (requires admin)
report = wifi.auto_fix()
for fix in report.fixes_applied:
    print(f"{fix.issue_title}: {fix.status.value}")

# -- Quick Check --
print(wifi.quick_check())  # "Healthy -- MyNetwork (85% signal, 12ms latency)"
```

---

## Doctor Mode -- What It Fixes

| Problem | Detection | Auto-Fix |
|---------|-----------|----------|
| No WiFi adapter | Adapter not found | Enable adapter |
| Disconnected | No active connection | Reconnect to saved network |
| Very weak signal | Signal < 20% | Suggest stronger networks |
| Can't reach router | Gateway ping fails | Reset adapter, renew IP |
| No internet | Can't ping 8.8.8.8 | Flush DNS, reset TCP/IP, reset adapter |
| DNS failing | Can't resolve domains | Flush DNS, switch to Google DNS |
| Slow DNS | Resolution > 500ms | Switch to faster DNS server |
| DHCP issue | No IP or APIPA address | Release/renew DHCP |
| IP conflict | 169.254.x.x address | Release/renew IP, reset adapter |

---

## Requirements

- **Python** 3.9+
- **Windows** 10/11
- **Administrator privileges** required for: connecting, adapter management, DNS changes, auto-fix

---

## License

MIT License -- see [LICENSE](LICENSE) for details.
