getReadableAddress() formatted real (non-IPv4-mapped) IPv6 destinations
by mapping each of the 16 address bytes to hex and joining them with ':'.
That produces 16 single-byte groups with per-byte leading zeros stripped,
so e.g. 2001:db8::1 was logged as '[20:1:d:b8:0:0:0:0:0:0:0:0:0:0:0:1]'.
Group the bytes into the 8 standard hextets instead, and collapse the
longest run of zero hextets to '::' (RFC 5952), so the same address now
logs as '[2001:db8::1]'. IPv4 and IPv4-mapped formatting are unchanged.
This only affects DEBUG_MODE output, but readable addresses are the whole
point of getReadableAddress when checking which connections are being
intercepted or blocked.
Replace the global export lookup with a fixed list of system
libraries (libc.so, libc.so.6, libsystem_c/kernel/pthread), using
whichever are present, to avoid matching same-named exports from the
app's own code, per review feedback.
fcntl is not exported by libsystem_c.dylib on Darwin (it lives in
libsystem_kernel.dylib), so the setup block threw and aborted all
native hooks, leaving connect() uninstrumented. Resolve each symbol
from the module first, then fall back to a global lookup.
Previously SOCKS interception didn't work without DEBUG_MODE (whoops)
and tried to intercept UDP even though that wouldn't work either. We no
longer intercept UDP at all (although we can block it for HTTP/3) and
everything should work correctly the rest of the time, with some other
improvements around logging en route.
Since the global Java bridge isn't available, Java.available doesn't
generally work. In the native connect script, our new approach was
incomplete due to using raw kernel APIs instead of the libc compatible
layer (which seems to be the standard API).
This reverts commit 6eec741f5c.
This doensn't actually work correctly, as connect() will return -1
(treated here as failure) for sockets that are still in progress, when
opened non-blocking, and therefore we end up logging these as failures.
We need to handle async connection state detection - that's a bit fiddly
from inside Frida, so for now let's just roll this back.