• Stars
    star
    189
  • Rank 198,132 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created about 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SOCKS5/Transparent load balancing proxy developed in Go, combines multiple internet connections

Go dispatch proxy

A SOCKS5 load balancing proxy to combine multiple internet connections into one. Works on Windows and Linux. Reported to work on macOS. Written in pure Go with no additional dependencies.

It can also be used as a transparent proxy to load balance multiple SSH tunnels.

Rationale

The idea for this project came from dispatch-proxy which is written in NodeJS. NodeJS is not entirely disk friendly considering the multitude of files it creates even for very simple programs. I needed something light & portable, preferably a single binary without polluting the entire drive.

Installation

No installation required. Grab the latest binary for your platform from the CI server or from releases and start speeding up your internet connection!

Build status

Usage

The example below are shown on Windows. The steps are similar for other platforms.

1 - Load balance connections

The primary purpose of the tool is to combine multiple internet connections into one. For this we need to know the IP addresses of the interface we wish to combine. You can obtain the IP addresses using the ipconfig (ifconfig on linux) command. Alternatively run go-dispatch-proxy -list.

D:\>go-dispatch-proxy.exe -list
--- Listing the available adresses for dispatching
[+] Mobile Broadband Connection , IPv4:10.81.201.18
[+] Local Area Connection, IPv4:192.168.1.2

Start go-dispatch-proxy specifying the IP addresses of the load balancers obtained in the previous step. Optionally, along with the IP address you may also provide the contention ratio(after the @ symbol). If no contention ratio is specified, it's assumed as 1.

2 - Load balance SSH tunnels

The tool can load balance multiple SSH tunnels. See Example 3 for usage.

Example 1

SOCKS proxy running on localhost at default port. Contention ratio is specified.

D:\>go-dispatch-proxy.exe 10.81.201.18@3 192.168.1.2@2
[INFO] Load balancer 1: 10.81.201.18, contention ratio: 3
[INFO] Load balancer 2: 192.168.1.2, contention ratio: 2
[INFO] SOCKS server started at 127.0.0.1:8080

Example 2

SOCKS proxy running on a different interface at a custom port. Contention ratio is not specified.

D:\>go-dispatch-proxy.exe -lhost 192.168.1.2 -lport 5566 10.81.177.215 192.168.1.100
[INFO] Load balancer 1: 10.81.177.215, contention ratio: 1
[INFO] Load balancer 2: 192.168.1.100, contention ratio: 1
[INFO] SOCKS server started at 192.168.1.2:5566

Out of 5 consecutive connections, the first 3 are routed to 10.81.201.18 and the remaining 2 to 192.168.1.2. The SOCKS server is started by default on 127.0.0.1:8080. It can be changed using the -lhost and lport directive.

Now change the proxy settings of your browser, download manager etc to point to the above address (eg 127.0.0.1:8080). Be sure to add this as a SOCKS v5 proxy and NOT as a HTTP/S proxy.

Example 3

The tool can be used to load balance multiple SSH tunnels. In this mode, go-dispatch-proxy acts as a transparent load balancing proxy.

First, setup the tunnels.

D:\> ssh -D 127.0.0.1:7777 [email protected]
D:\> ssh -D 127.0.0.1:7778 [email protected]

Here we are setting up two SSH tunnels to remote hosts 192.168.1.100, and 192.168.1.101 on local ports 7777 and 7778 respectively. The IP address (127.0.0.1) if omitted defaults to localhost. The -D option stands for dynamic port forwarding.

Next, launch go-dispatch-proxy using the -tunnel argument.

D:\> go-dispatch-proxy.exe -tunnel 127.0.0.1:7777 127.0.0.1:7778

Both the IP and port must be mentioned while specifying the load balancer addresses.

Optionally, the listening host, port and contention ratio can also be specified like in example 2.

D:\> go-dispatch-proxy.exe -lport 5555 -tunnel 127.0.0.1:7777@1 127.0.0.1:7778@3

The lport if not specified defaults to 8080. This is the port where you need to point your web browser, download manager etc. Be sure to add this as a SOCKS v5 proxy.

Full Linux Support [NEW]

