Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1493

Send requests and receive answers between mitmproxy and upstream

$
0
0

I'm trying to develop an addon in mitmproxy that will analyze some HTTPS/HTTP responses from the endpoint server/website and react to specific responses received.I would then block the response from accessing the client, and instead send a GET request from mitmproxy to the endpoint server, and then receive a response from that same endpoint server, then analyze it, send back a GET request without the previous response getting to the client, and once I get a correct answer from the endpoint, I would forward it to the client.

In other words I want to implement this :

Client           Mitmproxy        CorporateProxy       Endpoint Server/Website [Internet]GET_Request1 --> GET_Request1 --> GET_Request1  -----> GET_Request1                 Answer1      <-- Answer1       <----- Answer1                 GET_Request2 --> GET_Request2  -----> GET_Request2                 Answer2      <-- Answer2       <----- Answer2                 GET_Request3 --> GET_Request3  -----> GET_Request3Answer3     <--  Answer3      <-- Answer3       <----- Answer3GET_Request4 --> GET_Request4 --> GET_Request4  -----> GET_Request4Answer4     <--  Answer4      <-- Answer4       <----- Answer4[etc.]

Notice I'm using the upstream mode as I'm behind a corporate HTTP proxy server that has its own SSL certificate, so mitmproxy is very useful to decode the traffic here by posing as a CA authority behind the client with self signed SSL certificates.

I don't see in the documentation how one would "generate" a novel GET request from a mitmproxy addon using the API provided. I mostly see addons that modify requests/responses, so I'm unsure how to do it properly.

Since mitmproxy has already a HTTP connection to the endpoint, it seems (maybe I'm wrong) redundant to use e.g. urllib3 to generate those GET requests (adding a new dependency), and beside, I need the responses to the GET requests to go through mitmproxy.

TL;DR How do I generate a completely new GET request with existing mitmproxy facilities, a request that is upstream of the client, which will be answered by a response that will not reach the client?


Viewing all articles
Browse latest Browse all 1493

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>