Пример #1
0
    def list(kind=None):

        if kind == "lhost":
            # 获取pem秘钥文件,用于https监听配置
            files = FileMsf.list_msf_files()
            pem_files = []
            for file in files:
                name = file.get("name")
                if name.lower().endswith(".pem"):
                    pem_files.append(name)

            conf = Xcache.get_lhost_config()
            if conf is None:
                conf = {'lhost': None, "pem_files": pem_files}
            else:
                conf["pem_files"] = pem_files

        elif kind == "telegram":
            conf = Xcache.get_telegram_conf()
            if conf is None:
                conf = {
                    "token": "",
                    "chat_id": [],
                    "proxy": "",
                    "alive": False
                }

        elif kind == "dingding":
            conf = Xcache.get_dingding_conf()
            if conf is None:
                conf = {"access_token": "", "keyword": "", "alive": False}
        elif kind == "serverchan":
            conf = Xcache.get_serverchan_conf()
            if conf is None:
                conf = {"sendkey": "", "alive": False}
        elif kind == "FOFA":
            conf = Xcache.get_fofa_conf()
            if conf is None:
                conf = {"email": "", "key": "", "alive": False}
        elif kind == "sessionmonitor":
            conf = Xcache.get_sessionmonitor_conf()
        else:
            context = data_return(301, Setting_MSG.get(301), {})
            return context

        context = data_return(200, CODE_MSG.get(200), conf)
        return context
Пример #2
0
 def get_lhost():
     conf = Xcache.get_lhost_config()
     if conf is None:
         return None
     else:
         return conf.get("lhost")