Go-dispatch-proxy now supports Linux in both normal mode and tunnel mode. On Linux normal mode, Go-dispatch-proxy uses the SO_BINDTODEVICE syscall to bind to the interface corresponding to the load balancer IPs. As a result, the binary must be run with root privilege or by giving it the necessary capabilities as shown below.

$ sudo ./go-dispatch-proxy

OR (Recommended)

$ sudo setcap cap_net_raw=eip ./go-dispatch-proxy
$ ./go-dispatch-proxy

Tunnel mode doesn't require root privilege.

Compiling (For Development)

Ensure that Go is installed and available on the system path.

$ git clone https://github.com/extremecoders-re/go-dispatch-proxy.git
$ cd go-dispatch-proxy

# Compile for Windows x86
$ GOOS=windows GOARCH=386 go build

# Compile for Windows x64
$ GOOS=windows GOARCH=amd64 go build

# Compile for Linux x86
$ GOOS=linux GOARCH=386 go build

# Compile for Linux x64
$ GOOS=linux GOARCH=amd64 go build

# Compile for Macos x64
$ GOOS=darwin GOARCH=amd64 go build

Credits

  • dispatch-proxy: A SOCKS5/HTTP load balancing proxy written in NodeJS.

License

Licensed under MIT

More Repositories

1

pyinstxtractor

PyInstaller Extractor
Python
1,644
star
2

re-list

A list of open source reverse engineering tools with a focus on binary analysis
104
star
3

bytecode_simplifier

A generic deobfuscator for PjOrion obfuscated python scripts
Python
76
star
4

PjOrion-Deobfuscator

A deobfuscator for PjOrion, python cfg generator and more
Python
61
star
5

Virtual-File-System-Editor

A tool to extract embedded files from application virtualizers
Pascal
39
star
6

tcpdump-android-builds

Precompiled tcpdump binaries for Android
Shell
35
star
7

ghidra-jni

jni.h compiled for Ghidra
C
28
star
8

php-eval-hook

A PHP extension for hooking eval()
C
27
star
9

bnpy

An architecture plugin for binary ninja to disassemble raw python bytecode
Python
24
star
10

decompyle-builds

Precompiled Decompyle++ (pycdc) binaries for Windows & Linux
23
star
11

VMDK-Template

010 Editor Template for parsing VMware Disk(vmdk) images
16
star
12

python-snippet-decompiler

Tool to assist during manual decompilation of Python bytecode
Go
8
star
13

uncompyle6-builds

Pre-compiled Uncompyle6 binaries for Windows
Starlark
7
star
14

firmware-analysis-toolkit

All changes has been merged upstream.
Python
7
star
15

JWUnpacker

Unpacks java-to-exe files converted by JWrapper
C++
6
star
16

ida-scripts

Python
5
star
17

bytecode_tracer

Tracing execution of python bytecode
Python
5
star
18

weasel-keygen

Python
5
star
19

tuts4you_users_desktop_crackme_writeup

5
star
20

python2-tracer

Python 2.7.13 with bytecode tracing support
Python
4
star
21

ropgen

A python module to facilitate in the generation of rop string for ARM and MIPS .
Python
4
star
22

AddSection

A simple tool to add a new section to PE files.
Pascal
4
star
23

xor-files

A simple tool to xor any number of files together.
Pascal
3
star
24

HR-30-days-of-code

My Solutions to HackerRank 30 days of Code
Java
3
star
25

pystack

Python extension module to access the frame stack.
C++
3
star
26

punch-reader

A punched card reader in javascript.
JavaScript
2
star
27

hackerrank

My solutions to HackerRank.com programming challenges
Python
2
star
28

pjunwrapper

Tool to remove the wrapper layers in a PjOrion protected python script
Python
2
star
29

pyinstxtractor-test-binaries

Test binaries for PyInstaller Extractor
Python
2
star
30

molebox-oep-finder

Ollyscript for finding oep of molebox'd executables
2
star
31

quick-msg-crypt

https://extremecoders-re.github.io/quick-msg-crypt/
HTML
2
star
32

tplink-firmware-template

010 Editor Template for parsing TPLINK Firmware
1
star
33

tamu-ctf-writeup

1
star
34

isitwatchable

HTML
1
star