Pergunta

I have great IM that to work needs proxy of type (SOCKS4,SOCKS4A,SOCKS5), However my company is using Http Proxy.

I would like to build my own proxy that will just forward data to my company's proxy(I need to enter username and password to connect to that proxy). How to do it?

Foi útil?

Solução

If you need proxy software, why reinvent the wheel? Just use something that is already written (i.e. jsocks). It should be possible to add authentication if you need it.

If your company proxy is HTTP only, I doubt simple forwarding would work for SOCKS-only software.

Outras dicas

If the company is so restrictive regarding internet access, the proxy is probably configured as HTTP(s) gateway only, there will be no port commands available so direct internet traffic is out of range without a custom box off the network.

A custom box might be your internet router at home with installed DD-WRT or OpenWRT. The only thing you need to do is to setup it's ssh console to port 443 (HTTPS) - all using nice web admin panel (DD-WRT has the edge considering ease of use). The alternative is to use a friend's linux box, some dedicated server or a cheap virtual server as the only functionality you will need is running ssh server on port 443.

If you have a linux box with ssh on port 22 or other, non-default, just add following lines to /etc/init.d/local (or /etc/conf.d/local.start):

iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 22
iptables -I INPUT -j ACCEPT -p tcp --dport 443
iptables -I INPUT -j ACCEPT -p tcp --dport 22

Now you need to connect to your box from work, you can use swiss army knife - putty. Here is a nice article how to bypass proxy and here is the article how to setup local SOCKS proxy on a machine running putty client. Combine both articles to get expected result - setting up SOCKS proxy while connecting from behind a HTTP proxy.

Good luck, freedom will win.

Is the HTTP proxy configured in the Windows internet settings? If so, you can tell Java to use the system proxy like so:


System.setProperty("java.net.useSystemProxies", "true");

I don't get the question i think?

You want to write a java component that on one end has a SOCKS API, on the other HTTP? What protocol uses your IM app? As "mindas" hints, you might need much more than a simple forwarding.

If you simply search java sofwtware that handles HTTP mechanics, including Proxy authentication, go for Apache httpcomponents http://hc.apache.org/

You would need two proxies, one in front of the HTTP proxy and one behind it. Easier to just install one new SOCKS proxy.

Instant Messenger --> IM Proxy 1 --> HTTP Proxy --> IM Proxy 2 --> Internets
                  IM            HTTP           HTTP            IM
               protocol                                      protocol

versus.

Instance Messenger --> SOCKS Proxy --> Internets
                   SOCKS           IM
                   protocol     protocol
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top