Ejemplo n.º 1
0
if __name__ == '__main__':

    # 外部传参来决定修改哪种, 默认修改method
    choice = "method"
    correct_way = ("method", "password")

    if len(sys.argv) > 1:
        choice = sys.argv[1]
        if choice not in correct_way:
            print("传参有误!")
            exit(-1)
    else:
        print("请传以下参数来修改ss配置: {}".format(correct_way))
        exit(-1)

    gs = GroupSelector('修改SS')
    group = gs.group

    if group == None:
        exit(-1)
    elif type(group.node_list[0]) != SS:
        print("\n当前选择组不是Shadowsocks协议!\n")
        exit(-1)
    else:
        sm = SSFactory()
        gw = GroupWriter(group.tag, group.index)
        if choice == correct_way[0]:
            gw.write_ss_method(sm.get_method())
        elif choice == correct_way[1]:
            gw.write_ss_password(sm.get_password())
        print("修改Shadowsocks {}成功!\n".format(choice))
Ejemplo n.º 2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from writer import GroupWriter
from selector import GroupSelector

gs = GroupSelector('修改port')
group = gs.group

if group == None:
    exit(-1)
else:
    if group.end_port:
        port_info = "{0}-{1}".format(group.port, group.end_port)
    else:
        port_info = group.port
    print('当前组的端口信息为:{}'.format(port_info))

    port_strategy = "always"
    new_port_info = input("请输入新端口(支持输入端口范围, 用'-'隔开, 表示该范围的全部端口生效):")
    if new_port_info.isdecimal() or re.match(r'^\d+\-\d+$', new_port_info):
        gw = GroupWriter(group.tag, group.index)
        gw.write_port(new_port_info)
        print('端口修改成功!')
    else:
        print("输入错误!")
Ejemplo n.º 3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from utils import is_email
from group import Vmess, Socks, Mtproto, SS
from writer import GroupWriter, NodeWriter
from selector import GroupSelector

gs = GroupSelector('user数量')
group = gs.group
group_list = gs.group_list

if group == None:
    exit(-1)
else:
    email = ""
    if type(group.node_list[0]) == Vmess:
        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:
Ejemplo n.º 4
0
                                    "请输入序号选择伪装协议: ").select()
            kw = {'security': security, 'key': key, 'header': header}
        sw.write(**kw)

    def random_kcp(self):
        kcp_list = ('mKCP + srtp', 'mKCP + utp', 'mKCP + wechat-video',
                    'mKCP + dtls')
        choice = random.randint(4, 7)
        print("随机一种 (srtp | wechat-video | utp | dtls) header伪装, 当前生成 {} \n".
              format(kcp_list[choice - 4]))
        self.select(choice)


if __name__ == '__main__':

    gs = GroupSelector('修改传输方式')
    group = gs.group

    if group == None:
        exit(-1)
    else:
        sm = StreamModifier(group.tag, group.index)

        print("当前组的传输方式为:{}".format(group.node_list[0].stream()))
        print("")
        for index, stream_type in enumerate(sm.stream_type):
            print("{0}.{1}".format(index + 1, stream_type[1]))

        choice = input()

        if not choice.isdecimal():
Ejemplo n.º 5
0
            if not os.path.exists(crt_file) or not os.path.exists(key_file):
                print("证书crt文件或者key文件指定路径不存在!\n")
                return
            domain = get_domain_by_crt_file(crt_file)
            if not domain:
                print("证书文件有误!\n")
                return
            self.writer.write_tls(True, crt_file=crt_file, key_file=key_file, domain=domain)
        else:
            print("输入有误!\n")
    
    def turn_off(self):
        self.writer.write_tls(False)

if __name__ == '__main__':
    gs = GroupSelector('修改TLS')
    group = gs.group

    if group == None:
        exit(-1)
    else:
        if type(group.node_list[0]) == Mtproto or type(group.node_list[0]) == SS:
            print("\nv2ray MTProto/Shadowsocks协议不支持配置https!!!\n")
            exit(-1)
        tm = TLSModifier(group.tag, group.index)
        tls_status = '开启' if group.tls == 'tls' else '关闭'
        print("当前选择组节点状态:{}\n".format(tls_status))
        print("")
        print("1.开启TLS")
        print("2.关闭TLS")
        choice = input("请输入数字选择功能:")
Ejemplo n.º 6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from writer import NodeWriter
from selector import GroupSelector
from utils import clean_iptables

gs = GroupSelector('删除port')
group = gs.group

if group == None:
    pass
else:
    print("你要删除的Group组所有节点信息: ")
    print(group)
    choice = input("是否删除y/n:").lower()
    if choice == 'y':
        nw = NodeWriter()
        nw.del_port(group)
        clean_iptables(group.port)
    else:
        print("撤销删除")
Ejemplo n.º 7
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from writer import GroupWriter
from selector import GroupSelector

gs = GroupSelector('修改动态端口')
group = gs.group

if group == None:
    pass
else:
    print('当前组的动态端口状态:{}'.format(group.dyp))
    gw = GroupWriter(group.tag, group.index)

    choice = input("是否开启动态端口(y/n): ").lower()

    if choice == 'y':
        newAlterId = input("请为动态端口设置alterID(默认32): ")
        newAlterId = '32' if newAlterId == '' else newAlterId
        if (newAlterId.isdecimal()):
            gw.write_dyp(True, newAlterId)
            print("\n成功开启动态端口!")
        else:
            print("\n输入错误,请检查是否为数字")
    elif choice == 'n':
        gw.write_dyp(False)
        print("\n成功关闭动态端口!")
    else:
        print("\n输入错误,请检查重新输入")
Ejemplo n.º 8
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from group import Mtproto, SS
from writer import GroupWriter
from selector import GroupSelector

gs = GroupSelector('修改tcpFastOpen')
group = gs.group

if group == None:
    exit(-1)
else:
    if type(group.node_list[0]) == Mtproto or type(group.node_list[0]) == SS:
        print("\nv2ray MTProto/Shadowsocks协议不支持配置tcpFastOpen!!!\n")
        exit(-1)
    
    print('当前组的tcpFastOpen状态:{}'.format(group.tfo))
    print("")
    print("1.开启TFO(强制开启)")
    print("2.关闭TFO(强制关闭)")
    print("3.删除TFO(使用系统默认设置)")
    choice = input("请输入数字选择功能:")
    
    gw = GroupWriter(group.tag, group.index)
    if choice == "1":
        gw.write_tfo('on')
    elif choice == "2":
        gw.write_tfo('off')
    elif choice == "3":
        gw.write_tfo('del')
    else: