Exemple #1
0
#获取本机IP地址
myip = tool_box.get_ip()

#打开服务器端配置文件
with open('/etc/v2ray/config.json', 'r') as json_file:
    config = json.load(json_file)

mul_user_conf = read_json.multiUserConf

user_index=0

if len(mul_user_conf) > 1:
    import server_info
    choice=input("请输入要生成客户端json的节点序号:")
    if tool_box.is_number(choice):
        choice = int(choice)
        if choice > 0 and choice <= len(mul_user_conf):
            user_index = choice - 1
        else:
            print ("输入错误,请检查数字是否在范围中")
            exit
    else:
        print("输入错误,请检查是否为数字")
        exit

index_dict = mul_user_conf[user_index]['indexDict']

protocol = mul_user_conf[user_index]['protocol']

if index_dict['inboundOrDetour'] == 0:
Exemple #2
0
    #选择新的传输方式
    print("请选择新的传输方式:")
    print("1.普通TCP")
    print("2.HTTP伪装")
    print("3.WebSocket流量")
    print("4.普通mKCP")
    print("5.mKCP + srtp")
    print("6.mKCP + utp")
    print("7.mKCP + wechat-video")
    print("8.mKCP + dtls")
    print("9.HTTP/2")
    print("10.Socks5")
    print("11.MTProto")
    print("12.Shadowsocks")

    new_stream_network = input()

    if not tool_box.is_number(new_stream_network):
        print("请输入数字!")
    else:
        new_stream_network = int(new_stream_network)
        if new_stream_network > 0 and new_stream_network < 13:
            if (new_stream_network == 11 or new_stream_network
                    == 12) and temp_user_conf["tls"] == "tls":
                print("v2ray MTProto/Shadowsocks不支持https, 关闭tls成功!")
            v2ray_util.choice_stream(new_stream_network, index_dict)
            print("传输模式修改成功!")
        else:
            print("请输入有效数字!")
else:
    print("输入有误,请检查是否为字母且范围中")
Exemple #3
0
        is_reset = (False if choice == "3" else True)
        action_info = ("查看" if choice == "3" else "重置")
        if read_json.conf_stats == "关闭":
            print("流量统计开启状态才能%s统计\n" % action_info)
            continue

        if length > 1:
            os.system("python3 /usr/local/multi-v2ray/server_info.py")

            schoice = input("请输入所需要%s流量的组别(字母)或者序号(数字)" % action_info)
        else:
            schoice = "A"

        door_port = read_json.conf_door_port
        schoice = schoice.upper()
        if tool_box.is_number(schoice):
            schoice = int(schoice)
            if schoice > 0 and schoice <= length:
                email = mul_user_conf[schoice - 1]["email"]
                if email == "":
                    print("无有效邮箱,无法统计!!!\n")
                else:
                    stats_result = v2ray_util.get_stats(
                        0, email, door_port, is_reset)
                    if stats_result:
                        v2ray_util.print_stats(stats_result)
                continue
        elif re.match(r'[A-Z]', schoice
                      ) and schoice <= mul_user_conf[-1]['indexDict']['group']:
            stats_result = v2ray_util.get_stats(1, schoice, door_port,
                                                is_reset)
Exemple #4
0
    choice = input("请输入要改动态端口的节点Group字母:")
    choice = choice.upper()

if length == 1 or (len(choice) == 1 and re.match(r'[A-Z]', choice)
                   and choice <= mul_user_conf[-1]['indexDict']['group']):

    for sin_user_conf in mul_user_conf:
        if sin_user_conf['indexDict']['group'] == choice:
            index_dict = sin_user_conf['indexDict']
            print("当前组动态端口状态:%s\n" % str(sin_user_conf['dyp']))
            break

    dp = input("是否开启动态端口(y/n)")

    if dp == 'y' or dp == 'Y':
        newAlterId = input("请为动态端口设置alterID(默认32): ")
        if newAlterId == '':
            newAlterId = '32'
        if (not tool_box.is_number(newAlterId)):
            print("\n输入错误,请检查是否为数字")
        else:
            write_json.en_dyn_port(1, index_dict, newAlterId)
            print("\n成功开启动态端口!")
    elif dp == 'n' or dp == 'N':
        write_json.en_dyn_port(0, index_dict)
        print("\n成功关闭动态端口!")
    else:
        print("\n输入错误,请检查重新输入")
