Инвентаризация сети: 43 хоста, два телевизора, колонки, Tuya

Сканирование обнаружением (ping/ARP, mDNS, SSDP, точечные порты).

Найдено: Keenetic x2, Яндекс Лайт и Станция Миди (mDNS _yandexio),
два Chromecast-телевизора («Гостиная», «Smart TV Pro»), ПК с uTorrent,
Tuya-устройство, телефон. Остальное — наши Proxmox VM/CT.

tv.py: управление телевизорами через pychromecast (список, play, pause,
stop, volume). Колонки требуют токена с правами умного дома.

Ловушки: порт 9080 в подсети — это дашборды контейнеров, не ТВ;
pychromecast ломался из-за файла /root/inspect.py, перекрывавшего stdlib.
This commit is contained in:
buryan-agent committed 2026-10-20 15:17:30 +03:00
1 parent 6efe4ac85e
commit 0bfb13ddf1
6 files changed
+422

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
# Инвентаризация сети 192.168.1.0/24
Сканирование только обнаружением: ping/ARP, mDNS, SSDP и точечная проверка
портов. Без брутфорса, эксплуатаций и нагрузочных тестов.
## Что нашлось
| IP | Что это | Как определено |
|---|---|---|
| 192.168.1.1 | Keenetic (роутер, «Velibori_242») | MAC Keenetic, HTTP «KeeneticOS Web Panel», UPnP |
| 192.168.1.3 | Keenetic-1604 (вторая точка/роутер) | mDNS, HTTP «Web control panel on Keenetic-1604» |
| 192.168.1.35 | **Яндекс Лайт** (колонка) | mDNS `YandexIOReceiver-LG0000...4309d886` |
| 192.168.1.49 | **Яндекс Станция Миди** (колонка) | mDNS `YandexIOReceiver-R10NJN5001REWK` |
| 192.168.1.48 | ПК с Windows 10 (build 26200), uTorrent | SSDP `Windows/10.0.26200 uTorrent(client)/36` |
| 192.168.1.70 | телефон (рандомизированный MAC) | MAC 32:E9:... |
| 192.168.1.111 | **Tuya Smart** устройство | MAC 50:8B:B9 (Tuya) |
| 192.168.1.147 | **Телевизор «Гостиная»** (Chromecast) | mDNS `_googlecast`, порты 7000/8008/8009/8443 |
| 192.168.1.149 | **Телевизор «Smart TV Pro»** (Chromecast) | mDNS `_googlecast`, pychromecast |
| 192.168.1.101–240 | Proxmox VM/CT (наши сервисы) | MAC BC:24:11 (Proxmox) |
Всего в подсети: **43 хоста**, из них ~30 — наши контейнеры и ВМ.
## Что умеет интеграция уже сейчас
* `tv.py` — список телевизоров, воспроизведение ссылки, пауза, стоп,
громкость через pychromecast (проверено: оба ТВ находились и отвечали,
пока были включены).
* Колонки Яндекса видны локально по mDNS (`_yandexio`), но управление
звуком требует токена с правами «умного дома» (iot), а не только музыки.
## Почему телевизоров нашлось два, а не больше
Chromecast/mDNS отвечают только когда телевизор включён (или в режиме
«всегда включён»). Выключенный ТВ не виден ни по портам, ни по mDNS.
Чтобы найти остальные:
1. Включить все телевизоры и повторить скан (скрипты 5, 8, 9).
2. Либо дать доступ к роутеру — он знает всех клиентов по DHCP, включая
выключенные (список аренд с именами устройств). Keenetic API требует
логин: `/rci/show/ip/dhcp` отвечает 401.
## Ловушки
* Порт **9080** на всей подсети — это не телевизоры, а дашборды наших
контейнеров. Легко спутать.
* `avahi-browse` не установлен, mDNS пришлось опрашивать сокетом.
* `pychromecast` падал с `module 'inspect' has no attribute
'get_annotations'` из-за моего же файла `/root/inspect.py`, который
перекрывал стандартный модуль. Удалён.
+123
View File
@@ -0,0 +1,123 @@
=== 1. PING-ОБНАРУЖЕНИЕ 192.168.1.0/24 ===
192.168.1.1
MAC Address: 50:FF:20:C6:89:9D (Keenetic Limited)
93c52016b2165099505b0142.netcraze.io (192.168.1.3)
MAC Address: 50:FF:20:ED:DE:23 (Keenetic Limited)
192.168.1.35
MAC Address: B8:87:6E:89:CC:D2 (Intertech Services AG)
192.168.1.49
MAC Address: 3C:0B:4F:CB:58:C8 (Intertech Services AG)
192.168.1.70
MAC Address: 32:E9:84:95:35:9D (Unknown)
npm-test.local (192.168.1.101)
MAC Address: BC:24:11:01:49:E6 (Proxmox Server Solutions GmbH)
192.168.1.102
MAC Address: BC:24:11:D3:1E:EF (Proxmox Server Solutions GmbH)
192.168.1.103
MAC Address: BC:24:11:1F:DC:B7 (Proxmox Server Solutions GmbH)
192.168.1.104
MAC Address: BC:24:11:2A:86:14 (Proxmox Server Solutions GmbH)
192.168.1.105
MAC Address: BC:24:11:9C:A4:85 (Proxmox Server Solutions GmbH)
192.168.1.106
MAC Address: BC:24:11:5F:E8:E1 (Proxmox Server Solutions GmbH)
192.168.1.107
MAC Address: BC:24:11:D1:73:9A (Proxmox Server Solutions GmbH)
192.168.1.108
MAC Address: BC:24:11:8C:B9:38 (Proxmox Server Solutions GmbH)
192.168.1.109
MAC Address: BC:24:11:B5:11:00 (Proxmox Server Solutions GmbH)
192.168.1.110
MAC Address: BC:24:11:94:75:E6 (Proxmox Server Solutions GmbH)
192.168.1.111
MAC Address: 50:8B:B9:79:70:96 (Tuya Smart)
192.168.1.113
MAC Address: BC:24:11:F8:37:24 (Proxmox Server Solutions GmbH)
192.168.1.114
MAC Address: BC:24:11:3D:52:E9 (Proxmox Server Solutions GmbH)
192.168.1.115
MAC Address: BC:24:11:9A:15:C3 (Proxmox Server Solutions GmbH)
192.168.1.116
MAC Address: BC:24:11:00:6F:BF (Proxmox Server Solutions GmbH)
192.168.1.117
MAC Address: BC:24:11:F5:4A:FD (Proxmox Server Solutions GmbH)
192.168.1.118
MAC Address: BC:24:11:11:F5:A0 (Proxmox Server Solutions GmbH)
192.168.1.119
MAC Address: BC:24:11:A8:C5:CB (Proxmox Server Solutions GmbH)
192.168.1.120
MAC Address: BC:24:11:D1:83:5D (Proxmox Server Solutions GmbH)
192.168.1.121
MAC Address: BC:24:11:C3:8E:D8 (Proxmox Server Solutions GmbH)
192.168.1.122
MAC Address: BC:24:11:57:3A:DB (Proxmox Server Solutions GmbH)
192.168.1.123
MAC Address: BC:24:11:0F:C2:96 (Proxmox Server Solutions GmbH)
192.168.1.124
MAC Address: BC:24:11:AA:BA:42 (Proxmox Server Solutions GmbH)
192.168.1.125
MAC Address: BC:24:11:C0:3A:AF (Proxmox Server Solutions GmbH)
192.168.1.126
MAC Address: BC:24:11:31:61:43 (Proxmox Server Solutions GmbH)
192.168.1.127
MAC Address: BC:24:11:4D:27:A4 (Proxmox Server Solutions GmbH)
192.168.1.134
MAC Address: BC:24:11:E5:9C:62 (Proxmox Server Solutions GmbH)
192.168.1.139
MAC Address: BC:24:11:2B:54:32 (Proxmox Server Solutions GmbH)
192.168.1.140
MAC Address: BC:24:11:9D:10:32 (Proxmox Server Solutions GmbH)
192.168.1.147
MAC Address: C4:8B:66:E1:E7:6A (Unknown)
192.168.1.149
MAC Address: 14:EA:63:C5:5A:3C (Unknown)
192.168.1.151
MAC Address: BC:24:11:34:BC:30 (Proxmox Server Solutions GmbH)
192.168.1.155
MAC Address: BC:24:11:33:C6:4A (Proxmox Server Solutions GmbH)
192.168.1.161
MAC Address: BC:24:11:21:C8:5B (Proxmox Server Solutions GmbH)
192.168.1.201
MAC Address: BC:24:11:C8:E7:18 (Proxmox Server Solutions GmbH)
192.168.1.240
MAC Address: BC:24:11:0E:AD:03 (Proxmox Server Solutions GmbH)
pve.example (192.168.1.10)
всего хостов: 43
=== 2. НЕ-PROXMOX УСТРОЙСТВА (порты) ===
192.168.1.3 открыто: 80 443
192.168.1.35 открыто: —
192.168.1.48 открыто: —
192.168.1.49 открыто: —
192.168.1.70 открыто: —
192.168.1.111 открыто: —
192.168.1.147 открыто: 7000 8008 8009 8443
192.168.1.149 открыто: 7000 8008 8009 8443
=== 3. SSDP (UPnP) ===
192.168.1.1 Keenetic Ltd. UPnP/1.1 MiniUPnPd/2.3.9 | uuid:8a328a0a-2c3c-11ef-9396-458caf
192.168.1.147 Linux/5.4.274+, UPnP/1.0, Chromecast/1.6.18 | upnp:rootdevice
192.168.1.149 Linux/5.4.274+, UPnP/1.0, Chromecast/1.6.18 | upnp:rootdevice
192.168.1.48 Windows/10.0.26200 UPnP/1.1 uTorrent(client)(native)/36 | ut:client:service:pairing
устройств по SSDP: 4
=== 4. HTTP-ИДЕНТИФИКАЦИЯ ===
192.168.1.1 http: 200|text/html | KeeneticOS Web Panel
192.168.1.1 https: 000|
192.168.1.3 http: 200|text/html | KeeneticOS Web Panel
192.168.1.3 https: 000|
192.168.1.48 http: 000|
192.168.1.48 https: 000|
192.168.1.49 http: 000|
192.168.1.49 https: 000|
192.168.1.147 http: 000|
192.168.1.147 https: 000|
192.168.1.149 http: 000|
192.168.1.149 https: 000|
=== 5. CHROMECAST ===
192.168.1.147 порт 8009: открыт
192.168.1.149 порт 8009: открыт
=== ГОТОВО: /root/scan-report.txt ===
+68
View File
@@ -0,0 +1,68 @@
=== 1. ARP-СКАН (все живые устройства на L2) ===
192.168.1.1 50:FF:20:C6:89:9D (Keenetic Limited)
192.168.1.3 50:FF:20:ED:DE:23 (Keenetic Limited)
192.168.1.35 B8:87:6E:89:CC:D2 (Intertech Services AG)
192.168.1.48 D8:F3:BC:43:F4:EF (Liteon Technology)
192.168.1.49 3C:0B:4F:CB:58:C8 (Intertech Services AG)
192.168.1.70 32:E9:84:95:35:9D (Unknown)
npm-test.local (192.168.1.101) BC:24:11:01:49:E6 (Proxmox Server Solutions GmbH)
192.168.1.102 BC:24:11:D3:1E:EF (Proxmox Server Solutions GmbH)
192.168.1.103 BC:24:11:1F:DC:B7 (Proxmox Server Solutions GmbH)
192.168.1.104 BC:24:11:2A:86:14 (Proxmox Server Solutions GmbH)
192.168.1.105 BC:24:11:9C:A4:85 (Proxmox Server Solutions GmbH)
192.168.1.106 BC:24:11:5F:E8:E1 (Proxmox Server Solutions GmbH)
192.168.1.107 BC:24:11:D1:73:9A (Proxmox Server Solutions GmbH)
192.168.1.108 BC:24:11:8C:B9:38 (Proxmox Server Solutions GmbH)
192.168.1.109 BC:24:11:B5:11:00 (Proxmox Server Solutions GmbH)
192.168.1.110 BC:24:11:94:75:E6 (Proxmox Server Solutions GmbH)
192.168.1.111 50:8B:B9:79:70:96 (Tuya Smart)
192.168.1.113 BC:24:11:F8:37:24 (Proxmox Server Solutions GmbH)
192.168.1.114 BC:24:11:3D:52:E9 (Proxmox Server Solutions GmbH)
192.168.1.115 BC:24:11:9A:15:C3 (Proxmox Server Solutions GmbH)
192.168.1.116 BC:24:11:00:6F:BF (Proxmox Server Solutions GmbH)
192.168.1.117 BC:24:11:F5:4A:FD (Proxmox Server Solutions GmbH)
192.168.1.118 BC:24:11:11:F5:A0 (Proxmox Server Solutions GmbH)
192.168.1.119 BC:24:11:A8:C5:CB (Proxmox Server Solutions GmbH)
192.168.1.120 BC:24:11:D1:83:5D (Proxmox Server Solutions GmbH)
192.168.1.121 BC:24:11:C3:8E:D8 (Proxmox Server Solutions GmbH)
192.168.1.122 BC:24:11:57:3A:DB (Proxmox Server Solutions GmbH)
192.168.1.123 BC:24:11:0F:C2:96 (Proxmox Server Solutions GmbH)
192.168.1.124 BC:24:11:AA:BA:42 (Proxmox Server Solutions GmbH)
192.168.1.125 BC:24:11:C0:3A:AF (Proxmox Server Solutions GmbH)
192.168.1.126 BC:24:11:31:61:43 (Proxmox Server Solutions GmbH)
192.168.1.127 BC:24:11:4D:27:A4 (Proxmox Server Solutions GmbH)
192.168.1.134 BC:24:11:E5:9C:62 (Proxmox Server Solutions GmbH)
192.168.1.139 BC:24:11:2B:54:32 (Proxmox Server Solutions GmbH)
192.168.1.140 BC:24:11:9D:10:32 (Proxmox Server Solutions GmbH)
192.168.1.147 C4:8B:66:E1:E7:6A (Unknown)
192.168.1.149 14:EA:63:C5:5A:3C (Unknown)
192.168.1.151 BC:24:11:34:BC:30 (Proxmox Server Solutions GmbH)
192.168.1.155 BC:24:11:33:C6:4A (Proxmox Server Solutions GmbH)
192.168.1.161 BC:24:11:21:C8:5B (Proxmox Server Solutions GmbH)
192.168.1.201 BC:24:11:C8:E7:18 (Proxmox Server Solutions GmbH)
192.168.1.240 BC:24:11:0E:AD:03 (Proxmox Server Solutions GmbH)
pve.example (192.168.1.10)
=== 2. ДРУГИЕ ПОДСЕТИ ===
192.168.0.0/24: хостов 1
192.168.2.0/24: хостов 1
192.168.10.0/24: хостов 0
10.0.0.0/24: хостов 0
=== 3. ВСЕ MAC-ПРОИЗВОДИТЕЛИ (кто не Proxmox) ===
192.168.1.1 50:FF:20:C6:89:9D (Keenetic Limited)
fe80::4048:11ff:fedb:7ff1 50:ff:20:c6:89:9d
fe80::52ff:20ff:feed:de23 50:ff:20:ed:de:23
fe80::618d:4709:e659:3b34 14:ea:63:c5:5a:3c
fe80::9dce:74ad:441f:bd3e 3c:0b:4f:cb:58:c8
fe80::9fc5:d5d4:4f1b:1474 c4:8b:66:e1:e7:6a
=== 4. ПРОВЕРКА ПОДОЗРИТЕЛЬНЫХ НА ТВ-ПОРТЫ ===
192.168.1.35 —
192.168.1.49 —
192.168.1.70 —
192.168.1.111 —
192.168.1.147 —
192.168.1.149 —
=== ГОТОВО ===
+27
View File
@@ -0,0 +1,27 @@
=== 1. ЧТО В СОСЕДНИХ ПОДСЕТЯХ ===
--- 192.168.0.0/24 ---
Nmap scan report for 192.168.0.1
--- 192.168.2.0/24 ---
Nmap scan report for 192.168.2.1
=== 2. KEENETIC API (без авторизации) ===
/rci/show/ip/dhcp -> 401
/rci/show/ip/hotspot -> 401
/rci/show/system -> 401
/auth -> 401
=== 3. UPnP IGD: СПИСОК ПОРТОВ ===
=== 4. mDNS: ВСЕ ТИПЫ СЛУЖБ ===
служба: _adisk
служба: _dns-sd
служба: _http
служба: _https
служба: _services
служба: _smb
служба: _tcp
служба: _udp
служба: _yandexio
всего служб: 9
=== ГОТОВО ===
+60
View File
@@ -0,0 +1,60 @@
import socket
import struct
import time
def encode(name):
out = b""
for part in name.split("."):
if part:
out += bytes([len(part)]) + part.encode()
return out + b"\x00"
def query(name):
return struct.pack(">HHHHHH", 0, 0, 1, 0, 0, 0) + encode(name) + struct.pack(">HH", 12, 1)
def parse_names(data):
names, i = [], 0
while i < len(data) - 1:
ln = data[i]
if 1 <= ln <= 63 and i + 1 + ln < len(data):
chunk = data[i + 1:i + 1 + ln]
if all(32 <= c < 127 for c in chunk):
names.append(chunk.decode("ascii", "ignore"))
i += 1 + ln
continue
i += 1
return names
SERVICES = ["_googlecast._tcp.local", "_airplay._tcp.local", "_raop._tcp.local",
"_yandexio._tcp.local", "_adisk._tcp.local", "_smb._tcp.local",
"_http._tcp.local"]
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.settimeout(1.5)
for svc in SERVICES:
try:
s.sendto(query(svc), ("224.0.0.251", 5353))
time.sleep(0.2)
except Exception as e:
print(" отправка", svc, ":", str(e)[:40])
found = {}
end = time.time() + 8
while time.time() < end:
try:
data, addr = s.recvfrom(4096)
except socket.timeout:
continue
ip = addr[0]
names = [n for n in parse_names(data) if n and not n.startswith("_")]
label = " / ".join(dict.fromkeys(names))[:90]
if label and ip not in found:
found[ip] = label
print(f" {ip:<16} {label}")
print(" устройств:", len(found))
+94
View File
@@ -0,0 +1,94 @@
"""Управление телевизорами через Chromecast.
--list список устройств и статус
--play URL проиграть прямую ссылку
--pause / --stop
--volume N громкость 0..1
--device NAME выбрать устройство (по имени или ip)
Запускать через /opt/music-tools/venv/bin/python (там pychromecast).
"""
import sys
import time
import pychromecast
def discover(timeout=12):
casts, browser = pychromecast.get_chromecasts(timeout=timeout)
return casts, browser
def pick(casts, name):
if not name:
return casts[0] if casts else None
for c in casts:
if name.lower() in (c.name or "").lower() or name == c.cast_info.host:
return c
return None
def main():
args = sys.argv[1:]
if not args or args[0] == "--list":
casts, browser = discover()
if not casts:
print(" телевизоры не найдены")
return 1
for c in casts:
try:
c.wait(timeout=6)
st = c.status
app = st.display_name or (st.app_id or "")
media = ""
mc = c.media_controller
if mc is not None and mc.status is not None:
media = mc.status.content_id or ""
print(f" • {c.name} ({c.cast_info.host}) | {c.model_name} | "
f"{app} | {media[:50]}")
except Exception as e:
print(f" • {c.name} ({c.cast_info.host}) | статус: {str(e)[:50]}")
pychromecast.discovery.stop_discovery(browser)
return 0
name = None
if "--device" in args:
i = args.index("--device")
name = args[i + 1]
casts, browser = discover()
cast = pick(casts, name)
if not cast:
print(" устройство не найдено")
pychromecast.discovery.stop_discovery(browser)
return 1
cast.wait(timeout=8)
if args[0] == "--play":
url = args[1] if len(args) > 1 else ""
if not url:
print(" нужна ссылка")
return 1
mc = cast.media_controller
mc.play_media(url, "video/mp4")
mc.block_until_active(timeout=20)
print(f" ▶ {cast.name}: {url[:60]}")
elif args[0] == "--pause":
cast.media_controller.pause()
print(f" ⏸ {cast.name}")
elif args[0] == "--stop":
cast.media_controller.stop()
print(f" ⏹ {cast.name}")
elif args[0] == "--volume":
vol = float(args[1]) if len(args) > 1 else 0.5
cast.set_volume(vol)
print(f" 🔊 {cast.name}: {vol}")
else:
print(__doc__)
pychromecast.discovery.stop_discovery(browser)
return 0
if __name__ == "__main__":
sys.exit(main())