Total Pageviews

Saturday, 16 July 2022

ssr-command-client

 在Github上发现ssr command client这个项目,持续更新两年多了,据开发者说该项目已经基本成熟,自带 shadowsocksr 源码,支持 python3,之所以开发,主要是市面上没有一款合适Linux系统下,在中国大陆翻墙科学上网的终端使用。目前支持shadowsocksr 的命令行客户端,支持订阅,后续会开放V2ray协议版本支持。

项目地址

  • https://github.com/TyrantLucifer/ssr-command-client

内容详情

支持Linux+Windows+Mac全平台,不过是需要用命令行开启和管理。

--------------

The commend client of ssr based on Python3.

shadowsocks-cli

GitHub release (latest by date)

English | 中文

The command client of shadowsocksr based by python

Features

  • Support Linux + Windows + Mac all platforms
  • Support parse shadowsocksr url
  • Support parse multi shadowsocksr subscribe urls
  • Support assign the port of local proxy
  • Support test shadowsockr node delay
  • Support test shadowsocksr node is or not blocked by tcp
  • Support test shadowsocksr node download and upload speed
  • Support test node Netflix unlocking situation
  • Support generate json and qrcode for shadowsocksr node
  • Support generate clash config file for your shadowsocksr subscribe
  • Support open http pac proxy
  • Not Support ipv6 shadowsocksr node
  • Developed by pure python

Install

  • install using source code
git clone https://github.com/TyrantLucifer/ssr-command-client.git
cd ssr-command-client
python(python3) setup.py install
  • install using pip tool
pip(pip3) install shadowsocksr-cli

Usage

usage: shadowsocksr-cli [-h] [-l] [-p local_port] [-s ssr_id]       
                        [-S [ssr_id]] [-u] [-v] [--generate-clash]  
                        [--display-json ssr_id]
                        [--test-speed ssr_id]                       
                        [--test-netflix ssr_id] [--test-netflix-all]
                        [--fast-node]                               
                        [--setting-url ssr_subscribe_url]           
                        [--setting-address ssr_local_address]       
                        [--list-url] [--add-url ssr_subscribe_url]  
                        [--remove-url ssr_subscribe_url]
                        [--list-address] [--parse-url ssr_url]        
                        [--add-ssr ssr_url]
                        [--test-again ssr_node_id]
                        [--print-qrcode ssr_node_id]
                        [--http action[start stop status]]
                        [--http-port http server port]
                        [--setting-global-proxy]
                        [--setting-pac-proxy] [--close-system-proxy]  

The shadowsocksr command client based Python.

optional arguments:
  -h, --help            show this help message and exit
  -l, --list            show ssr list
  -p local_port, --port local_port
                        assign local proxy port,use with -s
  -s ssr_id, --start ssr_id
                        start ssr proxy
  -S [ssr_id], --stop [ssr_id]
                        stop ssr proxy
  -u, --update          update ssr list
  -v, --version         display version
  --generate-clash      generate clash config yaml
  --display-json ssr_id
                        display ssr json info
  --test-speed ssr_id   test ssr nodes download and upload speed      
  --test-netflix ssr_id
                        test ssr nodes if or not watch netflix        
  --test-netflix-all    test all ssr nodes if or not watch netflix    
  --fast-node           find most fast by delay and start ssr proxy   
  --setting-url ssr_subscribe_url
                        setting ssr subscribe url
  --setting-address ssr_local_address
                        setting ssr local address
  --list-url            list ssr subscribe url
  --add-url ssr_subscribe_url
                        add ssr subscribe url
  --remove-url ssr_subscribe_url
                        remove ssr subscribe url
  --list-address        list ssr local address
  --parse-url ssr_url   pares ssr url
  --add-ssr ssr_url     add ssr node
  --test-again ssr_node_id
                        test ssr node again
  --print-qrcode ssr_node_id
                        print ssr node qrcode
  --http action[start stop status]
                        Manager local http server
  --http-port http server port
                        assign local http server port
  --setting-global-proxy
                        setting system global proxy,only support on   
                        Ubuntu Desktop
  --setting-pac-proxy   setting system pac proxy,only support on      
                        Ubuntu Desktop
  --close-system-proxy  close system proxy,only support on
                        Ubuntu Desktop

