Skip to content

Tools for Couchbase Lite

Jayahari Vavachan edited this page Oct 28, 2019 · 2 revisions

NETWORK TRAFFIC ANALYSIS

  • mitmproxy - "an SSL-capable man-in-the-middle proxy"

mitmproxy is a nifty command-line tool that lets you see (and/or intercept and modify) all the http traffic from your actual iOS device. It decodes GZIPped responses automatically for you and lets you edit them on the fly .

  • HTTPScoop — captures HTTP traffic to/from your Mac. Sort of like mitmproxy but requires less setup, although it won’t capture other devices, so it’s only useful when you’re running Couchbase Lite on Mac OS.

  • l2bridge - "User mode layer-2 bridge to capture traffic from mobile devices like iPad, iPhone, Android, etc."

I was struggling a good bit with how to capture all TCP packets from only my iPhone with Wireshark, and this was the simplest way I was able to find to do so. You basically turn your comp into an adhoc wifi network, and the l2bridge tool then lets you intercept all traffic to/from your phone without requiring any Jailbreaking and such. I was using it coupled with mitmproxy to capture all SSL packets as well. Not something I think I'll use regularly, but thought I'd throw it on here too.

INTERACTIVE ACCESS

  • Graphical HTTP Client — No-frills GUI for constructing HTTP requests and viewing the responses. Very useful for experimenting with the REST API.

  • httpie is a command-line tool for sending HTTP requests. It makes it ridiculously easy to add query parameters to the URL and to send JSON bodies. Once you try it, you'll never go back to curl.

INSPECTING DATABASES

  • Couchbase Lite Viewer — "Official" GUI app for viewing Couchbase Lite databases. Runs on Mac OS. Can view local database files (including ones in the iOS Simulator) or remote ones given their URL (useful if you enable the listener in your iOS app.)

  • PhoneDisk + SQLite Manager

I basically wanted to be able to see my iPhone's actual Couchbase Lite contents while simultaneously running Xcode Couchbase Lite logging + mitmproxy to log/visualize all relevant http network activity. PhoneDisk lets me mount my iPhone as a Finder-accessible drive, and then I can access any .touchdb files on it via SQLite Manager (which is a free Firefox add-on that seemed to have a better UX than the other half-a-dozen SQLite-viewing tools I tried), to check if filtered replication is working as I expect it to,.. etc.

PhoneDisk indeed seems to have broken for viewing database files (after investigating a bit more it does look like there was an update to the backup API in iOS 5.1 that may have caused this..)

  • iExplorer works as a perfect replacement instead (and it also happens to be free).