vishen / go-chromecast

cli for Google Chromecast, Home devices and Cast Groups
Apache License 2.0
853 stars 84 forks source link

cmd: implement chromecast scanner #179

Closed holiman closed 8 months ago

holiman commented 8 months ago

This PR adds a utility to do a little scan for chromecast devices. I'm using qubes os which has certan network restrictions, and having a hard time getting mDNS/avahi to function properly and find chromecast devices.

Examples

$ go run . --cidr 192.168.50.0/24  scan
Scanning...  scanned 0, current 192.168.50.0:8009
Found (potential) chromecast at 192.168.50.88:8009
Scanned 256 uris in 1.605169203s

$ go run . --cidr 192.168.51.0/24  scan
Scanning...  scanned 0, current 192.168.51.0:8009
Scanned 256 uris in 1.606679062s
vishen commented 8 months ago

This is very cool, thanks @holiman . Just curious what kind of restrictions are imposed that make the mDNS library we use not work?

holiman commented 8 months ago

I don't know what the exact nature of it is. According to https://github.com/QubesOS/qubes-issues/issues/8444

LLMNR is enabled by default in Fedora’s systemd-resolved. mDNS is disabled by default in Fedora ... Disabling mDNS and LLMNR in systemd-resolved is also consistent with Qubes OS disabling Avahi by default.

An additional problem might be that qubesos uses an internal virtual network for the qubes (but I have tested from my sys-net qubes too. I suspect it's a set of nftables rules which drop it, but haven't gotten around to debugging the nft rules, I wrote the scanner instead.