Showing posts with label proxy. Show all posts
Showing posts with label proxy. Show all posts

Tuesday, February 28, 2012

内网服务器使用SSH端口转发访问外网



很多使用我们不能在内网防火墙中的服务器上使用yum等工具,不过我们可以使用SSH来映射本地端口到服务器完成。

在你的笔记本电脑上使用以下Python(twisted)来做一个代理,当然你也可以用nodejs,Perl,或者直接用Squid等。

from twisted.web import proxy, http
from twisted.internet import reactor


class ProxyFactory(http.HTTPFactory):

    def buildProtocol(self, addr):
        return proxy.Proxy()


reactor.listenTCP(8080, ProxyFactory())
reactor.run()

 

然后把这个8080端口映射到内网服务器上的8083端口上

ssh -g -R 8083:localhost:8080 remote-server

最后在内网服务器上使用代理

export http_proxy="http://localhost:8083"

Saturday, July 9, 2011

Google chrome pac auto proxy file

don't use only exts. Swithy will broken on chrome 12. so use pac file is a good way.

[cc lang='javascript' ]
function FindProxyForURL(url, host)
{
var regexpr = /(google|googleusercontent|gmodules|chromium|linkedin|filesonic|hotfile|fbcdn|wp|scanlover|android|pusherapp|jqueryui|wordpress|tornadoweb|angrybirds|28tube|goo|fc2|youtube|twitter|facebook|ytimg).com$/;
if(regexpr.test(host))
return "SOCKS5 127.0.0.1:7070; DIRECT";
return "DIRECT";
}

[/cc]

start google chrome in command line [cci]google-chrome --proxy-pac-url=file:///home/fred/.proxy.pac[/cci]

work on debian linux.

Monday, March 29, 2010

SSH Proxy With Firefox Howto

[caption id="attachment_1458" align="aligncenter" width="300" caption="翻墙"][/caption]

  1. use expect script
    #!/usr/bin/expect -f
    spawn ssh -D 7070 fred@oracle1.com
    expect "password:"
    send "yourpassword\r"
    interact


  2. use firefox addon "autoproxy" to visit Inertnet.

Tuesday, June 30, 2009