4

I'm using MITM Proxy to capture requests/responses using Python Inline Scripts. In case of certificate verification error MITM Proxy writes log line to standard output like

127.0.0.1:34390: SSL verification failed for upstream server at depth 0 with error: 18

Is it possible to capture this certificate validation errors in Inline Script function and how? I'm only possible to capture http requests and responses in this scripts. If it's impossible with Inline Script, maybe I can do it with libmproxy?

Dmitry Spikhalskiy
  • 5,379
  • 1
  • 26
  • 40
  • Do you get any success? – M.Shuaib Imran Oct 14 '15 at 14:58
  • @M.ShuaibImran Nope, just parse stdout and analyze this lines as temporary approach. But it's a hack, definitely not a solution, because it's impossible or hard to get strong matching between error and actual resource for which we got it, etc. Didn't find any ways to handle it in Inline Script. – Dmitry Spikhalskiy Oct 14 '15 at 15:53

1 Answers1

1

I ran into the same issue. Thankfully mitmproxy's code is very clean and well oraganized. You'll be able to retrieve your error like this:

def request(context, flow):
    print flow.server_conn.ssl_verification_error
matthewaveryusa
  • 632
  • 5
  • 24