Guidance on implementing server-first-message protocols?


#1

I have seen this issue indicating that handling protocols in which the server sends the first message (like MySQL) was not possible as of Feb. 2016.

I would be interested in coding this feature so that I can snoop MySQL traffic using the --tcp option. I have a few questions:

  1. Would the owners/maintainers welcome such an addition?
  2. Has anything changed in the last year that would make this easier to implement than it was when that issue was filed?

#2

Hi @smanzer,

You’re stumbling upon mitmproxy’s pain points it seems - sorry about that :wink:

Would the owners/maintainers welcome such an addition?

Definitely yes. The sans-io branch in fact already has this working (https://github.com/mitmproxy/mitmproxy/issues/1775 / https://github.com/mitmproxy/mitmproxy/tree/sans-io), but there’s just a lot of work left before that can replace our current protocol implementation. If you have a decent workaround that works with the current protocol stack, I’d of course be happy to merge that, but see below.

Has anything changed in the last year that would make this easier to implement than it was when that issue was filed?

Not really, but I do have a workaround addon for exactly that problem: https://gist.github.com/mhils/3a1ebb56479fc7c660942c57cb37312d. That may actually be the most pragmatic approach for now.


#3

Thank you very much :slight_smile:

Your workaround was quite easy to deploy for me, so I’m good for now. sans-io branch looks very cool I will keep an eye on that.