Simple Examples

Supposed your shadowsocksr nodes list as below:
+----+----------------------------+-----------+---------+----------------+------+-------------+
| id |            name            | delay(ms) | connect |     server     | port |    method   |
+----+----------------------------+-----------+---------+----------------+------+-------------+
| 0  |    SSRTOOL_Node:新加坡-    |     100     |    √    | 172.104.161.54 | 8099 | aes-256-cfb |
| 1  | SSRTOOL_Node:美国-密苏里州  |     200     |    √    |  69.30.201.82  | 8099 | aes-256-cfb |
+----+----------------------------+-----------+---------+----------------+------+-------------+
  • open the us proxy shadowsocksr-cli -s 1
  • print the list of all nodes shadowsocksr-cli -l
  • update subscribe list shadowsocksr-cli -u
  • reset shadowsocksr subcribe url shadowsocksr-cli --setting-url https://tyrantlucifer.com/ssr/ssr.txt
  • print the current subcribe urls that you had been setting shadowsocksr-cli --list-url
  • print the listen address shadowsocksr-cli --list-address

API

  • parse shadowsocksr node information by shadowsocksr url, shadowsocksr url must be looked like 'ssr://xxxxx'
import json
from shadowsocksr_cli.parse_utils import *

ssr_url = "ssr://NjkuMzAuMjAxLjgyOjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVEvP3JlbWFya3M9VTFOU1ZFOVBURjlPYjJSbE91ZS1qdVdidlMzbHI0Ym9pNF9waDR6bHQ1NCZncm91cD1WMWRYTGxOVFVsUlBUMHd1UTA5Tg"
ssr_dict = ParseShadowsocksr.parse_shadowsocksr(ssr_url)
print(json.dumps(ssr_dict,
                 ensure_ascii=False,
                 indent=4))
  • get the connect information of a shadowsocksr node by shadowsocksr url, shadowsocksr url must be looked like 'ssr://xxxxx'
from shadowsocksr_cli.parse_utils import *
from shadowsocksr_cli.network_test_utils import *

ssr_url = "ssr://NjkuMzAuMjAxLjgyOjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVEvP3JlbWFya3M9VTFOU1ZFOVBURjlPYjJSbE91ZS1qdVdidlMzbHI0Ym9pNF9waDR6bHQ1NCZncm91cD1WMWRYTGxOVFVsUlBUMHd1UTA5Tg"
ssr_dict = ParseShadowsocksr.parse_shadowsocksr(ssr_url)
ssr_dict = ShadowsocksrTest.test_shadowsocksr_connect(ssr_dict)
print(ssr_dict['connect'],
      ssr_dict['ping'])
  • test shadowsocksr node download and upload information by shadowsocksr url, shadowsocksr url must be looked like 'ssr://xxxxx'
from shadowsocksr_cli.parse_utils import *
from shadowsocksr_cli.network_test_utils import *

ssr_url = "ssr://NjkuMzAuMjAxLjgyOjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVEvP3JlbWFya3M9VTFOU1ZFOVBURjlPYjJSbE91ZS1qdVdidlMzbHI0Ym9pNF9waDR6bHQ1NCZncm91cD1WMWRYTGxOVFVsUlBUMHd1UTA5Tg"
ssr_dict = ParseShadowsocksr.parse_shadowsocksr(ssr_url)
ssr_dict = ShadowsocksrTest.test_shadowsocksr_connect(ssr_dict)
ShadowsocksrTest.test_shadowsocksr_speed(ssr_dict)

How to use proxy in linux shell

  • setting proxy for linux shell export ALL_PROXY=socks5://127.0.0.1:1080
  • you can use this command to test is or not you setting proxy successfully curl http://ip-api.com/json/?lang=zh-CN
  • unset proxy for linux shell unset ALL_PROXY
  • add the following content in you ~/.bashrc is a best practise
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
alias unsetproxy="unset ALL_PROXY"
alias ip="curl http://ip-api.com/json/?lang=zh-CN"
Telegram:https://t.me/ssr_command_client 
from https://github.com/TyrantLucifer/ssr-command-client

 

 

No comments:

Post a Comment