Giter VIP home page Giter VIP logo

lightsocks-python's Introduction

license GitHub last commit Build Status Coverage Status

一个轻量级网络混淆代理,基于 SOCKS5 协议,可用来代替 Shadowsocks。

  • 只专注于混淆,用最简单高效的混淆算法达到目的;
  • Py3.6 asyncio实现;

本项目为 你也能写个 Shadowsocks 的 Python 实现 作者实现了 GO 版本 Lightsocks

安装

python版本为最新的3.6

git clone https://github.com/linw1995/lightsocks-python
cd lightsocks-python
pip install -r requirements.txt

使用

lsserver

用于运行在代理服务器的客户端,会还原混淆数据

$ python lsserver.py -h
usage: lsserver.py [-h] [--version] [--save CONFIG] [-c CONFIG]
                   [-s SERVER_ADDR] [-p SERVER_PORT] [-k PASSWORD] [--random]

A light tunnel proxy that helps you bypass firewalls

optional arguments:
  -h, --help      show this help message and exit
  --version       show version information

Proxy options:
  --save CONFIG   path to dump config
  -c CONFIG       path to config file
  -s SERVER_ADDR  server address, default: 0.0.0.0
  -p SERVER_PORT  server port, default: 8388
  -k PASSWORD     password
  --random        generate a random password to use
$ python lsserver.py --random --save config.json
generate random password
dump config file into 'config.json'
Listen to 0.0.0.0:8388

Please use:

lslocal -u "http://hostname:port/#vJjC3tW5l4nG7C3dHZ7hc77cIYrE2q0ikrWQw2MsRa9rqVlDU9vFTF5Hu6PX367kV6qRPU_z-Y_0sio4DAVV-1bmFrfoYoEHmmWkH9L1UDLZqOv8oYvPbe-miAg5Ow58aheFPitEeTX2bmhYC8nQFf1kA5lxpyc0Ljc2W2Du7TESlFIB8aJ7kz-DnczTXcsUv1oYlhpR-AbKf_DI8jMN_tRNdF-szgIJEQrqZ7alvfrNhCCVQNZ-EIIpSOOfXI7nnMC42B48h3egGzBsSpvpaXCNRhME4mEmePd2HFSrD0ty0SUAhjpvTv9BweUZgHrHKLG6Qi-zjLC0JEngI3VmfQ=="

to config lslocal

lslocal

用于运行在本地电脑的客户端,用于桥接本地浏览器和远程代理服务,传输前会混淆数据

$ python lslocal.py -h
usage: lslocal.py [-h] [--version] [--save CONFIG] [-c CONFIG] [-u URL]
                  [-s SERVER_ADDR] [-p SERVER_PORT] [-b LOCAL_ADDR]
                  [-l LOCAL_PORT] [-k PASSWORD]

A light tunnel proxy that helps you bypass firewalls

optional arguments:
  -h, --help      show this help message and exit
  --version       show version information

Proxy options:
  --save CONFIG   path to dump config
  -c CONFIG       path to config file
  -u URL          url contains server address, port and password
  -s SERVER_ADDR  server address
  -p SERVER_PORT  server port, default: 8388
  -b LOCAL_ADDR   local binding address, default: 127.0.0.1
  -l LOCAL_PORT   local port, default: 1080
  -k PASSWORD     password
$ python lslocal.py -u "http://remoteAddr:remotePort/#password" --save config.json
dump config file into 'config.json'
Listen to 127.0.0.1:1080

lightsocks-python's People

Contributors

linw1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightsocks-python's Issues

运行报错:too many file descriptors in select()

运行后,连续打开多个网站,很快出现以下报错信息,server端异常退出,请问如何解决
server端报错:
ValueError: too many file descriptors in select()
client端报错:
ConnectionError: 链接到远程服务器 127.0.0.1:8388 失败:
ConnectionRefusedError(10061, "Connect call failed ('127.0.0.1', 8388)")

無法執行

File "lsserver.py", line 12
def run_server(config: lsConfig.Config):
^
SyntaxError: invalid syntax

python 是2.7.3

Found using blocking method

if dstFamily:
dstServer = socket.socket(
family=dstFamily, type=socket.SOCK_STREAM)
dstServer.connect(dstAddress)
else:
dstServer = socket.create_connection(dstAddress)
dstServer.setblocking(False)

socket.create_connection contains the blocking method socket.getaddrinfo.

should use coroutine AbstractEventLoop.getaddrinfo(host, port, *, family=0, type=0, proto=0, flags=0) first, and then create new connection

SyntaxError: invalid syntax

python lsserver.py -h
File "lsserver.py", line 12
def run_server(config: lsConfig.Config):
^
SyntaxError: invalid syntax

学习

你好,能知道我安装吗,linode vps CentOS 6.8 ,安装了python3.6,还是没法安装lightsocks-python?
能指导我吗,可以微信

運行發生以下錯誤

Task exception was never retrieved
future: <Task finished coro=<LsServer.handleConn() done, defined at /home/cch/lightsocks-python-master/lightsocks/server.py:39> exception=gaierror(-2, 'Name or service not known')>
Traceback (most recent call last):
File "/home/cch/lightsocks-python-master/lightsocks/server.py", line 74, in handleConn
dstServer = socket.create_connection(dstAddress)
File "/usr/local/lib/python3.6/socket.py", line 704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

安裝好3.6(3.4還不行),試著執行出現以上問題。

server如何获取到目的地址?

local部分直接将收到的包加密转发给server,但是server却能够从和local的连接中获取到诸如目的地址等一系列信息:

The SOCKS request is formed as follows:
            +----+-----+-------+------+----------+----------+
            |VER | CMD |  RSV  | ATYP | DST.ADDR | DST.PORT |
            +----+-----+-------+------+----------+----------+
            | 1  |  1  | X'00' |  1   | Variable |    2     |
            +----+-----+-------+------+----------+----------+

请问这些信息是在什么时候写入的?

你好

用这个我是不是还要自己弄一个 代理服务器啊?

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.