All Projects → Drewsif → Pysecretsocks

Drewsif / Pysecretsocks

Licence: mit
A python socks server for tunneling a connection over another channel

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pysecretsocks

3proxy
3proxy - tiny free proxy server
Stars: ✭ 2,263 (+4169.81%)
Mutual labels:  socks5, socks-proxy
Tor Socks Proxy
🐳 Tiny Docker(🤏 10MB) image as 🧅 Tor SOCKS5 proxy 🛡
Stars: ✭ 218 (+311.32%)
Mutual labels:  socks5, socks-proxy
Flynet
A powerful TCP/UDP tool, which support socks5 proxy by tcp and udp, http proxy and NAT traversal. This tool can help you bypass gfw easily
Stars: ✭ 124 (+133.96%)
Mutual labels:  socks5, socks-proxy
Socksio
Sans-I/O implementation of SOCKS4, SOCKS4A, and SOCKS5
Stars: ✭ 27 (-49.06%)
Mutual labels:  socks5, socks-proxy
3proxy
3proxy - tiny free proxy server
Stars: ✭ 2,493 (+4603.77%)
Mutual labels:  socks5, socks-proxy
nimSocks
A filtering SOCKS proxy server and client library written in nim.
Stars: ✭ 51 (-3.77%)
Mutual labels:  socks5, socks-proxy
Socks
Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.
Stars: ✭ 200 (+277.36%)
Mutual labels:  socks5, socks-proxy
rsp
Rapid SSH Proxy
Stars: ✭ 223 (+320.75%)
Mutual labels:  socks5, socks-proxy
shadowrocket
A socks5 proxy to build your own shadowsocks private network. PHP based & Composer supported.
Stars: ✭ 23 (-56.6%)
Mutual labels:  socks5, socks-proxy
microsocks11
A cross-platform SOCKS5 library and server based on the microsocks project.
Stars: ✭ 22 (-58.49%)
Mutual labels:  socks5, socks-proxy
socks5 list
Auto-updated SOCKS5 proxy list + proxies for Telegram
Stars: ✭ 210 (+296.23%)
Mutual labels:  socks5, socks-proxy
Shadowsocks Php
A php port of shadowsocks based on workerman. A socks5 proxy written in PHP.
Stars: ✭ 869 (+1539.62%)
Mutual labels:  socks5, socks-proxy
Python Proxy
HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio.
Stars: ✭ 692 (+1205.66%)
Mutual labels:  socks5
Rssh
route ssh through a series of hosts (for if you / the servers are behind firewalls etc)
Stars: ✭ 8 (-84.91%)
Mutual labels:  socks-proxy
Multitor
Create multiple TOR instances with a load-balancing.
Stars: ✭ 624 (+1077.36%)
Mutual labels:  socks-proxy
Furion
Socks5 + SSL Proxy
Stars: ✭ 39 (-26.42%)
Mutual labels:  socks5
Blinksocks
A framework for building composable proxy protocol stack.
Stars: ✭ 587 (+1007.55%)
Mutual labels:  socks5
Daze
Daze is a tool to help you link to the Internet.
Stars: ✭ 580 (+994.34%)
Mutual labels:  socks5
Awslambdaproxy
An AWS Lambda powered HTTP/SOCKS web proxy
Stars: ✭ 571 (+977.36%)
Mutual labels:  socks5
Microsocks
tiny, portable SOCKS5 server with very moderate resource usage
Stars: ✭ 549 (+935.85%)
Mutual labels:  socks5

PySecretSocks

A python SOCKS server for tunneling connections over another channel. Making implementing covert channels a breeze!

Terminology

  • Listener - The listener is the class that listens on a local port and sends incoming connections to the handler.
  • Handler - The handler processes the proxy requests, normally via socks 4a/5, and extracts the connection request to pass to the Client.
  • Client - The client sends and receives data to the server via your custom communication channel.
  • Server - The server communicates with the client via your created channel and initiates the outbound connections.

Using the library

For a real simple implementation see example.py

Client/Server

At a minimum you will need to create a Client and Server class for your communication channel. Both classes have a recv and write function you will need to override from the base class. Note that at runtime these will be run in separate threads.

  • recv() - This function reads data from the communication channel and should put the raw data in the self.revbuf queue.
  • write() - This function writes data from the self.writebuf queue to the communication channel.

You also are required to write an _init_() function to initialize your communication channel in both classes. At the end you need to call self.start() to start the threads. The return of start() is the handle to the recv() thread.

Considerations

When defining your custom communication channel there are some things you should be aware of.

  • It is assumed that your communication channel will send messages in a first in first out fashion and that they will arrive in order as well.
  • You can combine multiple messages from the write queue before you send them over the communication channel.
  • Data from the write queue can be split into parts if the size becomes to large to send in one transmission.
  • The max size of something popped of the write queue will be 65539 bytes. 65535 bytes is the max size we will read off the local socket and there is a 4 byte overhead for each chunk of data received.

Listener

The listener class has 4 arguments that it can take with only the client being required.

  • client - This is an initialized client object.
  • host=None - This is the IP to listen on. When host is None it will use 127.0.0.1
  • port=None - This is the port to listen on. When port is None it will use 1080
  • handler=None - This is an initialized handler object. When handler is None it will use SocksHandler which supports SOCKS 4a/5.

Handler

Custom handlers can be created if the SocksHandler or OneToOneHandler do not work for you. Handler classes need only have one function, new_request.

new_request(self, sock, addr, client)

  • sock - This is a python socket object for the connection for you to process.
  • addr - This is the address bound to the socket on the other end of the connection.
  • client - This is the initialized client object.

In new_request you will pull out whatever information you need in order to call client.new_conn which is described below.

client.new_conn(cmd, addr, port, s)

  • cmd - This is the command for the connection. Accepted values are 1 to establish a TCP/IP stream connection (Connect), 2 to establish a TCP/IP port binding (Bind), and 3 to associate a UDP port (UDP Associate).
    • NOTE: Currently only connect requests are supported by client/servers.
  • addr - The IP or hostname to connect to.
  • port - The port to connect to.
  • s - The socket object which is ready to being sending/receiving data.

Current State

Works! Just needs more polishing and a few features

Features

  • [x] Socks4a
  • [x] Socks5 - No IPv6 support
  • [x] Remote Class Communication
  • 95% happy with it, just needs some bug fixes
  • [x] 1-1 mode
  • [ ] Linux transparent proxy support

Bugs

  • There is a slight delay in the client's connection being close from when the servers is closed.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].