New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support upstream SOCKS proxy #211

Open
tyll opened this Issue Feb 9, 2014 · 13 comments

Comments

Projects
None yet
@tyll

tyll commented Feb 9, 2014

Implement support for SOCKS upstream proxy with DNS resolution via SOCKS, so mitmproxy can be easily tunnelled through "ssh -D".

@mhils

This comment has been minimized.

Member

mhils commented Feb 9, 2014

I don't have the time do work on this at the moment, but if someone is interested, wrapping proxy.ServerConnection should do the job.

@kourosh3000

This comment has been minimized.

kourosh3000 commented Mar 14, 2014

Thank you

@zhangyoufu

This comment has been minimized.

zhangyoufu commented Nov 7, 2014

FYI, proxychains works well

@niaoniaozz

This comment has been minimized.

niaoniaozz commented Dec 23, 2014

Hello, I am wondering if this feature is implemented in the current version or not.

@mhils

This comment has been minimized.

Member

mhils commented Dec 23, 2014

Not yet, sorry.

@JeremyRand

This comment has been minimized.

JeremyRand commented May 25, 2015

Hi, so I'm looking at the code for upstream HTTP(S) proxy support and it looks like it's mutually exclusive with running mitmproxy as a SOCKS proxy. I'm potentially interested in looking at adding upstream SOCKS support, but I'd prefer not to have that limitation. Is there an implementation reason for that exclusivity? Is there a good way to implement upstream SOCKS support such that that isn't a problem?

@absane

This comment has been minimized.

absane commented Mar 14, 2016

Just commenting hoping to bump interest some. I've been trying to use Tor as an upstream proxy and it seems that Tor only supports Socks.

@samos123

This comment has been minimized.

samos123 commented Apr 28, 2016

Would also like to have this feature.

@n0rz

This comment has been minimized.

n0rz commented Aug 12, 2016

++

@malwarefun

This comment has been minimized.

malwarefun commented Mar 13, 2017

You can hook the makesocket call in tcp.py.
Install and import pysocks, then connect to your socks proxy (eg. set_proxy(socks.SOCKS5, "localhost", 9050))

@TonyStark

This comment has been minimized.

TonyStark commented Jul 6, 2018

@zhangyoufu i tried but i think its not working
@malwarefun can yo give script example...

@malwarefun

This comment has been minimized.

malwarefun commented Jul 9, 2018

Hi @TonyStark ,
Its been a while since I looked at this.. I think I did something like,

import socks
...
def makesocket(self):
    s = socks.socksocket()
    s.set_proxy(socks.SOCKS5, "localhost", 9050)
    return s
@TonyStark

This comment has been minimized.

TonyStark commented Jul 15, 2018

@malwarefun
i tried your code but it seems not working.
i also tried this code

import socks
s = socks.socksocket() # Same API as socket.socket in the standard lib
s.set_proxy(socks.SOCKS5, "localhost", 37760)
# Can be treated identical to a regular socket object
s.connect(("127.0.0.1", 8080))
s.sendall("GET / HTTP/1.1 ...")
print s.recv(4096)

but not working too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment