Pair with a Bluetooth device
()
| 12668 | return {} |
| 12669 | |
| 12670 | def _detect_local_cidr(): |
| 12671 | """Return the local network CIDR derived from `ip` output, or None. |
| 12672 | |
| 12673 | Used as a runtime fallback when an API caller doesn't pass an explicit |
| 12674 | network=. Replaces the old hardcoded '192.168.1.0/24' default that |
| 12675 | silently scanned the wrong subnet on any non-192.168.1.x network. |
| 12676 | """ |
| 12677 | try: |
| 12678 | iface = _get_wifi_iface() |
| 12679 | except Exception: |
| 12680 | iface = None |
| 12681 | candidates = [iface] if iface else [] |
| 12682 | try: |
| 12683 | result = subprocess.run( |
| 12684 | ['ip', '-o', '-4', 'addr', 'show'], |
| 12685 | capture_output=True, text=True, timeout=5) |
| 12686 | if result.returncode != 0: |
| 12687 | return None |
| 12688 | except Exception: |
| 12689 | return None |
| 12690 | import ipaddress as _ipaddress |
nothing calls this directly
no test coverage detected