Code Monkey home page Code Monkey logo

psocksd's Introduction

psocksd

Extensible SOCKS tunnel / proxy server daemon written in PHP

Features

The SOCKS protocol family can be used to easily tunnel TCP connections independent of the actual application level protocol, such as HTTP, SMTP, IMAP, Telnet, etc. In this mode, a SOCKS server acts as a generic proxy allowing higher level application protocols to work through it.

  • SOCKS proxy server with support for SOCKS4, SOCKS4a and SOCKS5 protocol versions (all at the same time)
  • Optionally require username / password authentication (SOCKS5 only)
  • Zero configuration, easy to use command line interface (CLI) to change settings without restarting server
  • Incoming SOCKS requests can be forwarded to another SOCKS server to act as a tunnel gateway, perform transparent protocol translation or add SOCKS authentication for clients not capable of doing it themselves.
    • Tunnel endpoint can be changed during runtime (via CLI command).
    • Particularly useful when used as an intermediary server and using ever-changing public SOCKS tunnel end points.
  • Using an async event-loop, it is capable of handling multiple concurrent connections in a non-blocking fashion
  • Built upon the shoulders of reactphp/react and clue/socks, it uses well-tested dependencies instead of reinventing the wheel.

Usage

Once installed, you can start psocksd and listen for incoming SOCKS connections by running:

$ php psocksd.phar

Using this command, psocksd will start listening on the default adress localhost:9050.

Listen address

If you want to listen on another address, you can supply an explicit listen address like this:

# start SOCKS daemon on port 9051 instead
$ php psocksd.phar 9051

# explicitly listen on the given interface
$ php psocksd.phar 192.168.1.2:9050

# listen on all interfaces (allow access to SOCKS server from the outside)
$ php psocksd.phar *:9050

# explicitly only support SOCKS5 and reject other protocol versions
$ php psocksd.phar socks5://localhost:9050

# require client to send the given authentication information
$ php psocksd.phar socks5://username:password@localhost:9051

Client configuration

Once psocksd is started, it accepts incoming SOCKS client connections. Therefor, you have to configure your client program (webbrowser, email client etc.) to actually use the SOCKS server.

The exact configuration depends on your program, but quite a few programs allow you to use a SOCKS proxy. So depending on the above list address, supply the following information:

Proxy-Type: SOCKS4 or SOCKS5
Socks-Host: localhost
Socks-Port: 9050

Install

You can grab a copy of clue/psocksd in either of the following ways.

As a phar (recommended)

You can simply download a pre-compiled and ready-to-use version as a Phar to any directory:

$ wget http://www.lueck.tv/psocksd/psocksd.phar

If you prefer a global (system-wide) installation without having to type the .phar extension each time, you may invoke:

$ chmod 0755 psocksd.phar
$ sudo mv psocksd.phar /usr/local/bin/psocksd

You can verify everything works by running:

$ psocksd

Updating phar

There's no separate update procedure, simply overwrite the existing phar with the new version downloaded.

Manual Installation from Source

The manual way to install psocksd is to clone (or download) this repository and use composer to download its dependencies. Obviously, for this to work, you'll need PHP, git and curl installed:

$ sudo apt-get install php5-cli git curl
$ git clone https://github.com/clue/psocksd.git
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install

If you want to build the above mentioned psocksd.phar yourself, you have to install clue/phar-composer and can simply invoke:

$ php phar-composer.phar build ~/workspace/psocksd

Updating manually

If you have followed the above install instructions, you can update psocksd by issuing the following two commands:

$ git pull
$ php composer.phar install

Docker

This project is also available as a docker image. Using the clue/psocksd image is as easy as running this:

$ docker run -d -p 9050:9050 clue/psocksd

License

MIT-licensed

psocksd's People

Contributors

clue avatar locusf avatar

Watchers

James Cloos 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.