else:
    print("输入有误,请检查是否为字母且范围中")
Exemple #5
0
import re
from base_util import tool_box

mul_user_conf = read_json.multiUserConf

length = len(mul_user_conf)

choice = 'A'

if length > 1:
    import server_info
    choice=input("请输入要改port的节点Group字母:")
    choice=choice.upper()

if length == 1 or (len(choice)==1 and re.match(r'[A-Z]', choice) and choice <= mul_user_conf[-1]['indexDict']['group']):
    for sin_user_conf in mul_user_conf:
        if sin_user_conf['indexDict']['group'] == choice:
            index_dict = sin_user_conf['indexDict']
            print ("当前组的端口为:%s" % str(sin_user_conf['port'])) 
            break

    print ("请输入新端口:")
    new_port=input()
    if (tool_box.is_number(new_port)):
        write_json.write_port(new_port, index_dict)
        print('端口修改成功!')
    else:
        print("输入错误,请检查是否为数字")
else:
    print("输入有误,请检查是否为字母且范围中")
Exemple #6
0
import re
from base_util import tool_box

mul_user_conf = read_json.multiUserConf

length = len(mul_user_conf)

choice = 'A'

if length > 1:
    import server_info
    choice = input("请输入要改port的节点Group字母:")
    choice = choice.upper()

if length == 1 or (len(choice) == 1 and re.match(r'[A-Z]', choice)
                   and choice <= mul_user_conf[-1]['indexDict']['group']):
    for sin_user_conf in mul_user_conf:
        if sin_user_conf['indexDict']['group'] == choice:
            index_dict = sin_user_conf['indexDict']
            print("当前组的端口为:%s" % str(sin_user_conf['port']))
            break

    print("请输入新端口:")
    new_port = input()
    if (tool_box.is_number(new_port)):
        write_json.write_port(new_port, index_dict)
        print('端口修改成功!')
    else:
        print("输入错误,请检查是否为数字")
else:
    print("输入有误,请检查是否为字母且范围中")
Exemple #7
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import read_json
import write_json
from base_util import tool_box

mul_user_conf = read_json.multiUserConf

length = len(mul_user_conf)

choice = 1

if length > 1:
    import server_info
    choice=input("请输入要改email的节点序号数字:")
    if not tool_box.is_number(choice):
        print("输入错误,请检查是否为数字")
        exit()
    choice = int(choice)

if length == 1 or (choice > 0 and choice <= len(mul_user_conf)):
    if mul_user_conf[choice - 1]["protocol"] == "socks":
        print("Socks5节点 不支持写入email!")
        exit()
    print ("当前节点email为:%s" % mul_user_conf[choice - 1]['email'])
    email = ""
    while True:
        is_duplicate_email=False
        email = input("请输入新的email地址: ")
        if email == "":
            break
Exemple #8
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import read_json
import write_json
from base_util import tool_box

mul_user_conf = read_json.multiUserConf

length = len(mul_user_conf)

choice = 1

if length > 1:
    import server_info
    choice = input("请输入要改alterId的节点序号数字:")
    if not tool_box.is_number(choice):
        print("输入错误,请检查是否为数字")
        exit
    choice = int(choice)

if length == 1 or (choice > 0 and choice <= length):
    new_alterid = input("请输入新的alterID: ")
    if (tool_box.is_number(new_alterid)):
        write_json.write_alterid(new_alterid,
                                 mul_user_conf[choice - 1]['indexDict'])
        print("alterID修改成功!")
    else:
        print("输入错误,请检查是否为数字")
else:
    print("输入错误,请检查是否符合范围中")
Exemple #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import write_json
import random
from base_util import tool_box

random_port = random.randint(1000, 65535)
new_port = input("产生随机端口%d, 回车直接以该端口新建Group, 否则输入自定义端口: " % random_port)

if not new_port:
    new_port = random_port

if tool_box.is_number(new_port):
    print("新端口为: %d \n" % int(new_port))
    write_json.create_new_port(new_port)
else:
    print("\n输入错误,请检查是否为数字")
Exemple #10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import read_json
import write_json
from base_util import tool_box

mul_user_conf = read_json.multiUserConf

length = len(mul_user_conf)

choice = 1

if length > 1:
    import server_info
    choice=input("请输入要删除的user节点序号数字:")
    if not tool_box.is_number(choice):
        print("输入错误,请检查是否为数字")
        exit
    choice = int(choice)

if length==1 or (choice > 0 and choice <= len(mul_user_conf)):
    print("你选择的user信息:")
    print(mul_user_conf[choice - 1])
    schoice = input("是否删除y/n:")
    if schoice == 'y' or schoice == 'Y':
        write_json.del_user(choice - 1)
    else:
        print("撤销删除")
else:
    print ("输入错误,请检查是否符合范围中")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import write_json
import random
from base_util import tool_box

random_port = random.randint(1000, 65535)
new_port=input("产生随机端口%d, 回车直接以该端口新建Group, 否则输入自定义端口: " % random_port)

if not new_port:
    new_port = random_port

if tool_box.is_number(new_port):
    print("新端口为: %d \n" % int(new_port))
    write_json.create_new_port(new_port)
else:
    print ("\n输入错误,请检查是否为数字")
Exemple #12
0
    import server_info
    choice=input("请输入要改动态端口的节点Group字母:")
    choice=choice.upper()

if length == 1 or (len(choice)==1 and re.match(r'[A-Z]', choice) and choice <= mul_user_conf[-1]['indexDict']['group']):

    for sin_user_conf in mul_user_conf:
        if sin_user_conf['indexDict']['group'] == choice:
            index_dict = sin_user_conf['indexDict']
            print ("当前组动态端口状态:%s\n" % str(sin_user_conf['dyp'])) 
            break

    dp=input("是否开启动态端口(y/n)")

    if dp == 'y' or dp == 'Y':
        newAlterId=input("请为动态端口设置alterID(默认32): ")
        if newAlterId == '':
            newAlterId='32'
        if (not tool_box.is_number(newAlterId)):
            print ("\n输入错误,请检查是否为数字")
        else:
            write_json.en_dyn_port(1, index_dict, newAlterId)
            print("\n成功开启动态端口!")
    elif dp == 'n' or dp == 'N':
        write_json.en_dyn_port(0, index_dict)
        print("\n成功关闭动态端口!")
    else:
        print ("\n输入错误,请检查重新输入")
else:
    print("输入有误,请检查是否为字母且范围中")
Exemple #13
0
#加载客户端配置模板
with open('/usr/local/v2ray.fun/json_template/client.json', 'r') as client_json_file:
    client_config = json.load(client_json_file)

#打开服务器端配置文件
with open('/etc/v2ray/config.json', 'r') as json_file:
    config = json.load(json_file)

mul_user_conf = read_json.multiUserConf

user_index=0

if len(mul_user_conf) > 1:
    import server_info
    choice=input("请输入要生成客户端json的节点序号:")
    if tool_box.is_number(choice) and choice > 0 and choice <= len(mul_user_conf):
        user_index = choice - 1
    else:
        print ("输入错误,请检查是否为数字和范围中")

#使用服务端配置来修改客户端模板
index_dict=mul_user_conf[user_index]['indexDict']
if index_dict['inboundOrDetour'] == 0:
    part_json = config[u"inbound"]
else:
    detour_index= index_dict['detourIndex']
    part_json = config[u"inboundDetour"][detour_index]

client_config[u"outbound"][u"settings"][u"vnext"][0][u"port"]=mul_user_conf[user_index]['port']
client_config[u"outbound"][u"settings"][u"vnext"][0][u"users"][0][u"id"]=mul_user_conf[user_index]['id']
client_config[u"outbound"][u"streamSettings"]=part_json[u"streamSettings"]
Exemple #14
0
            break

    print ("")
    #选择新的传输方式
    print ("请选择新的传输方式:")
    print ("1.普通TCP")
    print ("2.HTTP伪装")
    print ("3.WebSocket流量")
    print ("4.普通mKCP")
    print ("5.mKCP + srtp")
    print ("6.mKCP + utp")
    print ("7.mKCP + wechat-video")
    print ("8.mKCP + dtls")
    print ("9.HTTP/2")
    print ("10.Socks5")

    new_stream_network=input()
    
    if not tool_box.is_number(new_stream_network):
        print("请输入数字!")
        exit
    else:
        new_stream_network = int(new_stream_network)
        if new_stream_network > 0 and new_stream_network < 11:
            v2ray_util.choice_stream(new_stream_network, index_dict)
            print("传输模式修改成功!")
        else:
            print("请输入有效数字!")
            exit
else:
    print("输入有误,请检查是否为字母且范围中")