Using mitmproxy with tor

Hello again!

It’s Friday the 13th and I figured I would try to hammer this out once and for all. I have always want to get a proxy that can inspect traffic working with Tor. I’m not even sure this is feasible, so I’m asking here. I have the below type setup:

client <-> gateway <-> internet

I control both the client and gateway and have a functioning Tor running already on the gateway. Do I Tor first, and then mitmproxy like so:

client <-> mitmproxy -> tor -> internet

or the other way around:

client <-> tor -> mitmproxy -> internet

I attempted to use “torify” but that failed with a permission denied (even as root). Any assistance would be great…thank you.

go to /etc/tor/torsocks.conf and uncomment “#AllowInbound 1”, then you won’t get the “permission denied” when running “torsocks mitmdump …”