Total Pageviews

Saturday 30 January 2016

elazarl/goproxy

It supports regular HTTP proxy, HTTPS through CONNECT, and "hijacking" HTTPS connection using "Man in the Middle" style attack.
The intent of the proxy, is to be usable with reasonable amount of traffic yet, customizable and programable.
The proxy itself is simply a net/http handler.
In order to use goproxy, one should set their browser to use goproxy as an HTTP proxy. Here is how you do that in Chromeand in Firefox.
For example, the URL you should use as proxy when running ./bin/basic is localhost:8080, as this is the default binding for the basic proxy.
from https://github.com/elazarl/goproxy,
http://ripper234.com/p/introducing-goproxy-light-http-proxy/
-------------

用goproxy实现基于VPN的本地HTTP代理

为什么脸书和推推不能访问了,因为DNS墙了。。。解析出来的地址就不对。
不知道有没有办法在go里面指定ResolveTCPAddr的dns服务器,我现在只能在hosts里面加上正确的IP地址来访问。
代码如下:
package main

import (
    "github.com/elazarl/goproxy"
    "log"
    "net"
    "flag"
    "net/http"
)

var (
    listen = flag.String("listen", "localhost:8080", "listen on address")
    ip = flag.String("ip", "", "listen on address")
    verbose = flag.Bool("verbose", false, "verbose output")
)

func main() {
    flag.Parse()

    if *ip == "" {
        log.Fatal("IP address must be speicified")
    }

    proxy := goproxy.NewProxyHttpServer()
    proxy.Verbose = *verbose
    proxy.Tr.Dial = func (network, addr string) (c net.Conn, err error) {
        if network == "tcp" {
            localAddr, err := net.ResolveTCPAddr(network, *ip + ":0");
            if err != nil {
                return nil, err;
            }
            remoteAddr, err := net.ResolveTCPAddr(network, addr);
            if err != nil {
                return nil, err;
            }
            return net.DialTCP(network, localAddr, remoteAddr);
        }

        return net.Dial(network, addr);
    }
    log.Fatal(http.ListenAndServe(*listen, proxy))
}
使用方法
go run proxy.go -ip VPN虚拟网卡的IP地址

启动代理之后就可以像普通http代理一样在浏览器中使用他咯,非常方便.
-----------------------------------------------

Daisy Proxy

A simple proxy based on goproxy.
一个基于goproxy的简单http代理,可以指定出口IP地址。

Usage

Usage of ./daisy-proxy:
  -dns="8.8.8.8 8.8.4.4": dns servers
  -if="": out interface
  -ip="": out address
  -listen="localhost:8080": listen on this address and port
  -verbose=false: verbose output
  -h   : show help usage

Example

./daisy-proxy -if ppp0
2015/04/11 10:15:40 DaisyProxy listen on localhost:8080 outgoing from 10.0.0.60
from https://github.com/HessianZ/daisy-proxy