Giter Club home page Giter Club logo

grpc-socks's Introduction

Yet another socks proxy using gRPC streaming.

Cloned from elvizlai/grpc-socks to fix some points:

  • Allow insecure gRPC
  • Prevent client death when DNS resolver fails
  • Remove local dialing
  • Server now runs in Alpine Linux and Raspberry Pi
  • Use system DNS resolver (including /etc/hosts) if available

Build

  1. Run make to build binaries

  2. Build the docker image

    docker build . -t grpcserver:latest
    

Usage

First: Deploy server.

And launch client:

./exec_bin/client-linux -l 127.0.0.1:40000 -r grpcserver:9444 -d

Common applications

If you are using curl

curl -x socks5://127.0.0.1:40000/ https://something.internal

For netcat (openbsd version)

nc -X 5 -x 127.0.0.1:40000 192.168.451.23 443

Ssh (via nc)

ssh -o ProxyCommand='nc -X 5 -x 127.0.0.1:40000 %h %p' [email protected]

Useful options:

ssh \
  -o ProxyCommand='nc -X 5 -x 127.0.0.1:40000 %h %p' \
  -o StrictHostKeyChecking=no \
  -o UserKnownHostsFile=/dev/null \
  [email protected]

To tunnel remote ports:

mkfifo fifo
nc -l 636 0<fifo | nc -X 5 -x 127.0.0.1:40000 internalserver.local 636 1>fifo

If close: Bad file descriptor try nc -4.

Other ways to tunnel

Tunnel with other netcats (no socks5 proxy):

Traditional:

nc -l -p 8001 -c "nc 127.0.0.1 8000"

Busybox:

nc -v -lk -p 8001 -e /usr/bin/nc 127.0.0.1 8000

tsocks

IPtables

Enable NAT:

iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 80 -j DNAT --to-destination 192.264.1.176:8000

Change the original IP to the intermediate box:

iptables -A POSTROUTING -t nat -p tcp -d 192.264.1.176 --dport 8000 -j MASQUERADE

Allow packet forwarding:

iptables -A FORWARD -p tcp -j ACCEPT

Enable kernel forwarding:

sysctl net.ipv4.conf.eth0.forwarding=1

To delete iptables rules just change -A to -D.

grpc-socks's People

Contributors

electronicayciencia avatar elvizlai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.