This is a simple cycript script for injecting a custom
NSURLProtocol
that logs every HTTP request.
Install cycript. If you'd like to use homebrew instead you can use my tap with:
$ brew install keith/formulae/cycript
Then copy injectURLProtocol.cy
to somewhere you can reference it.
Run the script in the process in question:
$ cycript -p APPLICATION injectURLProtocol.cy
Then open Console.app to see messages formatted like this:
1/1/70 00:00:00.000 Slack[83206]: Req: POST https://slack.com/api/api.test?error= Headers: {
"Content-Type" = "application/x-www-form-urlencoded";
Origin = "file://";
"User-Agent" = "...";
}
NOTE: To make it easier to just see these requests, you can filter
by searching for Req:
Depending on what else you're doing with cycript, you might actually be
better off using CFNETWORK_DIAGNOSTICS
which can provide
similar functionality without any addition configuration. You can simple
using this environment variable when launching the binary in question
like this:
$ CFNETWORK_DIAGNOSTICS=3 path/to/binary
This script could print sensitive information into your console. Be careful out there!