Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Merge PR #1842: tools: privacy.py, relay.py and trace.py print commands that run as typed

Gathin2310d78e1361f7
diff --cc tools/relay.py
index e8cedee8f,61cafd814..b91941c88
--- a/tools/relay.py
+++ b/tools/relay.py
@@@ -87,14 -79,7 +87,14 @@@ def main()
p.add_argument("--port", type=int, default=15555, help="local port to listen on (default 15555; 0 picks one)")
args = p.parse_args()
if not args.tv_host:
- p.error("give the TV's IP address, e.g. tools/relay.py 192.168.1.50")
+ p.error("give the TV's IP address, e.g. tools/venv/bin/python -I tools/relay.py 192.168.1.50")
+ # Both options are ports, and neither was checked: --port went to bind() as typed, and bind() refuses a
+ # port above 65535 (or a negative one) with an OverflowError - not an OSError, so the "cannot listen"
+ # message below never saw it - while --tv-port skipped the 1..65535 check the address and TV_PORT get a
+ # few lines further down. socket.create_connection cuts a servname to 16 bits, so "--tv-port 70000" printed
+ # "-> <tv>:70000" and forwarded to <tv>:4464, whatever service is there.
+ args.port = checked_port(p, "--port", args.port, 0)
+ args.tv_port = checked_port(p, "--tv-port", args.tv_port, 1)
# The same order as tv.py and adb-closed.py (#997). With 5555 fixed, a TV whose adbd has a port of its
# own (5877 on the Wanbo T6R Max) was relayed to 5555 whatever TV_HOST and TV_PORT said.
args.tv_host, endpoint_port = split_host_port(args.tv_host)