1 line
13 KiB
JSON
1 line
13 KiB
JSON
|
|
{"ast":null,"code":"let axios_config = require(\"./config\");\nimport { ZeroCodeAxios } from \"@/request/request\";\nconst components = {};\nconst data = function () {\n return {\n waf_status: {\n modsecurity_installed: false,\n modsecurity_config: false,\n owasp_crs: false\n },\n ufw_status: false,\n info_show: \"\",\n ban_form: {\n ip: \"\",\n port: \"\"\n }\n };\n};\nfunction mounted() {}\nconst methods = {\n get_config_data(config_data) {\n let new_data = config_data;\n new_data = this.format_data(config_data);\n return new_data;\n },\n format_data(dict) {\n if (typeof dict == \"string\") {\n dict = eval(dict);\n } else {\n for (const key in dict) {\n let value = dict[key];\n if (typeof value == \"object\") {\n this.format_data(value);\n } else {\n if (typeof value == 'number') {\n dict[key] = value;\n } else {\n if (value.includes(\"this.\")) {\n if (dict.hasOwnProperty(key)) {\n dict[key] = eval(value);\n }\n } else {\n if (value.includes(\".\")) {\n if (dict.hasOwnProperty(key)) {\n dict[key] = eval(value);\n }\n } else {\n dict[key] = value;\n }\n }\n }\n }\n }\n }\n return dict;\n },\n get_waf_info() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.get_waf_info.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n },\n install_waf() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.install_waf.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n },\n open_ufw() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.open_ufw.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n },\n get_log_analyze() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.get_log_analyze.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n },\n ban_ip() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.ban_ip.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n },\n get_ufw_status() {\n const {\n url,\n method,\n data: originalData,\n then\n } = axios_config.get_ufw_status.axios;\n const data = JSON.parse(JSON.stringify(originalData));\n let new_data = this.get_config_data(data);\n // 发起请求\n ZeroCodeAxios({\n method,\n url,\n data: new_data\n }).then(res => {\n // 执行回调函数(then回调)\n eval(then);\n });\n }\n};\nexport defau
|