|
|
@@ -0,0 +1,19 @@ |
|
|
|
|
|
|
|
def next_layer(next_layer): |
|
|
|
""" |
|
|
|
This hook does the actual magic - if the next layer is planned to be a TLS layer, |
|
|
|
we check if we want to enter pass-through mode instead. |
|
|
|
""" |
|
|
|
if isinstance(next_layer, TlsLayer) and next_layer._client_tls: |
|
|
|
server_address = next_layer.server_conn.address |
|
|
|
|
|
|
|
if tls_strategy.should_intercept(server_address): |
|
|
|
# We try to intercept. |
|
|
|
# Monkey-Patch the layer to get feedback from the TLSLayer if interception worked. |
|
|
|
next_layer.__class__ = TlsFeedback |
|
|
|
else: |
|
|
|
# We don't intercept - reply with a pass-through layer and add a "skipped" entry. |
|
|
|
mitmproxy.ctx.log("TLS passthrough for %s" % repr(next_layer.server_conn.address), "info") |
|
|
|
next_layer_replacement = RawTCPLayer(next_layer.ctx, ignore=True) |
|
|
|
next_layer.reply.send(next_layer_replacement) |
|
|
|
tls_strategy.record_skipped(server_address) |