Beispiel #1
0
def modify_user(client_index):
    success, msg, modify_type = True, "modify user {} success!!!".format(
        client_index), ""
    try:
        json_request = json.loads(request.get_data())
        modify_type = json_request['modify_type']
        value = json_request['value']
        loader.load_profile()
        group_list = loader.profile.group_list
        group, client_index = find_client(group_list, client_index)
        cw = ClientWriter(group.tag, group.index, client_index)
        method = 'write_' + modify_type
        if hasattr(cw, method):
            func = getattr(cw, method)
            func(value)
        else:
            raise RuntimeError("{} method not found".format(method))
    except Exception as e:
        success = False
        msg = str(e)
    return jsonify(ResponseJson(success, msg).__dict__)
Beispiel #2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import uuid

from group import Vmess
from writer import ClientWriter
from selector import ClientSelector

cs = ClientSelector('修改uuid')
group = cs.group

if group == None:
    pass
else:
    client_index = cs.client_index
    if type(group.node_list[client_index]) == Vmess:
        print("当前节点UUID为:{}".format(group.node_list[client_index].password))
        choice = input("是否要随机生成一个新的UUID (y/n):").lower()
        if choice == "y":
            new_uuid = uuid.uuid1()
            print("新的UUID为:{}".format(new_uuid))
            cw = ClientWriter(group.tag, group.index, client_index)
            cw.write_uuid(new_uuid)
            print("UUID修改成功!")
        else:
            print("已取消生成新的UUID,未执行任何操作")
    else:
        print("只有vmess协议才能修改uuid!")
Beispiel #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from group import Vmess
from writer import ClientWriter
from selector import ClientSelector

cs = ClientSelector('修改alterId')
group = cs.group

if group == None:
    pass
else:
    client_index = cs.client_index
    if type(group.node_list[client_index]) == Vmess:
        print("当前节点alterID: {}".format(group.node_list[client_index].alter_id))
        new_alterid = input("请输入新的alterID: ")
        if (new_alterid.isnumeric()):
            cw = ClientWriter(group.tag, group.index, client_index)
            cw.write_aid(int(new_alterid))
            print("alterID修改成功!")
        else:
            print("输入错误,请检查是否为数字")
    else:
        print("只有vmess协议才能修改alterId!")
Beispiel #4
0
    exit(-1)
elif type(group.node_list[0]) == Socks:
    print("Socks5节点 不支持写入email!")
    exit(-1)
else:
    print("当前节点email为:{}".format(group.node_list[client_index].user_info))
    email = ""
    while True:
        is_duplicate_email = False
        email = input("请输入新的email地址: ")
        if email == "":
            break
        if not is_email(email):
            print("不是合格的email格式,请重新输入")
            continue

        for loop_group in group_list:
            for node in loop_group.node_list:
                if node.user_info == None or node.user_info == '':
                    continue
                elif node.user_info == email:
                    print("已经有重复的email, 请重新输入")
                    is_duplicate_email = True
                    break
        if not is_duplicate_email:
            break

    if email != "":
        cw = ClientWriter(group.tag, group.index, client_index)
        cw.write_email(email)
        print("修改email成功!")