Code Monkey home page Code Monkey logo

tcpsocks's Introduction

Simple Linux epoll-based single thread SOCKS5 client. Supports getting destination address with SO_ORIGINAL_DST (for use with -j REDIRECT iptables target) and telling that address to SOCKS server.

Alternative, more complete libevent-based implementation: redsocks

Example setup:

# # Prepare iptables:
# iptables -t nat -N QQQ
# iptables -t nat -A QQQ -d 127.0.0.0/8 -j RETURN
# iptables -t nat -A QQQ -d 80.83.124.150 -p tcp --dport 22 -j RETURN
# iptables -t nat -A QQQ -p tcp -j REDIRECT --to-ports 1234
# iptables -t nat -I OUTPUT 1 -j QQQ
# iptables -t nat -I PREROUTING 1 -j QQQ

$ # connect to SSH:
$ ssh -D 127.0.0.1:1080 [email protected]

$ # start tcpsocks:
$ tcpsocks 0.0.0.0 1234 REDIRECT REDIRECT 127.0.0.1 1080
192.168.99.2:54761 -> 66.102.13.103:80 [5->6]
    192.168.99.2:54761 -> 66.102.13.103:80 [5->6] Started 
    192.168.99.2:54761 -> 66.102.13.103:80 [5->6] Finished
192.168.99.2:56097 -> 79.105.152.94:24692 [5->6]
    192.168.99.2:56097 -> 79.105.152.94:24692 [5->6] Started
192.168.99.2:45627 -> 79.97.43.185:59283 [17->18]
    192.168.99.2:45620 -> 79.97.43.185:59283 [13->14] tcpsocks: End of file from SOCKS5 server [phase 3]
    192.168.99.2:45620 -> 79.97.43.185:59283 [13->14] Finished
?
Commands: quit list kill Debug
l
    192.168.99.2:56097 -> 79.105.152.94:24692 [5->6] 2317:425
k 5
    192.168.99.2:56097 -> 79.105.152.94:24692 [5->6] Finished
l

tcpsocks allow interactive control of connections: you can list then and kill (by specifying fd). When listing, it prints uploaded/downloaded bytes for each connection.

tcpsocks does not require configuration expect of command line parameters.

You can't limit connection speed, use tcplim for this.

tcpsocks's People

Contributors

crossow avatar her01n avatar vi 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.