#!/bin/bash # runs inside `unshare -rn` (no network). Starts a logging listener on 127.0.0.1:8899 used as HTTPS_PROXY/HTTP_PROXY, # so any HTTP attempt by the CLI is recorded; any direct dial fails (no route). ip link set lo up python3 -c " import socket;s=socket.socket();s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1);s.bind(('127.0.0.1',8899));s.listen(5) while True: c,_=s.accept();d=c.recv(300);open('$LOG','a').write(d.split(b'\r\n')[0].decode(errors='replace')+'\n');c.close()" & sleep 0.5 "$@"; rc=$? kill %1 2>/dev/null; exit $rc