diff --git a/ChangeLog.md b/ChangeLog.md index 2cc5306..f479f60 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,20 @@ 3. 增加全局搜索 4. 增加资产导入接口,漏洞导入接口 +### 正式版 V2.0.1 - 20201009 + +部署脚本: +1. 增加部署脚本执行目录判断(issues #3 建议判断或约束一下安装脚本执行目录) +2. 增加agent.yml内容是否已经修改判断 +3. 增加center和agent所需文件判断 +4. 增加前端api地址是否修改判断 +5. 增加操作系统判断 +6. 修复多次重新部署的时候,环境变量会写入多次 +7. 优化脚本日志输出,屏蔽非脚本错误输出,优化所有脚本 +8. Python升级到3.9.0 +9. 部署脚本运行结束时,增加信息和错误提示 +10. 移除agentDependency,nmap更新到7.90 + ### 正式版 V2.0 - 20200925 正式版发布,同时开源 diff --git a/deploy/GenPass.bat b/deploy/GenPass.bat index 4744711..b4170f8 100755 --- a/deploy/GenPass.bat +++ b/deploy/GenPass.bat @@ -1,2 +1,3 @@ java -cp GenPass.jar com.eveino.GenPass +@echo off pause \ No newline at end of file diff --git a/deploy/MagiCude/agentDependency/libpcap-devel-1.5.3-12.el7.x86_64.rpm b/deploy/MagiCude/agentDependency/libpcap-devel-1.5.3-12.el7.x86_64.rpm deleted file mode 100755 index 005e8b5..0000000 Binary files a/deploy/MagiCude/agentDependency/libpcap-devel-1.5.3-12.el7.x86_64.rpm and /dev/null differ diff --git a/deploy/MagiCude/agentDependency/nmap-7.80-1.x86_64.rpm b/deploy/MagiCude/agentDependency/nmap-7.80-1.x86_64.rpm deleted file mode 100755 index ae45d9d..0000000 Binary files a/deploy/MagiCude/agentDependency/nmap-7.80-1.x86_64.rpm and /dev/null differ diff --git a/deploy/MagiCude/db/.gitignore b/deploy/MagiCude/db/.gitignore new file mode 100755 index 0000000..68ec3d7 --- /dev/null +++ b/deploy/MagiCude/db/.gitignore @@ -0,0 +1 @@ +.ignore \ No newline at end of file diff --git a/deploy/MagiCude/dist/index.html b/deploy/MagiCude/dist/index.html index dac5d7c..2bdf6b4 100644 --- a/deploy/MagiCude/dist/index.html +++ b/deploy/MagiCude/dist/index.html @@ -1 +1 @@ -<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>魔方-MagiCude</title><link href=/static/css/chunk-elementUI.68c70ad5.css rel=stylesheet><link href=/static/css/chunk-libs.ee57d822.css rel=stylesheet><link href=/static/css/app.03c741a6.css rel=stylesheet></head><body><noscript><strong>We're sorry but 魔方-MagiCude doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(c){function e(e){for(var u,f,h=e[0],t=e[1],r=e[2],k=0,b=[];k<h.length;k++)f=h[k],Object.prototype.hasOwnProperty.call(d,f)&&d[f]&&b.push(d[f][0]),d[f]=0;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&(c[u]=t[u]);o&&o(e);while(b.length)b.shift()();return a.push.apply(a,r||[]),n()}function n(){for(var c,e=0;e<a.length;e++){for(var n=a[e],u=!0,f=1;f<n.length;f++){var h=n[f];0!==d[h]&&(u=!1)}u&&(a.splice(e--,1),c=t(t.s=n[0]))}return c}var u={},f={runtime:0},d={runtime:0},a=[];function h(c){return t.p+"static/js/"+({}[c]||c)+"."+{"chunk-04a53b9c":"0199b051","chunk-051ee970":"b3676c2f","chunk-0743f666":"7c7dd864","chunk-085da9d9":"ddb6289f","chunk-0b3900d1":"396cf6a1","chunk-0c147953":"e61fb172","chunk-17108e1b":"258e6544","chunk-2824ff8e":"75b3c8fe","chunk-6563a41c":"855a2964","chunk-6c968c8c":"af36fbba","chunk-0f567348":"82c3f664","chunk-135b92be":"3c658b00","chunk-18be2291":"06bd3dc4","chunk-1c0778a3":"d90656b5","chunk-287cda81":"9dcac459","chunk-2d22676b":"9aa0c560","chunk-2f6f00b6":"fe27d054","chunk-305b8ac2":"6502df54","chunk-367cb1c8":"1c98df24","chunk-38969063":"83f50284","chunk-40bc77e4":"6de01222","chunk-444ad2a0":"d95b94c1","chunk-455bdd50":"8f9f4aae","chunk-4e589dbf":"1b3001e6","chunk-52aa8469":"cc459b44","chunk-569e313f":"a240b8b4","chunk-5d68df8b":"d3e1cba3","chunk-6166da60":"298daf19","chunk-64b30f9d":"1da1a167","chunk-027d9023":"bb090dd6","chunk-0c2da520":"815b8b11","chunk-1cf15413":"2b203d97","chunk-22d4a2d3":"9e3dc1bb","chunk-64744614":"4fab3b90","chunk-64b92768":"b1ab386c","chunk-95ae55b6":"947aba68","chunk-ec05ab82":"ad6d49cc","chunk-f63fbd8a":"0f7d92c0","chunk-668ca980":"82edaf1c","chunk-67130b18":"686079a8","chunk-6899ff79":"0bcb413e","chunk-6b170cf8":"65ec81cd","chunk-748ae12c":"d3da1f03","chunk-7522baad":"6c5d9821","chunk-791f0458":"69f22435","chunk-79a1eced":"5fc9460b","chunk-87590162":"0d29739d","chunk-305fa922":"923aecf7","chunk-fb05caa4":"bfb4a3e7","chunk-8ccb92d4":"853ef675","chunk-8dfcdace":"a9ffd5d4","chunk-c0baf5ba":"88e4fb45","chunk-c6c1cf3e":"189ea7cd","chunk-e9309dee":"c331924f","chunk-f5778866":"a67d54f5","chunk-f261f684":"b2b79ac1","chunk-ffc23878":"146dbd22","chunk-3c2d6792":"4269755a","chunk-4411ea1b":"df398f88","chunk-ee77943a":"ad962326","chunk-19d17be9":"0edd777b","chunk-035d1156":"0d768776"}[c]+".js"}function t(e){if(u[e])return u[e].exports;var n=u[e]={i:e,l:!1,exports:{}};return c[e].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.e=function(c){var e=[],n={"chunk-367cb1c8":1,"chunk-5d68df8b":1,"chunk-ec05ab82":1,"chunk-67130b18":1,"chunk-6899ff79":1,"chunk-87590162":1,"chunk-305fa922":1,"chunk-fb05caa4":1,"chunk-f261f684":1};f[c]?e.push(f[c]):0!==f[c]&&n[c]&&e.push(f[c]=new Promise((function(e,n){for(var u="static/css/"+({}[c]||c)+"."+{"chunk-04a53b9c":"31d6cfe0","chunk-051ee970":"31d6cfe0","chunk-0743f666":"31d6cfe0","chunk-085da9d9":"31d6cfe0","chunk-0b3900d1":"31d6cfe0","chunk-0c147953":"31d6cfe0","chunk-17108e1b":"31d6cfe0","chunk-2824ff8e":"31d6cfe0","chunk-6563a41c":"31d6cfe0","chunk-6c968c8c":"31d6cfe0","chunk-0f567348":"31d6cfe0","chunk-135b92be":"31d6cfe0","chunk-18be2291":"31d6cfe0","chunk-1c0778a3":"31d6cfe0","chunk-287cda81":"31d6cfe0","chunk-2d22676b":"31d6cfe0","chunk-2f6f00b6":"31d6cfe0","chunk-305b8ac2":"31d6cfe0","chunk-367cb1c8":"a219e5b4","chunk-38969063":"31d6cfe0","chunk-40bc77e4":"31d6cfe0","chunk-444ad2a0":"31d6cfe0","chunk-455bdd50":"31d6cfe0","chunk-4e589dbf":"31d6cfe0","chunk-52aa8469":"31d6cfe0","chunk-569e313f":"31d6cfe0","chunk-5d68df8b":"7114ac7a","chunk-6166da60":"31d6cfe0","chunk-64b30f9d":"31d6cfe0","chunk-027d9023":"31d6cfe0","chunk-0c2da520":"31d6cfe0","chunk-1cf15413":"31d6cfe0","chunk-22d4a2d3":"31d6cfe0","chunk-64744614":"31d6cfe0","chunk-64b92768":"31d6cfe0","chunk-95ae55b6":"31d6cfe0","chunk-ec05ab82":"7114ac7a","chunk-f63fbd8a":"31d6cfe0","chunk-668ca980":"31d6cfe0","chunk-67130b18":"46e39697","chunk-6899ff79":"a6223c38","chunk-6b170cf8":"31d6cfe0","chunk-748ae12c":"31d6cfe0","chunk-7522baad":"31d6cfe0","chunk-791f0458":"31d6cfe0","chunk-79a1eced":"31d6cfe0","chunk-87590162":"b11eb12c","chunk-305fa922":"34d47b8e","chunk-fb05caa4":"34d47b8e","chunk-8ccb92d4":"31d6cfe0","chunk-8dfcdace":"31d6cfe0","chunk-c0baf5ba":"31d6cfe0","chunk-c6c1cf3e":"31d6cfe0","chunk-e9309dee":"31d6cfe0","chunk-f5778866":"31d6cfe0","chunk-f261f684":"f1f1adb3","chunk-ffc23878":"31d6cfe0","chunk-3c2d6792":"31d6cfe0","chunk-4411ea1b":"31d6cfe0","chunk-ee77943a":"31d6cfe0","chunk-19d17be9":"31d6cfe0","chunk-035d1156":"31d6cfe0"}[c]+".css",d=t.p+u,a=document.getElementsByTagName("link"),h=0;h<a.length;h++){var r=a[h],k=r.getAttribute("data-href")||r.getAttribute("href");if("stylesheet"===r.rel&&(k===u||k===d))return e()}var b=document.getElementsByTagName("style");for(h=0;h<b.length;h++){r=b[h],k=r.getAttribute("data-href");if(k===u||k===d)return e()}var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.onload=e,o.onerror=function(e){var u=e&&e.target&&e.target.src||d,a=new Error("Loading CSS chunk "+c+" failed.\n("+u+")");a.code="CSS_CHUNK_LOAD_FAILED",a.request=u,delete f[c],o.parentNode.removeChild(o),n(a)},o.href=d;var i=document.getElementsByTagName("head")[0];i.appendChild(o)})).then((function(){f[c]=0})));var u=d[c];if(0!==u)if(u)e.push(u[2]);else{var a=new Promise((function(e,n){u=d[c]=[e,n]}));e.push(u[2]=a);var r,k=document.createElement("script");k.charset="utf-8",k.timeout=120,t.nc&&k.setAttribute("nonce",t.nc),k.src=h(c);var b=new Error;r=function(e){k.onerror=k.onload=null,clearTimeout(o);var n=d[c];if(0!==n){if(n){var u=e&&("load"===e.type?"missing":e.type),f=e&&e.target&&e.target.src;b.message="Loading chunk "+c+" failed.\n("+u+": "+f+")",b.name="ChunkLoadError",b.type=u,b.request=f,n[1](b)}d[c]=void 0}};var o=setTimeout((function(){r({type:"timeout",target:k})}),12e4);k.onerror=k.onload=r,document.head.appendChild(k)}return Promise.all(e)},t.m=c,t.c=u,t.d=function(c,e,n){t.o(c,e)||Object.defineProperty(c,e,{enumerable:!0,get:n})},t.r=function(c){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(c,"__esModule",{value:!0})},t.t=function(c,e){if(1&e&&(c=t(c)),8&e)return c;if(4&e&&"object"===typeof c&&c&&c.__esModule)return c;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:c}),2&e&&"string"!=typeof c)for(var u in c)t.d(n,u,function(e){return c[e]}.bind(null,u));return n},t.n=function(c){var e=c&&c.__esModule?function(){return c["default"]}:function(){return c};return t.d(e,"a",e),e},t.o=function(c,e){return Object.prototype.hasOwnProperty.call(c,e)},t.p="/",t.oe=function(c){throw console.error(c),c};var r=window["webpackJsonp"]=window["webpackJsonp"]||[],k=r.push.bind(r);r.push=e,r=r.slice();for(var b=0;b<r.length;b++)e(r[b]);var o=k;n()})([]);</script><script src=/static/js/chunk-elementUI.a450811c.js></script><script src=/static/js/chunk-libs.01c2f7cb.js></script><script src=/static/js/app.ea5c35e2.js></script></body></html> \ No newline at end of file +<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>魔方-MagiCude</title><link href=/static/css/chunk-elementUI.68c70ad5.css rel=stylesheet><link href=/static/css/chunk-libs.ee57d822.css rel=stylesheet><link href=/static/css/app.03c741a6.css rel=stylesheet></head><body><noscript><strong>We're sorry but 魔方-MagiCude doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(c){function e(e){for(var u,f,h=e[0],t=e[1],r=e[2],k=0,b=[];k<h.length;k++)f=h[k],Object.prototype.hasOwnProperty.call(d,f)&&d[f]&&b.push(d[f][0]),d[f]=0;for(u in t)Object.prototype.hasOwnProperty.call(t,u)&&(c[u]=t[u]);o&&o(e);while(b.length)b.shift()();return a.push.apply(a,r||[]),n()}function n(){for(var c,e=0;e<a.length;e++){for(var n=a[e],u=!0,f=1;f<n.length;f++){var h=n[f];0!==d[h]&&(u=!1)}u&&(a.splice(e--,1),c=t(t.s=n[0]))}return c}var u={},f={runtime:0},d={runtime:0},a=[];function h(c){return t.p+"static/js/"+({}[c]||c)+"."+{"chunk-04a53b9c":"0199b051","chunk-051ee970":"b3676c2f","chunk-0743f666":"7c7dd864","chunk-085da9d9":"ddb6289f","chunk-0b3900d1":"396cf6a1","chunk-0c147953":"e61fb172","chunk-17108e1b":"258e6544","chunk-2824ff8e":"75b3c8fe","chunk-6563a41c":"855a2964","chunk-6c968c8c":"af36fbba","chunk-0f567348":"82c3f664","chunk-135b92be":"3c658b00","chunk-18be2291":"06bd3dc4","chunk-1c0778a3":"d90656b5","chunk-287cda81":"9dcac459","chunk-2d22676b":"9aa0c560","chunk-2f6f00b6":"fe27d054","chunk-305b8ac2":"6502df54","chunk-367cb1c8":"1c98df24","chunk-38969063":"83f50284","chunk-40bc77e4":"6de01222","chunk-444ad2a0":"d95b94c1","chunk-455bdd50":"8f9f4aae","chunk-4e589dbf":"1b3001e6","chunk-52aa8469":"cc459b44","chunk-569e313f":"a240b8b4","chunk-5d68df8b":"d3e1cba3","chunk-6166da60":"298daf19","chunk-64b30f9d":"1da1a167","chunk-027d9023":"bb090dd6","chunk-0c2da520":"815b8b11","chunk-1cf15413":"2b203d97","chunk-22d4a2d3":"9e3dc1bb","chunk-64744614":"4fab3b90","chunk-64b92768":"b1ab386c","chunk-95ae55b6":"947aba68","chunk-ec05ab82":"ad6d49cc","chunk-f63fbd8a":"0f7d92c0","chunk-668ca980":"82edaf1c","chunk-67130b18":"31033bc9","chunk-6899ff79":"0bcb413e","chunk-6b170cf8":"65ec81cd","chunk-748ae12c":"d3da1f03","chunk-7522baad":"6c5d9821","chunk-791f0458":"69f22435","chunk-79a1eced":"5fc9460b","chunk-87590162":"0d29739d","chunk-305fa922":"923aecf7","chunk-fb05caa4":"bfb4a3e7","chunk-8ccb92d4":"853ef675","chunk-8dfcdace":"a9ffd5d4","chunk-c0baf5ba":"88e4fb45","chunk-c6c1cf3e":"189ea7cd","chunk-e9309dee":"c331924f","chunk-f5778866":"a67d54f5","chunk-f261f684":"b2b79ac1","chunk-ffc23878":"146dbd22","chunk-3c2d6792":"4269755a","chunk-4411ea1b":"df398f88","chunk-ee77943a":"ad962326","chunk-19d17be9":"0edd777b","chunk-035d1156":"0d768776"}[c]+".js"}function t(e){if(u[e])return u[e].exports;var n=u[e]={i:e,l:!1,exports:{}};return c[e].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.e=function(c){var e=[],n={"chunk-367cb1c8":1,"chunk-5d68df8b":1,"chunk-ec05ab82":1,"chunk-67130b18":1,"chunk-6899ff79":1,"chunk-87590162":1,"chunk-305fa922":1,"chunk-fb05caa4":1,"chunk-f261f684":1};f[c]?e.push(f[c]):0!==f[c]&&n[c]&&e.push(f[c]=new Promise((function(e,n){for(var u="static/css/"+({}[c]||c)+"."+{"chunk-04a53b9c":"31d6cfe0","chunk-051ee970":"31d6cfe0","chunk-0743f666":"31d6cfe0","chunk-085da9d9":"31d6cfe0","chunk-0b3900d1":"31d6cfe0","chunk-0c147953":"31d6cfe0","chunk-17108e1b":"31d6cfe0","chunk-2824ff8e":"31d6cfe0","chunk-6563a41c":"31d6cfe0","chunk-6c968c8c":"31d6cfe0","chunk-0f567348":"31d6cfe0","chunk-135b92be":"31d6cfe0","chunk-18be2291":"31d6cfe0","chunk-1c0778a3":"31d6cfe0","chunk-287cda81":"31d6cfe0","chunk-2d22676b":"31d6cfe0","chunk-2f6f00b6":"31d6cfe0","chunk-305b8ac2":"31d6cfe0","chunk-367cb1c8":"a219e5b4","chunk-38969063":"31d6cfe0","chunk-40bc77e4":"31d6cfe0","chunk-444ad2a0":"31d6cfe0","chunk-455bdd50":"31d6cfe0","chunk-4e589dbf":"31d6cfe0","chunk-52aa8469":"31d6cfe0","chunk-569e313f":"31d6cfe0","chunk-5d68df8b":"7114ac7a","chunk-6166da60":"31d6cfe0","chunk-64b30f9d":"31d6cfe0","chunk-027d9023":"31d6cfe0","chunk-0c2da520":"31d6cfe0","chunk-1cf15413":"31d6cfe0","chunk-22d4a2d3":"31d6cfe0","chunk-64744614":"31d6cfe0","chunk-64b92768":"31d6cfe0","chunk-95ae55b6":"31d6cfe0","chunk-ec05ab82":"7114ac7a","chunk-f63fbd8a":"31d6cfe0","chunk-668ca980":"31d6cfe0","chunk-67130b18":"46e39697","chunk-6899ff79":"a6223c38","chunk-6b170cf8":"31d6cfe0","chunk-748ae12c":"31d6cfe0","chunk-7522baad":"31d6cfe0","chunk-791f0458":"31d6cfe0","chunk-79a1eced":"31d6cfe0","chunk-87590162":"b11eb12c","chunk-305fa922":"34d47b8e","chunk-fb05caa4":"34d47b8e","chunk-8ccb92d4":"31d6cfe0","chunk-8dfcdace":"31d6cfe0","chunk-c0baf5ba":"31d6cfe0","chunk-c6c1cf3e":"31d6cfe0","chunk-e9309dee":"31d6cfe0","chunk-f5778866":"31d6cfe0","chunk-f261f684":"f1f1adb3","chunk-ffc23878":"31d6cfe0","chunk-3c2d6792":"31d6cfe0","chunk-4411ea1b":"31d6cfe0","chunk-ee77943a":"31d6cfe0","chunk-19d17be9":"31d6cfe0","chunk-035d1156":"31d6cfe0"}[c]+".css",d=t.p+u,a=document.getElementsByTagName("link"),h=0;h<a.length;h++){var r=a[h],k=r.getAttribute("data-href")||r.getAttribute("href");if("stylesheet"===r.rel&&(k===u||k===d))return e()}var b=document.getElementsByTagName("style");for(h=0;h<b.length;h++){r=b[h],k=r.getAttribute("data-href");if(k===u||k===d)return e()}var o=document.createElement("link");o.rel="stylesheet",o.type="text/css",o.onload=e,o.onerror=function(e){var u=e&&e.target&&e.target.src||d,a=new Error("Loading CSS chunk "+c+" failed.\n("+u+")");a.code="CSS_CHUNK_LOAD_FAILED",a.request=u,delete f[c],o.parentNode.removeChild(o),n(a)},o.href=d;var i=document.getElementsByTagName("head")[0];i.appendChild(o)})).then((function(){f[c]=0})));var u=d[c];if(0!==u)if(u)e.push(u[2]);else{var a=new Promise((function(e,n){u=d[c]=[e,n]}));e.push(u[2]=a);var r,k=document.createElement("script");k.charset="utf-8",k.timeout=120,t.nc&&k.setAttribute("nonce",t.nc),k.src=h(c);var b=new Error;r=function(e){k.onerror=k.onload=null,clearTimeout(o);var n=d[c];if(0!==n){if(n){var u=e&&("load"===e.type?"missing":e.type),f=e&&e.target&&e.target.src;b.message="Loading chunk "+c+" failed.\n("+u+": "+f+")",b.name="ChunkLoadError",b.type=u,b.request=f,n[1](b)}d[c]=void 0}};var o=setTimeout((function(){r({type:"timeout",target:k})}),12e4);k.onerror=k.onload=r,document.head.appendChild(k)}return Promise.all(e)},t.m=c,t.c=u,t.d=function(c,e,n){t.o(c,e)||Object.defineProperty(c,e,{enumerable:!0,get:n})},t.r=function(c){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(c,"__esModule",{value:!0})},t.t=function(c,e){if(1&e&&(c=t(c)),8&e)return c;if(4&e&&"object"===typeof c&&c&&c.__esModule)return c;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:c}),2&e&&"string"!=typeof c)for(var u in c)t.d(n,u,function(e){return c[e]}.bind(null,u));return n},t.n=function(c){var e=c&&c.__esModule?function(){return c["default"]}:function(){return c};return t.d(e,"a",e),e},t.o=function(c,e){return Object.prototype.hasOwnProperty.call(c,e)},t.p="/",t.oe=function(c){throw console.error(c),c};var r=window["webpackJsonp"]=window["webpackJsonp"]||[],k=r.push.bind(r);r.push=e,r=r.slice();for(var b=0;b<r.length;b++)e(r[b]);var o=k;n()})([]);</script><script src=/static/js/chunk-elementUI.a450811c.js></script><script src=/static/js/chunk-libs.01c2f7cb.js></script><script src=/static/js/app.ea5c35e2.js></script></body></html> \ No newline at end of file diff --git a/deploy/MagiCude/dist/static/js/chunk-67130b18.31033bc9.js b/deploy/MagiCude/dist/static/js/chunk-67130b18.31033bc9.js new file mode 100644 index 0000000..f2cb6a0 --- /dev/null +++ b/deploy/MagiCude/dist/static/js/chunk-67130b18.31033bc9.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-67130b18"],{"10dd":function(t,i,l){"use strict";var a=l("ec3b"),e=l.n(a);e.a},ec3b:function(t,i,l){},ef46:function(t,i,l){"use strict";l.r(i);var a=function(){var t=this,i=t.$createElement,l=t._self._c||i;return l("div",{staticStyle:{padding:"100px 200px 0"}},[l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("魔方-MagiCude")])]),l("el-link",{attrs:{underline:!1},on:{click:function(i){return t.handleDrawer()}}},[l("i",{staticClass:"el-icon-view el-icon--right"}),t._v("正式版 V2.0.1 ")]),l("el-link",{staticStyle:{float:"right"},attrs:{href:"https://github.com/er10yi/MagiCude",target:"_blank"}},[t._v("GitHub项目页面")])],1),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("高效获取服务器IP, 端口信息, web信息, url链接, 漏洞等资产信息")]),l("li",[t._v("对资产进行有效的安全管理")]),l("li",[t._v("建立漏洞wiki并自动闭环漏洞, 减少安全部门与业务部门的沟通")]),l("li",[t._v("即时漏洞提醒")]),l("li",[t._v("定时发送资产报告和漏洞报告")]),l("li",[t._v("及时发送资产信息和处理结果给负责人进行整改并自动确认整改完成")]),l("li",[t._v("有效获取DHCP的办公机IP与用户关联")]),l("li",[t._v("丰富的图表统计")]),l("li",[t._v("POC框架")])])]),l("div",{staticClass:"item"},[t._v(" Copyrights © 2018-"+t._s(t.getYear())+" "),l("el-link",{attrs:{type:"info",href:"https://github.com/er10yi",target:"_blank"}},[t._v("贰拾壹.")]),t._v("All Rights Reserved. ")],1)]),l("el-drawer",{attrs:{title:"ChangeLog",visible:t.drawer,direction:"rtl",size:"60%",beforeclose:t.handleDrawerClose},on:{"update:visible":function(i){t.drawer=i}}},[l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("TDL - 待定")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("增加用户前端,放开漏洞wiki,还有啥?")]),l("li",[t._v("丰富漏洞wiki,建成知识库")]),l("li",[t._v("增加全局搜索")]),l("li",[t._v("增加资产导入接口,漏洞导入接口")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("正式版 V2.0.1 - 20201009")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 部署脚本: "),l("li",[t._v("增加部署脚本执行目录判断(issues #3 建议判断或约束一下安装脚本执行目录)")]),l("li",[t._v("增加agent.yml内容是否已经修改判断")]),l("li",[t._v("增加center和agent所需文件判断")]),l("li",[t._v("增加前端api地址是否修改判断")]),l("li",[t._v("增加操作系统判断")]),l("li",[t._v("修复多次重新部署的时候,环境变量会写入多次")]),l("li",[t._v("优化脚本日志输出,屏蔽非脚本错误输出,优化所有脚本")]),l("li",[t._v("Python升级到3.9.0")]),l("li",[t._v("部署脚本运行结束时,增加信息和错误提示")]),l("li",[t._v("移除agentDependency,nmap更新到7.90")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("正式版 V2.0 - 20200925")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 正式版发布,同时开源 ")])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.3.25 - 20200913")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 前端: "),l("li",[t._v("修复 子任务Drawer,调整分页无效的问题")]),l("li",[t._v("优化 用code标签显示代码")]),l("li",[t._v("新增 插件页面新增插件代码高亮,python3的selfd插件可前端新增(已知bug,第一次进入插件页面,新增或编辑需要打开两次代码高亮插件才会正常显示,第二次保存才能正常添加代码)")]),l("li",[t._v("新增 设置-批量导入,新增python3的selfd插件配置导入,主要用于python3的selfd插件配置及代码导入")]),l("li",[t._v("新增 新增各个类型任务的demo")]),t._v(" 后端: "),l("li",[t._v("修复 nse类型任务,获取状态时不显示PID信息")]),l("li",[t._v("修复 nse、selfd、httpp任务,资产库无对应的信息时,任务也会发给agent")]),l("li",[t._v("修复 无资产ip时,目标ip为ipNoPort,unknownPortSerVer,ipAllPort,任务也会发给agent")]),l("li",[t._v("修复 修复插件未设置服务和版本时,启动任务会开启所有插件 ")]),l("li",[t._v("优化 优化新增自定义插件,插件核心增加Jep方式调用python代码,可前端直接新增python3的selfd自定义类型的插件(重要更新,TDL的一半,优化新增自定义插件并丰富插件)")]),l("li",[t._v("优化 优化全部批量删除")]),l("li",[t._v("新增 新增python3的selfd插件配置导入接口")]),l("li",[t._v("新增 agent新增python插件import检测,如模块未安装,则会自动安装")]),l("li",[t._v("新增 插件配置新增http、dns辅助验证,用于插件辅助验证无回显漏洞(TDL 增加无回显插件检测)")]),l("li",[t._v("新增 增加HTTP json插件解析")]),l("li",[t._v("修改 随机获取ua的方式修改,存入redis进行随机")]),t._v(" 数据库: "),l("li",[t._v("新增 插件配置新增plugincode字段,用于保存插件代码")]),l("li",[t._v("新增 插件配置新增validatetype字段,用于开启插件http辅助验证或dns辅助验证")]),t._v(" 配置文件: "),l("li",[t._v("新增 agent.yml新增jep节点,用于保存JEP本地库的绝对路径")]),l("li",[t._v("新增 agent.yml新增center节点,用于插件辅助验证时传递http接口和dns的ip地址")]),t._v(" 部署脚本: "),l("li",[t._v("增加 新增Python3.8编译安装")]),l("li",[t._v("移除 移除jre14,修改成jdk15(JEP编译需要)")]),t._v(" 文档: "),l("li",[t._v("优化 优化快速上手及说明文档")]),l("li",[t._v("增加 新增Readme文档")]),l("li",[t._v("增加 新增插件编写说明")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.2 - 20200722")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("优化center部署脚本,增加判断是否已经运行过部署脚本,避免误操作二次运行部署脚本(如果已经部署,则需要用户交互),优化docker服务运行状态检测")]),l("li",[t._v("优化initDataAndStart.sh,增加脚本复制和执行成功的判断")]),l("li",[t._v("修改center.yml,token过期时间设置成一小时")]),l("li",[t._v("优化任务插件显示,将插件启用状态体现到操作中,优化插件启用禁用")]),l("li",[t._v("新增子任务展开Drawer")]),l("li",[t._v("about页面版本上增加changelog的Drawer,增加更新日志及TDL")]),l("li",[t._v("前端依赖更新到最新")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.1 - 20200715")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 前端: "),l("li",[t._v("增加about页面")]),l("li",[t._v("增加菜单栏显示与隐藏的Collapse,涉及的页面:任务、资产ip、资产端口、主机、检测结果、web信息、web信息和url")]),l("li",[t._v("优化资产ip,去除编辑页面显示ip所有信息,修改成Drawer方式显示,并增加url超链接")]),l("li",[t._v("优化资产端口,去除编辑页面显示端口所有信息,修改成Drawer方式显示,并增加http和https链接打开,增加url超链接")]),l("li",[t._v("优化新建任务的数量前端样式,将input修改成number模式")]),l("li",[t._v("优化检测类型任务,将input修改成单选模式")]),l("li",[t._v("优化web信息中ip的显示,增加打开http和https链接的Popover")]),l("li",[t._v("首页四个折线图修改成显示最新数据的10%")]),l("li",[t._v("修改设置-通知设置中的风险等级编辑样式,从input改成单选模式")]),l("li",[t._v("修改cron表达式解析结果的样式,改成表格")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.0 - 20200706")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 公开公测开启 ")])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("内测版 V1.1 - 20200615")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("优化部署步骤,修改部署脚本成一键部署")]),l("li",[t._v("部署脚本增加系统源修改判断和docker镜像源修改判断(需要用户交互)")]),l("li",[t._v("部署脚本增加判断,提高安装部署成功率")]),l("li",[t._v("前端增加web信息功能,后端优化部分代码")]),l("li",[t._v("文档增加Q/A章节、微信公众号、项目的目录结构说明,为公测做准备")]),l("li",[t._v("增加公测宣传文档")]),l("li",[t._v("增加magicude执行脚本,便于查看系统状态及操作系统(0624)")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("内测版 V1.0 - 20200528")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 公开内测开启 ")])])])])],1)],1)},e=[],s={data:function(){return{drawer:!1}},methods:{handleDrawer:function(){this.drawer=!0},handleDrawerClose:function(){this.drawer=!1},getYear:function(){var t=new Date;return this.year=t.getFullYear(),this.year}}},r=s,v=(l("10dd"),l("2877")),d=Object(v["a"])(r,a,e,!1,null,null,null);i["default"]=d.exports}}]); \ No newline at end of file diff --git a/deploy/MagiCude/dist/static/js/chunk-67130b18.686079a8.js b/deploy/MagiCude/dist/static/js/chunk-67130b18.686079a8.js deleted file mode 100644 index db24373..0000000 --- a/deploy/MagiCude/dist/static/js/chunk-67130b18.686079a8.js +++ /dev/null @@ -1 +0,0 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-67130b18"],{"10dd":function(t,i,l){"use strict";var e=l("ec3b"),a=l.n(e);a.a},ec3b:function(t,i,l){},ef46:function(t,i,l){"use strict";l.r(i);var e=function(){var t=this,i=t.$createElement,l=t._self._c||i;return l("div",{staticStyle:{padding:"100px 200px 0"}},[l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("魔方-MagiCude")])]),l("el-link",{attrs:{underline:!1},on:{click:function(i){return t.handleDrawer()}}},[l("i",{staticClass:"el-icon-view el-icon--right"}),t._v("正式版 V2.0 ")]),l("el-link",{staticStyle:{float:"right"},attrs:{href:"https://github.com/er10yi/MagiCude",target:"_blank"}},[t._v("GitHub项目页面")])],1),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("高效获取服务器IP, 端口信息, web信息, url链接, 漏洞等资产信息")]),l("li",[t._v("对资产进行有效的安全管理")]),l("li",[t._v("建立漏洞wiki并自动闭环漏洞, 减少安全部门与业务部门的沟通")]),l("li",[t._v("即时漏洞提醒")]),l("li",[t._v("定时发送资产报告和漏洞报告")]),l("li",[t._v("及时发送资产信息和处理结果给负责人进行整改并自动确认整改完成")]),l("li",[t._v("有效获取DHCP的办公机IP与用户关联")]),l("li",[t._v("丰富的图表统计")]),l("li",[t._v("POC框架")])])]),l("div",{staticClass:"item"},[t._v(" Copyrights © 2018-"+t._s(t.getYear())+" "),l("el-link",{attrs:{type:"info",href:"https://github.com/er10yi",target:"_blank"}},[t._v("贰拾壹.")]),t._v("All Rights Reserved. ")],1)]),l("el-drawer",{attrs:{title:"ChangeLog",visible:t.drawer,direction:"rtl",size:"60%",beforeclose:t.handleDrawerClose},on:{"update:visible":function(i){t.drawer=i}}},[l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("TDL - 待定")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("增加用户前端,放开漏洞wiki,还有啥?")]),l("li",[t._v("丰富漏洞wiki,建成知识库")]),l("li",[t._v("增加全局搜索")]),l("li",[t._v("增加资产导入接口,漏洞导入接口")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("正式版 V2.0 - 20200925")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 正式版发布,同时开源 ")])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.3.25 - 20200913")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 前端: "),l("li",[t._v("修复 子任务Drawer,调整分页无效的问题")]),l("li",[t._v("优化 用code标签显示代码")]),l("li",[t._v("新增 插件页面新增插件代码高亮,python3的selfd插件可前端新增(已知bug,第一次进入插件页面,新增或编辑需要打开两次代码高亮插件才会正常显示,第二次保存才能正常添加代码)")]),l("li",[t._v("新增 设置-批量导入,新增python3的selfd插件配置导入,主要用于python3的selfd插件配置及代码导入")]),l("li",[t._v("新增 新增各个类型任务的demo")]),t._v(" 后端: "),l("li",[t._v("修复 nse类型任务,获取状态时不显示PID信息")]),l("li",[t._v("修复 nse、selfd、httpp任务,资产库无对应的信息时,任务也会发给agent")]),l("li",[t._v("修复 无资产ip时,目标ip为ipNoPort,unknownPortSerVer,ipAllPort,任务也会发给agent")]),l("li",[t._v("修复 修复插件未设置服务和版本时,启动任务会开启所有插件 ")]),l("li",[t._v("优化 优化新增自定义插件,插件核心增加Jep方式调用python代码,可前端直接新增python3的selfd自定义类型的插件(重要更新,TDL的一半,优化新增自定义插件并丰富插件)")]),l("li",[t._v("优化 优化全部批量删除")]),l("li",[t._v("新增 新增python3的selfd插件配置导入接口")]),l("li",[t._v("新增 agent新增python插件import检测,如模块未安装,则会自动安装")]),l("li",[t._v("新增 插件配置新增http、dns辅助验证,用于插件辅助验证无回显漏洞(TDL 增加无回显插件检测)")]),l("li",[t._v("新增 增加HTTP json插件解析")]),l("li",[t._v("修改 随机获取ua的方式修改,存入redis进行随机")]),t._v(" 数据库: "),l("li",[t._v("新增 插件配置新增plugincode字段,用于保存插件代码")]),l("li",[t._v("新增 插件配置新增validatetype字段,用于开启插件http辅助验证或dns辅助验证")]),t._v(" 配置文件: "),l("li",[t._v("新增 agent.yml新增jep节点,用于保存JEP本地库的绝对路径")]),l("li",[t._v("新增 agent.yml新增center节点,用于插件辅助验证时传递http接口和dns的ip地址")]),t._v(" 部署脚本: "),l("li",[t._v("增加 新增Python3.8编译安装")]),l("li",[t._v("移除 移除jre14,修改成jdk15(JEP编译需要)")]),t._v(" 文档: "),l("li",[t._v("优化 优化快速上手及说明文档")]),l("li",[t._v("增加 新增Readme文档")]),l("li",[t._v("增加 新增插件编写说明")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.2 - 20200722")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("优化center部署脚本,增加判断是否已经运行过部署脚本,避免误操作二次运行部署脚本(如果已经部署,则需要用户交互),优化docker服务运行状态检测")]),l("li",[t._v("优化initDataAndStart.sh,增加脚本复制和执行成功的判断")]),l("li",[t._v("修改center.yml,token过期时间设置成一小时")]),l("li",[t._v("优化任务插件显示,将插件启用状态体现到操作中,优化插件启用禁用")]),l("li",[t._v("新增子任务展开Drawer")]),l("li",[t._v("about页面版本上增加changelog的Drawer,增加更新日志及TDL")]),l("li",[t._v("前端依赖更新到最新")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.1 - 20200715")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 前端: "),l("li",[t._v("增加about页面")]),l("li",[t._v("增加菜单栏显示与隐藏的Collapse,涉及的页面:任务、资产ip、资产端口、主机、检测结果、web信息、web信息和url")]),l("li",[t._v("优化资产ip,去除编辑页面显示ip所有信息,修改成Drawer方式显示,并增加url超链接")]),l("li",[t._v("优化资产端口,去除编辑页面显示端口所有信息,修改成Drawer方式显示,并增加http和https链接打开,增加url超链接")]),l("li",[t._v("优化新建任务的数量前端样式,将input修改成number模式")]),l("li",[t._v("优化检测类型任务,将input修改成单选模式")]),l("li",[t._v("优化web信息中ip的显示,增加打开http和https链接的Popover")]),l("li",[t._v("首页四个折线图修改成显示最新数据的10%")]),l("li",[t._v("修改设置-通知设置中的风险等级编辑样式,从input改成单选模式")]),l("li",[t._v("修改cron表达式解析结果的样式,改成表格")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("公测版 V1.2.0 - 20200706")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 公开公测开启 ")])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("内测版 V1.1 - 20200615")])]),l("div",{staticClass:"text"},[l("ol",[l("li",[t._v("优化部署步骤,修改部署脚本成一键部署")]),l("li",[t._v("部署脚本增加系统源修改判断和docker镜像源修改判断(需要用户交互)")]),l("li",[t._v("部署脚本增加判断,提高安装部署成功率")]),l("li",[t._v("前端增加web信息功能,后端优化部分代码")]),l("li",[t._v("文档增加Q/A章节、微信公众号、项目的目录结构说明,为公测做准备")]),l("li",[t._v("增加公测宣传文档")]),l("li",[t._v("增加magicude执行脚本,便于查看系统状态及操作系统(0624)")])])])])]),l("el-card",{staticClass:"box-card"},[l("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[l("span",[l("b",[t._v("内测版 V1.0 - 20200528")])]),l("div",{staticClass:"text"},[l("ol",[t._v(" 公开内测开启 ")])])])])],1)],1)},a=[],s={data:function(){return{drawer:!1}},methods:{handleDrawer:function(){this.drawer=!0},handleDrawerClose:function(){this.drawer=!1},getYear:function(){var t=new Date;return this.year=t.getFullYear(),this.year}}},r=s,v=(l("10dd"),l("2877")),d=Object(v["a"])(r,e,a,!1,null,null,null);i["default"]=d.exports}}]); \ No newline at end of file diff --git a/deploy/MagiCude/operation/checkDockerImageStatus.sh b/deploy/MagiCude/operation/checkDockerImageStatus.sh old mode 100755 new mode 100644 index 082139b..303bcc8 --- a/deploy/MagiCude/operation/checkDockerImageStatus.sh +++ b/deploy/MagiCude/operation/checkDockerImageStatus.sh @@ -1,19 +1,17 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh - -echo "检查docker容器状态" -echo "check docker image status" +logInfo "检查docker容器状态" setenforce 0 dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps | grep $imageName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "docker $imageName not started, starting $imageName now" - temp=`docker start $imageName` - echo "docker start $imageName done. Status:" - docker ps | grep $imageName - else echo "docker $imageName already started." + logInfo "$imageName 未启动,正在启动 $imageName" + docker start $imageName >/dev/null 2>&1 + logInfo "$imageName 完成启动" + else logInfo "$imageName 已启动" fi done \ No newline at end of file diff --git a/deploy/MagiCude/operation/dockerStopService.sh b/deploy/MagiCude/operation/dockerStopService.sh old mode 100755 new mode 100644 index 2dcfdf3..963675f --- a/deploy/MagiCude/operation/dockerStopService.sh +++ b/deploy/MagiCude/operation/dockerStopService.sh @@ -1,14 +1,17 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh +logInfo "停止docker容器" # stop docker images dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps | grep $imageName |wc -L` if [ $existFlag -ne 0 ] ;then - echo -n "docker stop " - docker stop $imageName - echo "done." + logInfo "正在停止 $imageName" + docker stop $imageName > /dev/null 2>&1 & + wait fi -done \ No newline at end of file +done +logInfo "完成" \ No newline at end of file diff --git a/deploy/MagiCude/operation/getStatus.sh b/deploy/MagiCude/operation/getStatus.sh old mode 100755 new mode 100644 index 5458fb9..c7e4757 --- a/deploy/MagiCude/operation/getStatus.sh +++ b/deploy/MagiCude/operation/getStatus.sh @@ -1,14 +1,14 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do tempPid=`ps -ef|grep $jarName|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then - echo "$jarName jar status:" - ps -ef|grep $jarName|grep -v grep + logInfo "$jarName 状态:`ps -ef|grep $jarName|grep -v grep`" else - echo "!!!!!!!!!! magicude service $jarName not started. !!!!!!!!!!" + logErrorNotExit "MagiCude 服务 $jarName 未启动" fi done \ No newline at end of file diff --git a/deploy/MagiCude/operation/restartAll.sh b/deploy/MagiCude/operation/restartAll.sh old mode 100755 new mode 100644 index 88b0020..31aa220 --- a/deploy/MagiCude/operation/restartAll.sh +++ b/deploy/MagiCude/operation/restartAll.sh @@ -1,11 +1,12 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh -echo "restartAll.sh将执行以下操作" -echo "kill nmap和masscan" -echo "重启docker中的容器:magicude_mysql magicude_redis magicude_rabbitmq nginxApp" -echo "重启center所有服务:eurekaapp.jar centerapp.jar agentapp.jar" +logInfo "$0 将执行以下操作" +logInfo "停止nmap和masscan" +logInfo "重启docker中的容器:magicude_mysql magicude_redis magicude_rabbitmq nginxApp" +logInfo "重启center所有服务:eurekaapp.jar centerapp.jar agentapp.jar" echo -n "是否继续(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes = "y" ]] ; then @@ -14,39 +15,39 @@ if [[ $checkYes = "y" ]] ; then for jarName in ${jarNameArrays[@]} ; do tempPid=`ps -ef|grep $jarName|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then - echo "kill $jarName jar" + logInfo "停止 $jarName" kill -9 $tempPid - echo "done." fi done + logInfo "完成" # kill nmap masscan existFlag=`ps -ef|grep nmap|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then - echo "kill nmap" + logInfo "停止 nmap" kill -9 $(pidof nmap) - echo "done." fi existFlag=`ps -ef|grep masscan|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then - echo "kill masscan" + logInfo "停止 masscan" kill -9 $(pidof masscan) - echo "done." fi - echo "docker restart container" - temp=`docker restart magicude_mysql` - temp=`docker restart magicude_redis` - temp=`docker restart magicude_rabbitmq` + logInfo "完成" + logInfo "docker重启容器" + docker restart magicude_mysql > /dev/null 2>&1 & + docker restart magicude_redis > /dev/null 2>&1 & + docker restart magicude_rabbitmq > /dev/null 2>&1 & setenforce 0 - temp=`docker restart nginxApp` - echo "done." + docker restart nginxApp > /dev/null 2>&1 & + logInfo "完成" cd .. - echo "**********启动center服务**********" + logInfo "启动center服务" nohup java -jar eurekaapp.jar --spring.config.location=eureka.yml > /dev/null 2>&1 & nohup java -jar centerapp.jar --spring.config.location=center.yml > /dev/null 2>&1 & nohup java -jar agentapp.jar --spring.config.location=agent.yml > /dev/null 2>&1 & sleep 20s - echo "********** 查看运行状态**********" - sh operation/getStatus.sh + logInfo "查看运行状态" + cd operation + sh getStatus.sh else echo exit 1 diff --git a/deploy/MagiCude/operation/runCenterService.sh b/deploy/MagiCude/operation/runCenterService.sh old mode 100755 new mode 100644 index 711a493..24e5f84 --- a/deploy/MagiCude/operation/runCenterService.sh +++ b/deploy/MagiCude/operation/runCenterService.sh @@ -1,17 +1,18 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh cd .. -echo "**********启动center服务**********" -echo "**********eurekaapp.jar**********" +logInfo "启动 MagiCude 服务" +logInfo "eurekaapp.jar" nohup java -jar eurekaapp.jar --spring.config.location=eureka.yml > /dev/null 2>&1 & sleep 5s -echo "**********centerapp.jar**********" +logInfo "centerapp.jar" nohup java -jar centerapp.jar --spring.config.location=center.yml > /dev/null 2>&1 & sleep 5s -echo "**********agentapp.jar**********" +logInfo "agentapp.jar" nohup java -jar agentapp.jar --spring.config.location=agent.yml > /dev/null 2>&1 & sleep 50s -echo "**********查看运行状态**********" +logInfo "查看 MagiCude 服务运行状态" sh operation/getStatus.sh \ No newline at end of file diff --git a/deploy/MagiCude/operation/stopAll.sh b/deploy/MagiCude/operation/stopAll.sh old mode 100755 new mode 100644 index d64fcb9..742a704 --- a/deploy/MagiCude/operation/stopAll.sh +++ b/deploy/MagiCude/operation/stopAll.sh @@ -1,45 +1,47 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh -echo "stopAll.sh将执行以下操作" -echo "kill nmap和masscan" -echo "停止docker中的容器:magicude_mysql magicude_redis magicude_rabbitmqnginxApp" -echo "停止center所有服务:eurekaapp.jar centerapp.jar agentapp.jar" -echo "如果部署了多个agent,请到agent服务器手动执行 stopAgent.sh" +logInfo "$0 将执行以下操作" +logInfo "停止nmap和masscan" +logInfo "停止docker中的容器:magicude_mysql magicude_redis magicude_rabbitmqnginxApp" +logInfo "停止center所有服务:eurekaapp.jar centerapp.jar agentapp.jar" +logInfo "如果部署了多个agent,请到agent服务器手动执行 stopAgent.sh" echo -n "是否继续(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes = "y" ]] ; then + logInfo "停止 MagiCude 所有服务" # kill jar jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do tempPid=`ps -ef|grep $jarName|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then - echo "kill $jarName jar" + logInfo "停止 $jarName" kill -9 $tempPid - echo "done." fi done + logInfo "完成" + logInfo "停止 nmap和masscan" # kill nmap masscan existFlag=`ps -ef|grep nmap|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then - echo "kill nmap" + logInfo "停止 nmap" kill -9 $(pidof nmap) - echo "done." fi existFlag=`ps -ef|grep masscan|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then - echo "kill masscan" + logInfo "停止 masscan" kill -9 $(pidof masscan) - echo "done." fi - echo "docker stop container" - temp=`docker stop magicude_mysql` - temp=`docker stop magicude_redis` - temp=`docker stop magicude_rabbitmq` - temp=`docker stop nginxApp` - echo "done." + logInfo "完成" + logInfo "docker停止容器" + docker stop magicude_mysql > /dev/null 2>&1 & + docker stop magicude_redis > /dev/null 2>&1 & + docker stop magicude_rabbitmq > /dev/null 2>&1 & + docker stop nginxApp > /dev/null 2>&1 & + logInfo "完成" else echo exit 1 diff --git a/deploy/MagiCude/operation/stopCenterService.sh b/deploy/MagiCude/operation/stopCenterService.sh old mode 100755 new mode 100644 index ccad378..7d0c3b3 --- a/deploy/MagiCude/operation/stopCenterService.sh +++ b/deploy/MagiCude/operation/stopCenterService.sh @@ -1,13 +1,15 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh +logInfo "停止 MagiCude 服务" jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do tempPid=`ps -ef|grep $jarName|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then - echo "kill $jarName jar" + logInfo "停止 $jarName" kill -9 $tempPid - echo "done." fi -done \ No newline at end of file +done +logInfo "完成" \ No newline at end of file diff --git a/deploy/defaultConf/agent.yml b/deploy/defaultConf/agent.yml old mode 100755 new mode 100644 index 251aae7..f706f78 --- a/deploy/defaultConf/agent.yml +++ b/deploy/defaultConf/agent.yml @@ -32,7 +32,7 @@ mass: # path: D:\Tools\bin\masscan.exe path: masscan jep: # jep的绝对路径,mac下后缀为jnilib,linux为so,Windows为dll - absolutePath: /usr/local/python3/lib/python3.8/site-packages/jep/libjep.so + absolutePath: /usr/local/python3/lib/python3.9/site-packages/jep/libjep.so center: httpValidateApi: http://127.0.0.1:9001/center/pluginchecker # 需要修改成部署centerapp.jar服务器的ip dnsValidateIp: 127.0.0.1 # 需要修改成部署centerapp.jar服务器的ip \ No newline at end of file diff --git a/deploy/defaultConf/center.yml b/deploy/defaultConf/center.yml old mode 100755 new mode 100644 diff --git a/deploy/defaultConf/eureka.yml b/deploy/defaultConf/eureka.yml old mode 100755 new mode 100644 diff --git a/deploy/defaultConf/initAgentEnvironmentAndStart.sh b/deploy/defaultConf/initAgentEnvironmentAndStart.sh old mode 100755 new mode 100644 index c3a9109..375b12c --- a/deploy/defaultConf/initAgentEnvironmentAndStart.sh +++ b/deploy/defaultConf/initAgentEnvironmentAndStart.sh @@ -2,25 +2,56 @@ # 初始化环境 # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh -echo -echo "魔方-MagiCude agent部署脚本 V2.4" +echo +echo "魔方-MagiCude agent部署脚本 V2.5" echo "@author 贰拾壹" echo "https://github.com/er10yi" echo -# 如果jdk-15已解压,证明已经运行过部署脚本 -if [ -d "jdk-15" ]; then - echo -e "检测到已运行过部署脚本" +# 增加操作系统判断 +if [ ! -f /etc/redhat-release ];then + logError "$0 仅支持CentOS 7.x" +fi +tempVersion=`cat /etc/redhat-release | sed -r 's/.* ([0-9]+)\..*/\1/'` +if [ $tempVersion -ne 7 ];then + logError "$0 仅支持CentOS 7.x" +fi + +# 判断agent路径是否正确 +mcPath=$PWD +if [ $mcPath != "/root/MagiCude" ]; then + logErrorNotExit "$0 执行路径非/root/MagiCude" + logError "请确认已在root目录下新建MagiCude目录" +fi + +# 判断agent所需文件是否存在 +existFlag=0 +dependArrays=("agent.yml" "agentapp.jar" "runAgent.sh" "stopAgent.sh" "util.sh") +for dependName in ${dependArrays[@]} ; do + if [ ! -f $dependName ] ;then + logErrorNotExit "MagiCude 目录下未检测到 $dependName" + logErrorNotExit "请确认已复制 $dependName 到MagiCude目录下" + existFlag=1 + fi +done +if [ $existFlag -eq 1 ] ;then + exit 1 +fi + +# 如果$openjdkDirName已解压,证明已经运行过部署脚本 +if [ -d $openjdkDirName ]; then + logInfo "检测到已运行过部署脚本" echo -n "是否继续(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes != "y" ]] ; then echo - echo "**********退出部署**********" + logInfo "退出部署" exit 1 fi fi -echo "**********开始部署**********" +logInfo "开始部署" # kill agentapp tempPid=`ps -ef|grep agentapp|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then @@ -36,15 +67,47 @@ if [ $existFlag ] ;then kill -9 $(pidof masscan) fi -echo "**********判断是否存在java 环境**********" -java -version +# 判断agent.yml内容是否已经修改 +# agent分布式部署 +if [ ! -f initCenterEnvironmentAndStart.sh ]; then + logInfo "检测到agent分布式部署" + existFlag=`cat agent.yml | grep "name: agent1" |wc -L` + if [ $existFlag -ne 0 ] ;then + logError "agent.yml文件name节点 agent1 未修改,请修改成非 agent1 后重新运行 $0" + fi + existFlag=`cat agent.yml | grep "host: 127.0.0.1" |wc -L` + if [ $existFlag -ne 0 ] ;then + logErrorNotExit "agent.yml文件rabbitmq或redis的host节点 127.0.0.1 未修改" + logError "请将 127.0.0.1 修改成 部署centerapp.jar服务器的ip 后重新运行 $0" + fi + existFlag=`cat agent.yml | grep "127.0.0.1:8686/eureka" |wc -L` + if [ $existFlag -ne 0 ] ;then + logErrorNotExit "agent.yml文件defaultZone节点 127.0.0.1 未修改" + logError "请将 127.0.0.1 修改成 部署eurekaapp.jar服务器的ip 后重新运行 $0" + fi +fi + +infoMessage=() +if [ -f agent.yml ];then + existFlag=`cat agent.yml | grep "httpValidateApi: http://127.0.0.1:9001/center/pluginchecker" |wc -L` + if [ $existFlag -ne 0 ] ;then + infoMessage=("agent.yml文件center节点httpValidateApi未修改:请将httpValidateApi修改成部署centerapp.jar服务器的ip") + fi + existFlag=`cat agent.yml | grep "dnsValidateIp: 127.0.0.1" |wc -L` + if [ $existFlag -ne 0 ] ;then + infoMessage+=("agent.yml文件center节点dnsValidateIp未修改:请将dnsValidateIp修改成部署centerapp.jar服务器的ip") + fi +else + logError "agent.yml不存在" +fi + +logInfo "判断是否存在java 环境" +java -version >/dev/null 2>&1 if [ $? -eq 0 ];then # 存在java环境 java_version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'` - if [ $java_version != "15" ];then - echo "!!!!!!!!!! 当前已存在java $java_version 环境 !!!!!!!!!!" - echo "请将其卸载后,重新执行 $0 " - exit 1 + if [ $java_version != $openjdkVersion ];then + logError "当前已存在java $java_version 环境,请将其卸载后,重新执行 $0" fi fi @@ -54,166 +117,184 @@ if [ $existFlag -eq 0 ] ;then echo -n "系统非中科大源,是否修改成中科大源(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes = "y" ]] ; then - echo "**********备份源并更换成中科大源**********" - temp=`sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' -i.backup /etc/yum.repos.d/CentOS-Base.repo` - temp=`yum clean all && yum makecache` + logInfo "备份源并更换成中科大源" + sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' -i.backup /etc/yum.repos.d/CentOS-Base.repo >/dev/null 2>&1 + yum clean all >/dev/null 2>&1 + yum makecache >/dev/null 2>&1 else echo fi fi -echo "**********更新系统,时间可能较久**********" -echo "**********更新或安装依赖出现超时请忽略**********" -temp=`yum -y update` -echo "**********安装依赖**********" -temp=`yum -y install gcc make libpcap libpcap-dev clang git wget` -echo "**********验证依赖是否成功安装**********" +logInfo "更新系统,时间可能较久" +yum -y update >/dev/null 2>&1 +logInfo "安装依赖,时间可能较久" +yum -y install gcc make libpcap libpcap-dev clang git wget >/dev/null 2>&1 +logInfo "验证依赖是否成功安装" dependArrays=("wget" "make" "gcc" "clang" "git") for dependName in ${dependArrays[@]} ; do existFlag=`ls /usr/bin/ | grep $dependName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! $dependName未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$dependName未成功安装,请重新执行 $0" fi done -pythonVerion="Python-3.8.5" +# 选择Python版本 +pythonVerion=${pythonVersionArrays[0]} +# echo "请输入数字选择编译安装的Python版本" +# i=1 +# while ( [ $i -le ${#pythonVersionArrays[*]} ] ) +# do +# echo "$i.Python ${pythonVersionArrays[i-1]}" +# let "i++" +# done +# echo -n "10秒后默认选第 1 项 : " +# read -t 10 choice +# if [ ! $choice ]; then +# choice=1 +# fi +# if [[ $choice -gt ${#pythonVersionArrays[*]} ]] || [[ $choice -lt 1 ]]; then +# choice=1 +# fi +# let "choice--" +# pythonVerion="${pythonVersionArrays[choice]}" +# echo +pythonName="Python" +pythonNameVerion=$pythonName-$pythonVerion pythonTarName=".tar.xz" -echo "**********编译安装$pythonVerion**********" -temp=`yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev zlib*` -if [ ! -f $pythonVerion$pythonTarName ]; then - echo "下载$pythonVerion" +logInfo "编译安装$pythonNameVerion" +yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev zlib* >/dev/null 2>&1 +if [ ! -f $pythonNameVerion$pythonTarName ]; then i=0 while ( [ $i -lt 5 ] ) do - # wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz - wget https://mirrors.huaweicloud.com/python/3.8.5/$pythonVerion$pythonTarName + # wget https://www.python.org/ftp/python/$pythonVerion/$pythonNameVerion$pythonTarName + wget https://mirrors.huaweicloud.com/python/$pythonVerion/$pythonNameVerion$pythonTarName >/dev/null 2>&1 let "i++" - if [ -f $pythonVerion$pythonTarName ]; then + if [ -f $pythonNameVerion$pythonTarName ]; then break - fi + fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! $pythonVerion下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$pythonNameVerion下载失败,重试第$i次失败,请重新执行 $0" fi fi -echo "**********判断$pythonVerion是否已安装**********" -python3 --version +python3 --version >/dev/null 2>&1 if [ $? -ne 0 ];then - echo "$pythonVerion未安装" - tar -xJf $pythonVerion$pythonTarName - mkdir /usr/local/python3 - cd $pythonVerion - ./configure --prefix=/usr/local/python3 --enable-shared - make && make install - temp=`ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3` - temp=`ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3` + tar -xJf $pythonNameVerion$pythonTarName + mkdir /usr/local/python3 >/dev/null 2>&1 + cd $pythonNameVerion + ./configure --prefix=/usr/local/python3 --enable-shared >/dev/null 2>&1 + make >/dev/null 2>&1 + make install >/dev/null 2>&1 + ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3 >/dev/null 2>&1 + ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3 >/dev/null 2>&1 cd .. - temp=`rm -rf $pythonVerion` + rm -rf $pythonNameVerion >/dev/null 2>&1 fi -export LD_LIBRARY_PATH=/usr/local/python3/lib -echo "**********判断$pythonVerion是否成功安装**********" -python3 --version +logInfo "判断 $pythonNameVerion 是否成功安装" +python3 --version >/dev/null 2>&1 if [ $? != 0 ];then - echo "!!!!!!!!!! $pythonVerion 未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$pythonNameVerion 未成功安装,请重新执行 $0" fi -echo "**********升级pip到最新**********" -temp=`python3 -m pip install --upgrade pip` -echo "**********关闭防火墙**********" -systemctl stop firewalld.service # firewalld -systemctl disable firewalld.service # firewalld -systemctl stop iptables.service # iptables -systemctl disable iptables.service # iptables +logInfo "替换agent.yml中的jep.absolutePath的python路径" +sed -i "s/python3.9/python${pythonVerion:0:3}/g" agent.yml +# logInfo "升级pip到最新" +# python3 -m pip install --upgrade pip >/dev/null 2>&1 +logInfo "关闭防火墙" +systemctl stop firewalld.service >/dev/null 2>&1 # firewalld +systemctl disable firewalld.service >/dev/null 2>&1 # firewalld +systemctl stop iptables.service >/dev/null 2>&1 # iptables +systemctl disable iptables.service >/dev/null 2>&1 # iptables -# 判断是否存在openjdk-15_linux-x64_bin.tar.gz,不存在则下载 -openjdk="openjdk-15_linux-x64_bin.tar.gz" +# 判断是否存在$openjdk,不存在则下载 if [ ! -f $openjdk ]; then - echo "**********未检测到$openjdk**********" - echo "下载$openjdk" - temp=`yum -y install wget` + logInfo "未检测到$openjdk" + logInfo "下载$openjdk" + yum -y install wget >/dev/null 2>&1 i=0 while ( [ $i -lt 5 ] ) do # http://jdk.java.net/ - wget https://mirrors.huaweicloud.com/openjdk/15/$openjdk + wget https://mirrors.huaweicloud.com/openjdk/$openjdkVersion/$openjdk >/dev/null 2>&1 let "i++" if [ -f $openjdk ]; then break fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! $openjdk下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$openjdk下载失败,重试第$i次失败,请重新执行 $0" fi fi -if [ ! -d "jdk-15" ]; then - echo "**********解压openjdk-15**********" +if [ ! -d $openjdkDirName ]; then + logInfo "解压$openjdk" tar -xf $openjdk fi -echo "**********设置环境变量**********" +# 判断是否已设置环境变量 +existFlag=`cat /root/.bash_profile | grep "/root/MagiCude/$openjdkDirName" |wc -L` +if [ $existFlag -eq 0 ] ;then + logInfo "设置环境变量" cat <<EOF >> /root/.bash_profile -export JAVA_HOME=/root/MagiCude/jdk-15 +export JAVA_HOME=/root/MagiCude/$openjdkDirName export JRE_HOME=\$JAVA_HOME/jre export CLASSPATH=\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH export PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin:\$PATH export LD_LIBRARY_PATH=/usr/local/python3/lib EOF +fi # 下次登录才生效 source /root/.bash_profile -# 需要再次执行,本次编译用到 -export JAVA_HOME=/root/MagiCude/jdk-15 -export JRE_HOME=$JAVA_HOME/jre -export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH -export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH -export LD_LIBRARY_PATH=/usr/local/python3/lib -echo "**********安装JEP**********" -pip3 install wheel -i https://pypi.douban.com/simple/ -pip3 install jep -i https://pypi.douban.com/simple/ +logInfo "安装JEP" +pip3 install wheel -i https://pypi.douban.com/simple/ >/dev/null 2>&1 +pip3 install jep -i https://pypi.douban.com/simple/ >/dev/null 2>&1 -echo "**********安装nmap和masscan**********" -cd agentDependency +logInfo "安装nmap和masscan" existFlag=`ls /usr/bin/ | grep nmap |wc -L` if [ $existFlag -eq 0 ] ;then - temp=`rpm -ivh nmap-7.80-1.x86_64.rpm` + rpm -U $nmapUrl >/dev/null 2>&1 fi + existFlag=`ls /usr/bin/ | grep masscan |wc -L` if [ $existFlag -eq 0 ] ;then - rm -rf masscan - temp=`rpm -ivh libpcap-devel-1.5.3-12.el7.x86_64.rpm` - #tar -xf masscan.tar.gz if [ ! -d masscan ]; then i=0 while ( [ $i -lt 5 ] ) do - git clone https://github.com/robertdavidgraham/masscan.git + git clone https://github.com/robertdavidgraham/masscan.git >/dev/null 2>&1 let "i++" if [ -d masscan ]; then break fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! masscan下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "masscan下载失败,重试第$i次失败,请重新执行 $0" fi fi cd masscan - temp=`make & make install` + make >/dev/null 2>&1 + make install >/dev/null 2>&1 cd .. - temp=`rm -rf masscan` + rm -rf masscan >/dev/null 2>&1 fi -cd .. -echo "**********验证nmap masscan是否成功安装**********" +logInfo "验证nmap masscan是否成功安装" dependArrays=("masscan" "nmap") for dependName in ${dependArrays[@]} ; do existFlag=`ls /usr/bin/ | grep $dependName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! $dependName未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$dependName未成功安装,请重新执行 $0" fi done -echo "**********初始化环境结束**********" -echo "**********执行sh runAgent.sh**********" -sh runAgent.sh \ No newline at end of file +logInfo "初始化环境结束" +logInfo "执行sh runAgent.sh" +sh runAgent.sh + +if [ ${#infoMessage[*]} -ne 0 ];then + echo + echo "以下信息不会影响魔方正常运行,但可能会导致agent部分功能不可用,请根据提示进行修改,并重启agent" + logInfo "info start" + for info in ${infoMessage[@]} ; do + echo -e "$info" + done + logInfo "info end" +fi \ No newline at end of file diff --git a/deploy/defaultConf/initCenterEnvironmentAndStart.sh b/deploy/defaultConf/initCenterEnvironmentAndStart.sh old mode 100755 new mode 100644 index 1bdc9fe..0bc3dd3 --- a/deploy/defaultConf/initCenterEnvironmentAndStart.sh +++ b/deploy/defaultConf/initCenterEnvironmentAndStart.sh @@ -2,25 +2,60 @@ # 初始化环境 # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh echo -echo "魔方-MagiCude 一键部署脚本 V2.4" +echo "魔方-MagiCude 一键部署脚本 V2.5" echo "@author 贰拾壹" echo "https://github.com/er10yi" echo -# 如果jdk-15已解压,证明已经运行过部署脚本 -if [ -d "jdk-15" ]; then - echo -e "检测到已运行过部署脚本\n继续运行脚本将重置数据库,当前数据会丢失\n如已正常部署,请勿执行" +# 增加操作系统判断 +if [ ! -f /etc/redhat-release ];then + logError "$0 仅支持CentOS 7.x" +fi +tempVersion=`cat /etc/redhat-release | sed -r 's/.* ([0-9]+)\..*/\1/'` +if [ $tempVersion -ne 7 ];then + logError "$0 仅支持CentOS 7.x" +fi + +# 判断center路径是否正确 +mcPath=$PWD +if [ $mcPath != "/root/MagiCude" ]; then + logErrorNotExit "$0 执行路径非/root/MagiCude" + logError "请确认已将deploy目录下的MagiCude复制root目录下" +fi +# 判断center所需文件是否存在 +existFlag=0 +if [ ! -f db/magicude.sql ] ;then + logErrorNotExit "db 目录下未检测到 magicude.sql" + existFlag=1 +fi +dependArrays=("centerapp.jar" "eurekaapp.jar" "center.yml" "eureka.yml") +for dependName in ${dependArrays[@]} ; do + if [ ! -f $dependName ] ;then + logErrorNotExit "MagiCude 目录下未检测到 $dependName" + existFlag=1 + fi +done +if [ $existFlag -eq 1 ] ;then + exit 1 +fi + +# 如果$openjdkDirName已解压,证明已经运行过部署脚本 +if [ -d $openjdkDirName ]; then + logInfo "检测到已运行过部署脚本" + logInfo "继续运行脚本将重置数据库,当前数据会丢失" + logInfo "如已正常部署,请勿执行" echo -n "是否继续(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes != "y" ]] ; then echo - echo "**********退出部署**********" + logInfo "退出部署" exit 1 fi fi -echo "**********开始部署**********" +logInfo "开始部署" # kill all jar jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do @@ -42,26 +77,46 @@ fi existFlag=`ls /usr/bin/ | grep docker |wc -L` if [ $existFlag -ne 0 ] ;then dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") - temp=`systemctl restart docker` + systemctl restart docker for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps -a | grep $imageName |wc -L` if [ $existFlag -ne 0 ] ;then - temp=`docker stop $imageName` - temp=`docker rm $imageName` + docker stop $imageName >/dev/null 2>&1 + docker rm $imageName >/dev/null 2>&1 fi done - temp=`systemctl stop docker` + systemctl stop docker +fi + +# 判断前端api地址是否修改 +errorMessage=() +existFlag=`cat dist/static/js/app.*.js | grep "http://127.0.0.1:9001" |wc -L` +if [ $existFlag -ne 0 ] ;then + errorMessage+=("检测到前端api地址未修改,如果是远程部署,将无法通过ip地址访问魔方-MagiCude,请修改前端api地址,并重启魔方") +fi +# 判断agent.yml内容是否已经修改 +infoMessage=() +if [ -f agent.yml ];then + existFlag=`cat agent.yml | grep "httpValidateApi: http://127.0.0.1:9001/center/pluginchecker" |wc -L` + if [ $existFlag -ne 0 ] ;then + infoMessage=("agent.yml文件center节点httpValidateApi未修改:请将httpValidateApi修改成部署centerapp.jar服务器的ip") + fi + existFlag=`cat agent.yml | grep "dnsValidateIp: 127.0.0.1" |wc -L` + if [ $existFlag -ne 0 ] ;then + infoMessage+=("agent.yml文件center节点dnsValidateIp未修改:请将dnsValidateIp修改成部署centerapp.jar服务器的ip") + fi +else + logError "agent.yml不存在" fi -echo "**********判断是否存在java 环境**********" -java -version +logInfo "判断是否存在java环境" +java -version >/dev/null 2>&1 if [ $? -eq 0 ];then # 存在java环境 java_version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'` - if [ $java_version != "15" ];then - echo "!!!!!!!!!! 当前已存在java $java_version 环境 !!!!!!!!!!" - echo "请将其卸载后,重新执行 $0 " - exit 1 + if [ $java_version != $openjdkVersion ];then + logErrorNotExit "当前已存在 java $java_version 环境" + logError "请将其卸载后,重新执行 $0" fi fi @@ -71,202 +126,211 @@ if [ $existFlag -eq 0 ] ;then echo -n "系统非中科大源,是否修改成中科大源(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes = "y" ]] ; then - echo "**********备份源并更换成中科大源**********" - temp=`sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' -i.backup /etc/yum.repos.d/CentOS-Base.repo` - temp=`yum clean all && yum makecache` + logInfo "备份源并更换成中科大源" + sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' -i.backup /etc/yum.repos.d/CentOS-Base.repo + yum clean all >/dev/null 2>&1 + yum makecache >/dev/null 2>&1 else echo fi fi -echo "**********更新系统,时间可能较久**********" -echo "**********更新或安装依赖出现超时请忽略**********" -temp=`yum -y update` -echo "**********安装依赖**********" -temp=`yum -y install wget fontconfig stix-fonts ntpdate docker gcc make libpcap libpcap-dev clang git` -echo "**********验证依赖是否成功安装**********" +logInfo "更新系统,时间可能较久" +yum -y update >/dev/null 2>&1 +logInfo "安装依赖,时间可能较久" +yum -y install wget fontconfig stix-fonts ntpdate docker gcc make libpcap libpcap-dev clang git >/dev/null 2>&1 +logInfo "验证依赖是否成功安装" dependArrays=("wget" "docker" "make" "gcc" "clang" "git") for dependName in ${dependArrays[@]} ; do existFlag=`ls /usr/bin/ | grep $dependName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! $dependName未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$dependName 未成功安装,请重新执行 $0" fi done -pythonVerion="Python-3.8.5" +# 选择Python版本 +pythonVerion=${pythonVersionArrays[0]} +# echo "请输入数字选择编译安装的Python版本" +# i=1 +# while ( [ $i -le ${#pythonVersionArrays[*]} ] ) +# do +# echo "$i.Python ${pythonVersionArrays[i-1]}" +# let "i++" +# done +# echo -n "10秒后默认选第 1 项 : " +# read -t 10 choice +# if [ ! $choice ]; then +# choice=1 +# fi +# if [[ $choice -gt ${#pythonVersionArrays[*]} ]] || [[ $choice -lt 1 ]]; then +# choice=1 +# fi +# let "choice--" +# pythonVerion="${pythonVersionArrays[choice]}" +# echo + +pythonName="Python" +pythonNameVerion=$pythonName-$pythonVerion pythonTarName=".tar.xz" -echo "**********编译安装$pythonVerion**********" -temp=`yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev zlib*` -if [ ! -f $pythonVerion$pythonTarName ]; then - echo "下载$pythonVerion" +logInfo "编译安装$pythonNameVerion" +yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib1g-dev zlib* >/dev/null 2>&1 +if [ ! -f $pythonNameVerion$pythonTarName ]; then i=0 while ( [ $i -lt 5 ] ) do - # wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz - wget https://mirrors.huaweicloud.com/python/3.8.5/$pythonVerion$pythonTarName + # wget https://www.python.org/ftp/python/$pythonVerion/$pythonNameVerion$pythonTarName + wget https://mirrors.huaweicloud.com/python/$pythonVerion/$pythonNameVerion$pythonTarName >/dev/null 2>&1 let "i++" - if [ -f $pythonVerion$pythonTarName ]; then + if [ -f $pythonNameVerion$pythonTarName ]; then break - fi + fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! $pythonVerion下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$pythonNameVerion下载失败,重试第$i次失败,请重新执行 $0" fi fi -echo "**********判断$pythonVerion是否已安装**********" -python3 --version +python3 --version >/dev/null 2>&1 if [ $? -ne 0 ];then - echo "$pythonVerion未安装" - tar -xJf $pythonVerion$pythonTarName - mkdir /usr/local/python3 - cd $pythonVerion - ./configure --prefix=/usr/local/python3 --enable-shared - make && make install - temp=`ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3` - temp=`ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3` + tar -xJf $pythonNameVerion$pythonTarName + mkdir /usr/local/python3 >/dev/null 2>&1 + cd $pythonNameVerion + ./configure --prefix=/usr/local/python3 --enable-shared >/dev/null 2>&1 + make >/dev/null 2>&1 + make install >/dev/null 2>&1 + ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3 >/dev/null 2>&1 + ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3 >/dev/null 2>&1 cd .. - temp=`rm -rf $pythonVerion` + rm -rf $pythonNameVerion fi -export LD_LIBRARY_PATH=/usr/local/python3/lib -echo "**********判断$pythonVerion是否成功安装**********" -python3 --version +logInfo "判断 $pythonNameVerion 是否成功安装" +python3 --version >/dev/null 2>&1 if [ $? -ne 0 ];then - echo "!!!!!!!!!! $pythonVerion 未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$pythonNameVerion 未成功安装,请重新执行 $0" fi -echo "**********升级pip到最新**********" -temp=`python3 -m pip install --upgrade pip` +logInfo "替换agent.yml中的jep.absolutePath的python路径" +sed -i "s/python3.9/python${pythonVerion:0:3}/g" agent.yml -echo "**********关闭防火墙**********" -systemctl stop firewalld.service # firewalld -systemctl disable firewalld.service # firewalld -systemctl stop iptables.service # iptables -systemctl disable iptables.service # iptables -echo "**********SELinux切换成Permissive**********" +# logInfo "升级pip到最新" +# python3 -m pip install --upgrade pip >/dev/null 2>&1 +logInfo "关闭防火墙" +systemctl stop firewalld.service >/dev/null 2>&1 # firewalld +systemctl disable firewalld.service >/dev/null 2>&1 # firewalld +systemctl stop iptables.service >/dev/null 2>&1 # iptables +systemctl disable iptables.service >/dev/null 2>&1 # iptables +logInfo "SELinux切换成Permissive" setenforce 0 -echo "**********修改时区并同步时间**********" +logInfo "修改时区并同步时间" timedatectl set-timezone Asia/Shanghai -temp=`ntpdate cn.pool.ntp.org` +ntpdate cn.pool.ntp.org >/dev/null 2>&1 -# 判断是否存在openjdk-15_linux-x64_bin.tar.gz,不存在则下载 -openjdk="openjdk-15_linux-x64_bin.tar.gz" +# 判断是否存在$openjdk,不存在则下载 if [ ! -f $openjdk ]; then - echo "**********未检测到$openjdk**********" - echo "下载$openjdk" + logInfo "未检测到$openjdk" + logInfo "下载$openjdk" i=0 while ( [ $i -lt 5 ] ) do # http://jdk.java.net/ - wget https://mirrors.huaweicloud.com/openjdk/15/$openjdk + wget https://mirrors.huaweicloud.com/openjdk/$openjdkVersion/$openjdk >/dev/null 2>&1 let "i++" if [ -f $openjdk ]; then break fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! $openjdk下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$openjdk下载失败,重试第$i次失败,请重新执行 $0" fi fi -if [ ! -d "jdk-15" ]; then - echo "**********解压$openjdk**********" +if [ ! -d $openjdkDirName ]; then + logInfo "解压$openjdk" tar -xf $openjdk fi -echo "**********设置环境变量**********" +# 判断是否已设置环境变量 +existFlag=`cat /root/.bash_profile | grep "/root/MagiCude/$openjdkDirName" |wc -L` +if [ $existFlag -eq 0 ] ;then + logInfo "设置环境变量" cat <<EOF >> /root/.bash_profile -export JAVA_HOME=/root/MagiCude/jdk-15 +export JAVA_HOME=/root/MagiCude/$openjdkDirName export JRE_HOME=\$JAVA_HOME/jre export CLASSPATH=\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH export PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin:\$PATH export LD_LIBRARY_PATH=/usr/local/python3/lib EOF +fi # 下次登录才生效 source /root/.bash_profile -# 需要再次执行,本次编译用到 -export JAVA_HOME=/root/MagiCude/jdk-15 -export JRE_HOME=$JAVA_HOME/jre -export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH -export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH -echo "**********安装JEP**********" -pip3 install wheel -i https://pypi.douban.com/simple/ -pip3 install jep -i https://pypi.douban.com/simple/ +logInfo "安装JEP" +pip3 install wheel -i https://pypi.douban.com/simple/ >/dev/null 2>&1 +pip3 install jep -i https://pypi.douban.com/simple/ >/dev/null 2>&1 -echo "**********安装nmap和masscan**********" -cd agentDependency +logInfo "安装nmap和masscan" existFlag=`ls /usr/bin/ | grep nmap |wc -L` if [ $existFlag -eq 0 ] ;then - temp=`rpm -ivh nmap-7.80-1.x86_64.rpm` + rpm -U $nmapUrl >/dev/null 2>&1 fi existFlag=`ls /usr/bin/ | grep masscan |wc -L` if [ $existFlag -eq 0 ] ;then - temp=`rpm -ivh libpcap-devel-1.5.3-12.el7.x86_64.rpm` - #tar -xf masscan.tar.gz if [ ! -d masscan ]; then i=0 while ( [ $i -lt 5 ] ) do - git clone https://github.com/robertdavidgraham/masscan.git + git clone https://github.com/robertdavidgraham/masscan.git >/dev/null 2>&1 let "i++" if [ -d masscan ]; then break fi done if [ $i -eq 5 ] ;then - echo "!!!!!!!!!! masscan下载失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "masscan下载失败,重试第$i次失败,请重新执行 $0" fi fi cd masscan - temp=`make & make install` + make >/dev/null 2>&1 + make install >/dev/null 2>&1 cd .. - temp=`rm -rf masscan` + rm -rf masscan >/dev/null 2>&1 fi -cd .. -echo "**********验证docker nmap masscan是否成功安装**********" +logInfo "验证docker nmap masscan是否成功安装" dependArrays=("docker" "masscan" "nmap") for dependName in ${dependArrays[@]} ; do existFlag=`ls /usr/bin/ | grep $dependName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! $dependName未成功安装,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "$dependName 未成功安装,请重新执行 $0" fi done -echo "**********docker**********" +logInfo "docker" # docker pull镜像并验证 existFlag=`cat /etc/docker/daemon.json | grep ustc |wc -L` if [ $existFlag -eq 0 ] ;then echo -n "docker非中科大镜像,是否修改成中科大镜像(10秒后默认N)? [y/N]: " read -t 10 checkYes if [[ $checkYes = "y" ]] ; then - echo "**********docker更换成中科大镜像**********" + logInfo "docker更换成中科大镜像" echo -e "{\n\"registry-mirrors\": [\"https://docker.mirrors.ustc.edu.cn\"]\n}" > "/etc/docker/daemon.json" - temp=`systemctl daemon-reload` - temp=`systemctl restart docker` + systemctl daemon-reload >/dev/null 2>&1 + systemctl restart docker else echo fi fi -temp=`systemctl start docker` -temp=`systemctl enable docker` +systemctl start docker +systemctl enable docker >/dev/null 2>&1 # 偷个懒,只判断nginx是否pull # 如果没有证明是第一次执行 # 则全部都要pull existFlag=`docker images | grep nginx |wc -L` if [ $existFlag -eq 0 ] ;then - echo "**********docker拉取所需镜像,时间可能较久**********" - docker pull nginx & - docker pull mysql & - docker pull redis & - docker pull rabbitmq:management & + logInfo "docker拉取所需镜像,时间可能较久" + docker pull nginx >/dev/null 2>&1 & + docker pull mysql >/dev/null 2>&1 & + docker pull redis >/dev/null 2>&1 & + docker pull rabbitmq:management >/dev/null 2>&1 & wait fi -echo "**********验证docker镜像是否已拉取**********" # 如果未成功pull,会尝试再pull -echo "check docker local repository" +logInfo "检查docker本地容器是否已拉取" for i in `seq 1 5` do dockerNameArrays=("nginx" "mysql" "redis" "rabbitmq") @@ -276,8 +340,8 @@ do if [ $imageName = "rabbitmq" ]; then imageName="rabbitmq:management" fi - echo "docker $imageName not existed, pulling latest $imageName now" - docker pull $imageName & + logInfo "$imageName 不存在,正在重新pull $imageName" + docker pull $imageName >/dev/null 2>&1 & wait if [ $imageName = "rabbitmq" ]; then imageName="rabbitmq" @@ -288,42 +352,40 @@ do imageName="rabbitmq:management" fi if [ $i -eq 6 ];then - echo "!!!!!!!!!! docker pull $imageName failed. !!!!!!!!!!" - echo "!!!!!!!!!! 请重新执行 $0 !!!!!!!!!!" - exit 1 + logErrorNotExit "pull $imageName 失败" + logError "请重新执行 $0" fi fi docker ps | grep $imageName - else echo "docker $imageName already existed." + # else logInfo "$imageName 已存在" fi done done -echo "**********docker创建并运行容器**********" -temp=`docker run -di --name magicude_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=8TAQRc9EOkV607qm mysql` -temp=`docker run -di --name magicude_redis -p 6379:6379 redis --requirepass snclGVwsAywx1G2R` -temp=`docker run -di --name magicude_rabbitmq -p 5671:5671 -p 5672:5672 -p 4369:4369 -p 15671:15671 -p 15672:15672 -p 25672:25672 rabbitmq:management` -temp=`docker run -di --name nginxApp -p 80:80 -v $PWD/dist/:/usr/share/nginx/dist/ -v $PWD/nginx/default.conf:/etc/nginx/conf.d/default.conf -d nginx` +logInfo "docker创建并运行容器" +docker run -di --name magicude_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=8TAQRc9EOkV607qm mysql >/dev/null 2>&1 +docker run -di --name magicude_redis -p 6379:6379 redis --requirepass snclGVwsAywx1G2R >/dev/null 2>&1 +docker run -di --name magicude_rabbitmq -p 5671:5671 -p 5672:5672 -p 4369:4369 -p 15671:15671 -p 15672:15672 -p 25672:25672 rabbitmq:management >/dev/null 2>&1 +docker run -di --name nginxApp -p 80:80 -v $PWD/dist/:/usr/share/nginx/dist/ -v $PWD/nginx/default.conf:/etc/nginx/conf.d/default.conf -d nginx >/dev/null 2>&1 sleep 5s # checkDockerImageStatus.sh判断容器如果未成功启动,会尝试启动一次 sh operation/checkDockerImageStatus.sh sleep 10s -echo "**********确保容器服务已成功运行**********" +logInfo "确保容器服务已成功运行" # mysql i=1 while ( [ -z "`docker exec -it magicude_mysql /bin/bash -c "mysql -uroot -p8TAQRc9EOkV607qm -e'show databases'" | grep "information_schema"`" ] && [ $i -lt 6 ] ) do - echo "magicude_mysql未启动,第$i次重启" - temp=`docker start magicude_mysql` + logInfo "magicude_mysql未启动,第$i次重启" + docker start magicude_mysql >/dev/null 2>&1 let "i++" sleep 10s done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!!docker start magicude_mysql失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "docker 启动 magicude_mysql失败,重试第$i次失败,请重新执行 $0" else - echo "magicude_mysql成功启动" + logInfo "magicude_mysql成功启动" fi # 其他 @@ -332,24 +394,42 @@ for imageName in ${dockerNameArrays[@]} ; do i=1 while ( [ -z "`docker exec -it $imageName /bin/bash -c "ls /" | grep "root"`" ] && [ $i -lt 6 ] ) do - echo "$imageName未启动,第$i次重启" - temp=`docker start $imageName` + logInfo "$imageName未启动,第$i次重启" + docker start $imageName >/dev/null 2>&1 let "i++" sleep 10s done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!!docker start $imageName失败,重试第$i次失败,请重新执行 $0 !!!!!!!!!!" - exit 1 + logError "docker 启动 $imageName失败,重试第$i次失败,请重新执行 $0" else - echo "$imageName成功启动" + logInfo "$imageName成功启动" fi done # 再次确保容器已经启动 sh operation/checkDockerImageStatus.sh sleep 10s -echo "**********magicude 增加执行权限**********" +logInfo "magicude 增加执行权限" chmod +x magicude -echo "**********初始化环境结束**********" -echo "**********初始化数据并启动系统**********" -sh initDataAndStart.sh \ No newline at end of file +logInfo "初始化环境结束" +logInfo "初始化数据并启动魔方" +sh initDataAndStart.sh + +if [ ${#infoMessage[*]} -ne 0 ];then + echo + echo "以下信息不会影响魔方正常运行,但可能会导致部分功能不可用,请根据提示进行修改,并重启魔方" + logInfo "info start" + for info in ${infoMessage[@]} ; do + echo -e "$info" + done + logInfo "info end" +fi +if [ ${#errorMessage[*]} -ne 0 ];then + echo + echo "以下错误会影响魔方正常运行,导致魔方不可用,请根据提示进行修改,并重启魔方" + logInfo "error start" + for error in ${errorMessage[@]} ; do + echo -e "$error" + done + logInfo "error end" +fi diff --git a/deploy/defaultConf/initDataAndStart.sh b/deploy/defaultConf/initDataAndStart.sh old mode 100755 new mode 100644 index 8d42a71..5c05705 --- a/deploy/defaultConf/initDataAndStart.sh +++ b/deploy/defaultConf/initDataAndStart.sh @@ -2,48 +2,47 @@ # 初始化环境 # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh i=1 -echo "**********复制initMySQL.sh到MySQL容器**********" +logInfo "复制initMySQL.sh到MySQL容器" docker cp initMySQL.sh magicude_mysql:/usr/local/initMySQL.sh while ( [ -z "`docker exec magicude_mysql tail -n 2 /usr/local/initMySQL.sh`" ] && [ $i -lt 6 ] ) do - echo "复制initMySQL.sh到MySQL容器失败,重试第$i次" + logInfo "复制initMySQL.sh到MySQL容器失败,重试第$i次" docker cp initMySQL.sh magicude_mysql:/usr/local/initMySQL.sh let "i++" done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!! 复制initMySQL.sh到MySQL容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh !!!!!!!!!!" - exit 1 + logError "复制initMySQL.sh到MySQL容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh" else - echo "复制initMySQL.sh到MySQL容器成功" + logInfo "复制initMySQL.sh到MySQL容器成功" fi i=1 -echo "**********复制magicude.sql到MySQL容器**********" +logInfo "复制magicude.sql到MySQL容器" docker cp db/magicude.sql magicude_mysql:/usr/local/magicude.sql while ( [ -z "`docker exec magicude_mysql tail -n 2 /usr/local/magicude.sql`" ] && [ $i -lt 6 ] ) do - echo "复制magicude.sql到MySQL容器失败,重试第$i次" + logInfo "复制magicude.sql到MySQL容器失败,重试第$i次" docker start magicude_mysql sleep 10s docker cp db/magicude.sql magicude_mysql:/usr/local/magicude.sql let "i++" done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!! 复制magicude.sql到MySQL容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh !!!!!!!!!!" - exit 1 + logError "复制magicude.sql到MySQL容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh" else - echo "复制magicude.sql到MySQL容器成功" + logInfo "复制magicude.sql到MySQL容器成功" fi -echo "**********MySQL容器执行initMySQL.sh**********" +logInfo "MySQL容器执行initMySQL.sh" # 增加initMySQL.sh执行成功的判断,magicude数据库存在,则initMySQL.sh执行成功 docker exec -it magicude_mysql /bin/bash -c "sh /usr/local/initMySQL.sh" i=1 while ( [ -z "`docker exec -it magicude_mysql /bin/bash -c "mysql -uroot -p8TAQRc9EOkV607qm -e'CREATE DATABASE magicude DEFAULT CHARACTER SET utf8'" | grep "database exists"`" ] && [ $i -lt 6 ] ) do - echo "MySQL容器initMySQL.sh执行失败,重试第$i次,重新复制initMySQL.sh" + logInfo "MySQL容器initMySQL.sh执行失败,重试第$i次,重新复制initMySQL.sh" docker start magicude_mysql sleep 10s docker cp db/magicude.sql magicude_mysql:/usr/local/magicude.sql @@ -51,41 +50,39 @@ do let "i++" done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!! initMySQL.sh执行失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh !!!!!!!!!!" - exit 1 + logError "initMySQL.sh执行失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh" else - echo "MySQL容器initMySQL.sh执行成功" + logInfo "MySQL容器initMySQL.sh执行成功" fi -echo "**********删除MySQL容器初始化脚本**********" +logInfo "删除MySQL容器初始化脚本" docker exec -it magicude_mysql /bin/bash -c "rm -rf /usr/local/initMySQL.sh" docker exec -it magicude_mysql /bin/bash -c "rm -rf /usr/local/magicude.sql" -echo "**********复制initRMQ.sh到RabbitMQ容器**********" +logInfo "复制initRMQ.sh到RabbitMQ容器" i=1 docker cp initRMQ.sh magicude_rabbitmq:/usr/local/initRMQ.sh while ( [ -z "`docker exec magicude_rabbitmq tail -n 2 /usr/local/initRMQ.sh`" ] && [ $i -lt 6 ] ) do - echo "复制initRMQ.sh到RabbitMQ容器失败,重试第$i次" + logInfo "复制initRMQ.sh到RabbitMQ容器失败,重试第$i次" docker start magicude_rabbitmq sleep 5s docker cp initRMQ.sh magicude_rabbitmq:/usr/local/initRMQ.sh let "i++" done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!! 复制initRMQ.sh到RabbitMQ容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh !!!!!!!!!!" - exit 1 + logError "复制initRMQ.sh到RabbitMQ容器失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh" else - echo "复制initRMQ.sh到RabbitMQ容器成功" + logInfo "复制initRMQ.sh到RabbitMQ容器成功" fi -echo "**********RabbitMQ容器执行initRMQ.sh**********" +logInfo "RabbitMQ容器执行initRMQ.sh" # 增加initRMQ.sh执行成功的判断,magicude用户存在,则initRMQ.sh执行成功 docker exec -it magicude_rabbitmq /bin/bash -c "sh /usr/local/initRMQ.sh" i=1 while ( [ -z "`docker exec -it magicude_rabbitmq /bin/bash -c "rabbitmqctl add_user magicude vpUNx2TpULV1kB7l" | grep "already exists"`" ] && [ $i -lt 6 ] ) do - echo "RabbitMQ容器initRMQ.sh执行失败,重试第$i次,重新复制initRMQ.sh" + logInfo "RabbitMQ容器initRMQ.sh执行失败,重试第$i次,重新复制initRMQ.sh" docker start magicude_rabbitmq sleep 10s docker cp initRMQ.sh magicude_rabbitmq:/usr/local/initRMQ.sh @@ -93,17 +90,16 @@ do let "i++" done if [ $i -eq 6 ] ;then - echo "!!!!!!!!!! initRMQ.sh执行失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh !!!!!!!!!!" - exit 1 + logError "initRMQ.sh执行失败,重试第$i次失败,请重新执行 initCenterEnvironmentAndStart.sh" else - echo "RabbitMQ容器initRMQ.sh执行成功" + logInfo "RabbitMQ容器initRMQ.sh执行成功" fi -echo "**********删除RabbitMQ容器初始化脚本**********" +logInfo "删除RabbitMQ容器初始化脚本" docker exec -it magicude_rabbitmq /bin/bash -c "rm -rf /usr/local/initRMQ.sh" cd operation sh runCenterService.sh -echo "**********./magicude status**********" +logInfo "执行magicude status" .././magicude status \ No newline at end of file diff --git a/deploy/defaultConf/initMySQL.sh b/deploy/defaultConf/initMySQL.sh old mode 100755 new mode 100644 index 0c1c5ff..9efd227 --- a/deploy/defaultConf/initMySQL.sh +++ b/deploy/defaultConf/initMySQL.sh @@ -3,6 +3,6 @@ # @author 贰拾壹 # https://github.com/er10yi -echo "**********docker MySQL导入数据**********" -temp=`mysql -uroot -p8TAQRc9EOkV607qm -e"CREATE DATABASE magicude DEFAULT CHARACTER SET utf8"` -temp=`mysql -uroot -p8TAQRc9EOkV607qm -Dmagicude -e"SOURCE /usr/local/magicude.sql"` \ No newline at end of file +echo "*****info***** docker MySQL导入数据" +mysql -uroot -p8TAQRc9EOkV607qm -e"CREATE DATABASE magicude DEFAULT CHARACTER SET utf8" >/dev/null 2>&1 +mysql -uroot -p8TAQRc9EOkV607qm -Dmagicude -e"SOURCE /usr/local/magicude.sql" >/dev/null 2>&1 \ No newline at end of file diff --git a/deploy/defaultConf/initRMQ.sh b/deploy/defaultConf/initRMQ.sh old mode 100755 new mode 100644 index ab7f29c..d070ed5 --- a/deploy/defaultConf/initRMQ.sh +++ b/deploy/defaultConf/initRMQ.sh @@ -3,14 +3,14 @@ # @author 贰拾壹 # https://github.com/er10yi -echo "**********docker RabbitMQ初始化**********" -temp=`rabbitmqctl add_vhost /` -temp=`rabbitmqctl add_user magicude vpUNx2TpULV1kB7l` -temp=`rabbitmqctl set_user_tags magicude administrator` -temp=`rabbitmqctl set_permissions -p / magicude '.' '.' '.'` -echo "**********删除guest用户**********" -temp=`rabbitmqctl delete_user guest` -echo "**********创建队列**********" -temp=`rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"scanresult">>}, true, false, [], none, "").'` -temp=`rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"imresult">>}, true, false, [], none, "").'` -temp=`rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"agentconfig">>}, true, false, [], none, "").'` \ No newline at end of file +echo "*****info***** docker RabbitMQ初始化" +rabbitmqctl add_vhost / >/dev/null 2>&1 +rabbitmqctl add_user magicude vpUNx2TpULV1kB7l >/dev/null 2>&1 +rabbitmqctl set_user_tags magicude administrator >/dev/null 2>&1 +rabbitmqctl set_permissions -p / magicude '.' '.' '.' >/dev/null 2>&1 +echo "*****info***** 删除guest用户" +rabbitmqctl delete_user guest >/dev/null 2>&1 +echo "*****info***** 创建队列" +rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"scanresult">>}, true, false, [], none, "").' >/dev/null 2>&1 +rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"imresult">>}, true, false, [], none, "").' >/dev/null 2>&1 +rabbitmqctl eval 'rabbit_amqqueue:declare({resource, <<"/">>, queue, <<"agentconfig">>}, true, false, [], none, "").' >/dev/null 2>&1 \ No newline at end of file diff --git a/deploy/defaultConf/magicude b/deploy/defaultConf/magicude old mode 100755 new mode 100644 index 7d3ffe1..360f1e9 --- a/deploy/defaultConf/magicude +++ b/deploy/defaultConf/magicude @@ -1,30 +1,29 @@ #!/bin/bash # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh jarStatus(){ - echo "check MagiCude service status" + logInfo "检查 MagiCude 服务状态" jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do existFlag=`ps -ef|grep $jarName|grep -v grep|wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! magicude service $jarName not started. !!!!!!!!!!" - echo "!!!!!!!!!! please run magicude start !!!!!!!!!!" - else echo "magicude service $jarName already started." + logErrorNotExit "$jarName 未启动,请手动执行 magicude start" + else logInfo "$jarName 已启动" fi done } dockerStatus() { - echo "check docker images status" + logInfo "检查 docker 容器状态" dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps | grep $imageName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "!!!!!!!!!! docker $imageName not started. !!!!!!!!!!" - echo "!!!!!!!!!! please run magicude start !!!!!!!!!!" - else echo "docker $imageName already started." + logErrorNotExit "$imageName 未启动,请手动执行 magicude start" + else logInfo "$imageName 已启动" fi done } @@ -32,15 +31,15 @@ dockerStatus() dockerStatusAndStart() { systemctl start docker - echo "check docker images status and start images" + logInfo "检查 docker 容器状态并启动容器" dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps | grep $imageName |wc -L` if [ $existFlag -eq 0 ] ;then - echo "$imageName not started, starting $imageName now" - temp=`docker start $imageName` - echo "docker start $imageName done." - else echo "$imageName already started." + logInfo "$imageName 未启动, 正在启动 $imageName" + docker start $imageName >/dev/null 2>&1 + logInfo "$imageName 启动完成" + else logInfo "$imageName 已启动" fi done } @@ -48,16 +47,16 @@ dockerStatusAndStart() statusAndStart() { setenforce 0 - echo "check MagiCude service status and run jar" + logInfo "检查 MagiCude 服务状态并启动 jar" jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do existFlag=`ps -ef|grep $jarName|grep -v grep|wc -L` if [ $existFlag -eq 0 ] ;then - echo "service $jarName not started. starting $jarName now" + logInfo "$jarName 未启动,正在启动 $jarName" temp=$jarName nohup java -jar "$jarName.jar" --spring.config.location="${temp/app/}".yml > /dev/null 2>&1 & - echo "magicude start $jarName done." - else echo "service $jarName already started." + logInfo "$jarName 启动完成" + else logInfo "$jarName 已启动" fi done } @@ -65,29 +64,22 @@ statusAndStart() status() { - echo "********************************" dockerStatus - echo "********************************" jarStatus - echo "********************************" exit 0; } start() { setenforce 0 - echo "********************************" dockerStatusAndStart - echo "********************************" statusAndStart - echo "********************************" exit 0; } stop() { - echo "********************************" - echo "kill center all jar" + logInfo "停止 MagiCude 所有服务" jarNameArrays=("eurekaapp" "centerapp" "agentapp") for jarName in ${jarNameArrays[@]} ; do tempPid=`ps -ef|grep $jarName|grep -v grep|cut -c 9-15` @@ -95,28 +87,26 @@ stop() kill -9 $tempPid fi done - echo "done." - echo "kill nmap masscan" + logInfo "完成" + logInfo "停止 nmap和masscan" existFlag=`ps -ef|grep nmap|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then - kill -9 $(pidof nmap) fi existFlag=`ps -ef|grep masscan|grep -v grep|cut -c 9-15` if [ $existFlag ] ;then kill -9 $(pidof masscan) fi - echo "done." - echo "docker stop container" + logInfo "完成" + logInfo "停止 docker 容器" dockerNameArrays=("nginxApp" "magicude_mysql" "magicude_redis" "magicude_rabbitmq") for imageName in ${dockerNameArrays[@]} ; do existFlag=`docker ps | grep $imageName |wc -L` if [ $existFlag -ne 0 ] ;then - temp=`docker stop $imageName` + docker stop $imageName >/dev/null 2>&1 fi done - echo "done." - echo "********************************" + logInfo "完成" } case "$1" in diff --git a/deploy/defaultConf/magicude.sql b/deploy/defaultConf/magicude.sql old mode 100755 new mode 100644 index 8665f20..ef56068 --- a/deploy/defaultConf/magicude.sql +++ b/deploy/defaultConf/magicude.sql @@ -11,7 +11,7 @@ Target Server Version : 80021 File Encoding : 65001 - Date: 13/09/2020 16:35:48 + Date: 09/10/2020 20:50:23 */ SET NAMES utf8mb4; @@ -21,70 +21,77 @@ SET FOREIGN_KEY_CHECKS = 0; -- Table structure for tb_agent -- ---------------------------- DROP TABLE IF EXISTS `tb_agent`; -CREATE TABLE `tb_agent` ( +CREATE TABLE `tb_agent` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'agent编号', - `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'agent名称', - `nmappath` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'nmap路径', - `masspath` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'mass路径', - `ipaddress` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ip地址', - `online` tinyint(1) DEFAULT NULL COMMENT '在线', - `timeouts` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '超时次数', + `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'agent名称', + `nmappath` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'nmap路径', + `masspath` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'mass路径', + `ipaddress` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ip地址', + `online` tinyint(1) NULL DEFAULT NULL COMMENT '在线', + `timeouts` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '超时次数', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='agent表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'agent表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Table structure for tb_assetip -- ---------------------------- DROP TABLE IF EXISTS `tb_assetip`; -CREATE TABLE `tb_assetip` ( +CREATE TABLE `tb_assetip` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产ip编号', - `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目信息编号', + `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目信息编号', `ipaddressv4` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'ipv4地址', - `ipaddressv6` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ipv6地址', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '安全检测白名单', - `assetnotifywhitelist` tinyint(1) DEFAULT NULL COMMENT '资产提醒白名单', - `activetime` datetime DEFAULT NULL COMMENT 'ip发现时间', - `passivetime` datetime DEFAULT NULL COMMENT 'ip下线时间', - `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注', + `ipaddressv6` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ipv6地址', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '安全检测白名单', + `assetnotifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '资产提醒白名单', + `activetime` datetime(0) NULL DEFAULT NULL COMMENT 'ip发现时间', + `passivetime` datetime(0) NULL DEFAULT NULL COMMENT 'ip下线时间', + `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='资产ip,用于记录资产ip信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产ip,用于记录资产ip信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_assetip +-- ---------------------------- -- ---------------------------- -- Table structure for tb_assetport -- ---------------------------- DROP TABLE IF EXISTS `tb_assetport`; -CREATE TABLE `tb_assetport` ( +CREATE TABLE `tb_assetport` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '端口编号', - `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资产ip编号', + `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产ip编号', `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '端口', - `protocol` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口协议', - `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口开放状态', - `service` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口服务', - `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '服务版本', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '安全检测白名单', - `assetnotifywhitelist` tinyint(1) DEFAULT NULL COMMENT '提醒白名单', - `uptime` datetime DEFAULT NULL COMMENT '端口发现时间', - `downtime` datetime DEFAULT NULL COMMENT '端口关闭时间', - `changedtime` datetime DEFAULT NULL COMMENT '修改时间', + `protocol` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口协议', + `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口开放状态', + `service` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口服务', + `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务版本', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '安全检测白名单', + `assetnotifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '提醒白名单', + `uptime` datetime(0) NULL DEFAULT NULL COMMENT '端口发现时间', + `downtime` datetime(0) NULL DEFAULT NULL COMMENT '端口关闭时间', + `changedtime` datetime(0) NULL DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='资产端口,用于记录端口信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产端口,用于记录端口信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_assetport +-- ---------------------------- -- ---------------------------- -- Table structure for tb_categorysecond -- ---------------------------- DROP TABLE IF EXISTS `tb_categorysecond`; -CREATE TABLE `tb_categorysecond` ( +CREATE TABLE `tb_categorysecond` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞二级分类编号', - `categorytopid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞一级分类编号', - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞二级分类类型', + `categorytopid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞一级分类编号', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞二级分类类型', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞二级分类,用于记录二级漏洞类型'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞二级分类,用于记录二级漏洞类型' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_categorysecond -- ---------------------------- -BEGIN; INSERT INTO `tb_categorysecond` VALUES ('1252508920921067520', '1252508920883318784', '代码执行'); INSERT INTO `tb_categorysecond` VALUES ('1252508920992370688', '1252508920954621952', 'SQL注入'); INSERT INTO `tb_categorysecond` VALUES ('1252508921013342208', '1252508920954621952', 'LDAP注入'); @@ -159,22 +166,20 @@ INSERT INTO `tb_categorysecond` VALUES ('1252508922833670144', '1252508922640732 INSERT INTO `tb_categorysecond` VALUES ('1252508922846253056', '1252508922640732160', '邮箱验证码包含在响应中'); INSERT INTO `tb_categorysecond` VALUES ('1252508922875613184', '1252508922858835968', '默认'); INSERT INTO `tb_categorysecond` VALUES ('1260829552448507904', '1260833385614544896', '拒绝服务'); -COMMIT; -- ---------------------------- -- Table structure for tb_categorytop -- ---------------------------- DROP TABLE IF EXISTS `tb_categorytop`; -CREATE TABLE `tb_categorytop` ( +CREATE TABLE `tb_categorytop` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞一级分类编号', - `name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞一级分类名称', + `name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞一级分类名称', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞一级分类,用于记录漏洞一级分类'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞一级分类,用于记录漏洞一级分类' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_categorytop -- ---------------------------- -BEGIN; INSERT INTO `tb_categorytop` VALUES ('1252508920883318784', '代码执行'); INSERT INTO `tb_categorytop` VALUES ('1252508920954621952', '注入'); INSERT INTO `tb_categorytop` VALUES ('1252508921361469440', '失效的身份认证'); @@ -193,129 +198,143 @@ INSERT INTO `tb_categorytop` VALUES ('1252508922586206208', '不严格的数据 INSERT INTO `tb_categorytop` VALUES ('1252508922640732160', '业务逻辑'); INSERT INTO `tb_categorytop` VALUES ('1252508922858835968', '默认'); INSERT INTO `tb_categorytop` VALUES ('1260833385614544896', '拒绝服务'); -COMMIT; -- ---------------------------- -- Table structure for tb_checkresult -- ---------------------------- DROP TABLE IF EXISTS `tb_checkresult`; -CREATE TABLE `tb_checkresult` ( +CREATE TABLE `tb_checkresult` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '检测结果编号', - `assetportid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口编号', - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '检测结果名称', - `result` varchar(20480) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '检测结果', - `risk` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '缺陷风险级别', - `activetime` datetime DEFAULT NULL COMMENT '缺陷发现时间', - `passivetime` datetime DEFAULT NULL COMMENT '缺陷修复时间', - `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注', + `assetportid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口编号', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测结果名称', + `result` varchar(20480) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测结果', + `risk` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '缺陷风险级别', + `activetime` datetime(0) NULL DEFAULT NULL COMMENT '缺陷发现时间', + `passivetime` datetime(0) NULL DEFAULT NULL COMMENT '缺陷修复时间', + `remark` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='检测结果,用于记录nse或自定义插件检测结果'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '检测结果,用于记录nse或自定义插件检测结果' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_checkresult +-- ---------------------------- -- ---------------------------- -- Table structure for tb_checkresult_vuln -- ---------------------------- DROP TABLE IF EXISTS `tb_checkresult_vuln`; -CREATE TABLE `tb_checkresult_vuln` ( +CREATE TABLE `tb_checkresult_vuln` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', `checkresultid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '检测结果编号', `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='检测结果漏洞中间表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '检测结果漏洞中间表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_checkresult_vuln +-- ---------------------------- -- ---------------------------- -- Table structure for tb_contact -- ---------------------------- DROP TABLE IF EXISTS `tb_contact`; -CREATE TABLE `tb_contact` ( +CREATE TABLE `tb_contact` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系人', - `email` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱', - `phone` varchar(24) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '电话,座机或手机', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人', + `email` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱', + `phone` varchar(24) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '电话,座机或手机', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='联系表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_contact +-- ---------------------------- -- ---------------------------- -- Table structure for tb_contact_projectinfo -- ---------------------------- DROP TABLE IF EXISTS `tb_contact_projectinfo`; -CREATE TABLE `tb_contact_projectinfo` ( +CREATE TABLE `tb_contact_projectinfo` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `contactid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '联系编号', - `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目信息编号', + `contactid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系编号', + `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目信息编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='联系项目信息中间表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '联系项目信息中间表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_contact_projectinfo +-- ---------------------------- -- ---------------------------- -- Table structure for tb_cronjob -- ---------------------------- DROP TABLE IF EXISTS `tb_cronjob`; -CREATE TABLE `tb_cronjob` ( +CREATE TABLE `tb_cronjob` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称', - `cronexpression` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'cron表达式', + `cronexpression` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'cron表达式', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='计划任务表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '计划任务表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_cronjob -- ---------------------------- -BEGIN; INSERT INTO `tb_cronjob` VALUES ('1216569721126785024', '任务状态监控', '0/10 * * * * ?'); INSERT INTO `tb_cronjob` VALUES ('1216569761488572416', 'agent心跳包监控', '0 0/5 * * * ?'); INSERT INTO `tb_cronjob` VALUES ('1216569881969954816', '邮件资产报告', NULL); INSERT INTO `tb_cronjob` VALUES ('1216569922503708672', '邮件漏洞报告', NULL); INSERT INTO `tb_cronjob` VALUES ('1216569975163195392', '每天执行一次的任务', '0 21 3 * * ?'); INSERT INTO `tb_cronjob` VALUES ('1216570003462164488', '统计报表数据', '0 0 6 * * ?'); -COMMIT; -- ---------------------------- -- Table structure for tb_democode -- ---------------------------- DROP TABLE IF EXISTS `tb_democode`; -CREATE TABLE `tb_democode` ( +CREATE TABLE `tb_democode` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞示例代码编号', - `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞编号', - `democode` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '漏洞示例代码', - `poc` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '漏洞poc', + `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞编号', + `democode` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '漏洞示例代码', + `poc` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '漏洞poc', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞示例代码'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞示例代码' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_democode -- ---------------------------- -BEGIN; INSERT INTO `tb_democode` VALUES ('1252508972309680128', '1252508972280320000', '默认信息漏洞示例代码', '默认信息漏洞POC'); INSERT INTO `tb_democode` VALUES ('1252508972506812416', '1252508972448092160', '默认低危漏洞示例代码', '默认低危漏洞POC'); INSERT INTO `tb_democode` VALUES ('1252508972615864320', '1252508972586504192', '默认中危漏洞示例代码', '默认中危漏洞POC'); INSERT INTO `tb_democode` VALUES ('1252508972695556096', '1252508972666195968', '默认高危漏洞示例代码', '默认高危漏洞POC'); INSERT INTO `tb_democode` VALUES ('1252508972771053568', '1252508972750082048', '默认严重漏洞示例代码', '默认严重漏洞POC'); INSERT INTO `tb_democode` VALUES ('1252508972859133952', '1252508972833968128', '默认致命漏洞示例代码', '默认致命漏洞POC'); -COMMIT; -- ---------------------------- -- Table structure for tb_department -- ---------------------------- DROP TABLE IF EXISTS `tb_department`; -CREATE TABLE `tb_department` ( +CREATE TABLE `tb_department` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `departmentname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '部门名称', + `departmentname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门名称', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='部门信息表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门信息表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_department +-- ---------------------------- -- ---------------------------- -- Table structure for tb_dictionarypassword -- ---------------------------- DROP TABLE IF EXISTS `tb_dictionarypassword`; -CREATE TABLE `tb_dictionarypassword` ( +CREATE TABLE `tb_dictionarypassword` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典编号', - `password` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字典密码', + `password` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字典密码', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='字典,用于记录密码'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典,用于记录密码' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_dictionarypassword -- ---------------------------- -BEGIN; INSERT INTO `tb_dictionarypassword` VALUES ('1249945537030000640', 'root'); INSERT INTO `tb_dictionarypassword` VALUES ('1253148513987072000', '1qaz@WSX'); INSERT INTO `tb_dictionarypassword` VALUES ('1253148514104512512', 'admin123456'); @@ -340,44 +359,40 @@ INSERT INTO `tb_dictionarypassword` VALUES ('1304068896965398528', 'tomcat'); INSERT INTO `tb_dictionarypassword` VALUES ('1304068897175113728', 'administrator'); INSERT INTO `tb_dictionarypassword` VALUES ('1304068932222717952', 'toor'); INSERT INTO `tb_dictionarypassword` VALUES ('1304068956872642560', '123456'); -COMMIT; -- ---------------------------- -- Table structure for tb_dictionaryusername -- ---------------------------- DROP TABLE IF EXISTS `tb_dictionaryusername`; -CREATE TABLE `tb_dictionaryusername` ( +CREATE TABLE `tb_dictionaryusername` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '字典编号', - `username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '字典用户名', + `username` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字典用户名', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='字典,用于记录用户名'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '字典,用于记录用户名' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_dictionaryusername -- ---------------------------- -BEGIN; INSERT INTO `tb_dictionaryusername` VALUES ('1304068407464955904', 'admin'); INSERT INTO `tb_dictionaryusername` VALUES ('1304068407913746432', 'root'); INSERT INTO `tb_dictionaryusername` VALUES ('1304068407976660992', 'tomcat'); INSERT INTO `tb_dictionaryusername` VALUES ('1304068408039575552', 'administrator'); INSERT INTO `tb_dictionaryusername` VALUES ('1304068408102490112', 'test'); INSERT INTO `tb_dictionaryusername` VALUES ('1305054577313320960', 'linux'); -COMMIT; -- ---------------------------- -- Table structure for tb_domainwhitelist -- ---------------------------- DROP TABLE IF EXISTS `tb_domainwhitelist`; -CREATE TABLE `tb_domainwhitelist` ( +CREATE TABLE `tb_domainwhitelist` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数编号', - `domain` varchar(254) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '域名', + `domain` varchar(254) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '域名', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='域名白名单'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '域名白名单' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_domainwhitelist -- ---------------------------- -BEGIN; INSERT INTO `tb_domainwhitelist` VALUES ('1166176029530787868', 'microsoft.com'); INSERT INTO `tb_domainwhitelist` VALUES ('1212621047124332544', 'centos.org'); INSERT INTO `tb_domainwhitelist` VALUES ('1212633068138008576', 'apache.org'); @@ -387,144 +402,158 @@ INSERT INTO `tb_domainwhitelist` VALUES ('1212636857746198528', 'nginx.net'); INSERT INTO `tb_domainwhitelist` VALUES ('1212985316789587968', 'baidu.com'); INSERT INTO `tb_domainwhitelist` VALUES ('1234145903191920640', 'google.com'); INSERT INTO `tb_domainwhitelist` VALUES ('1234147367637356544', 'firefox.com'); -COMMIT; -- ---------------------------- -- Table structure for tb_host -- ---------------------------- DROP TABLE IF EXISTS `tb_host`; -CREATE TABLE `tb_host` ( +CREATE TABLE `tb_host` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主机编号', - `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资产ip编号', - `macaddress` varchar(48) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'mac地址', - `hostname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '主机名', - `ostype` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '操作系统类型', - `osversion` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '操作系统版本', - `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '主机类型', - `owner` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '主机所有者', - `activetime` datetime DEFAULT NULL COMMENT '主机发现时间', - `remark` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注,标记非dns反向解析', + `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产ip编号', + `macaddress` varchar(48) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'mac地址', + `hostname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主机名', + `ostype` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作系统类型', + `osversion` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作系统版本', + `type` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主机类型', + `owner` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主机所有者', + `activetime` datetime(0) NULL DEFAULT NULL COMMENT '主机发现时间', + `remark` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注,标记非dns反向解析', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='主机,用于记录主机信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '主机,用于记录主机信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_host +-- ---------------------------- -- ---------------------------- -- Table structure for tb_imvulnnotify -- ---------------------------- DROP TABLE IF EXISTS `tb_imvulnnotify`; -CREATE TABLE `tb_imvulnnotify` ( +CREATE TABLE `tb_imvulnnotify` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `notify` tinyint(1) DEFAULT NULL COMMENT '是否开启通知', - `notifyall` tinyint(1) DEFAULT NULL COMMENT '是否提醒所有人', - `secret` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '秘钥', - `risk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '风险等级', - `receiver` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '接收人列表', - `messageurl` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '消息地址', - `messagetitle` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '消息标题', - `messageprefix` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '消息前缀', - `messagesuffix` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '消息后缀', - `messagecharset` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '消息编码', + `notify` tinyint(1) NULL DEFAULT NULL COMMENT '是否开启通知', + `notifyall` tinyint(1) NULL DEFAULT NULL COMMENT '是否提醒所有人', + `secret` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '秘钥', + `risk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '风险等级', + `receiver` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人列表', + `messageurl` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息地址', + `messagetitle` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息标题', + `messageprefix` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息前缀', + `messagesuffix` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息后缀', + `messagecharset` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息编码', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='即时消息漏洞提醒表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '即时消息漏洞提醒表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_imvulnnotify -- ---------------------------- -BEGIN; INSERT INTO `tb_imvulnnotify` VALUES ('1143092349392524201', 0, 0, '', '低危,中危,高危,严重,致命', '', '', '【魔方】漏洞提醒', '您好', '请及时处理', 'utf-8'); -COMMIT; -- ---------------------------- -- Table structure for tb_ipportwhitelist -- ---------------------------- DROP TABLE IF EXISTS `tb_ipportwhitelist`; -CREATE TABLE `tb_ipportwhitelist` ( +CREATE TABLE `tb_ipportwhitelist` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `ipwhitelistid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ip白名单编号', - `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '检测白名单', - `notifywhitelist` tinyint(1) DEFAULT NULL COMMENT '提醒白名单', + `ipwhitelistid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ip白名单编号', + `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '检测白名单', + `notifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '提醒白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='ip端口白名单表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'ip端口白名单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_ipportwhitelist +-- ---------------------------- -- ---------------------------- -- Table structure for tb_ipwhitelist -- ---------------------------- DROP TABLE IF EXISTS `tb_ipwhitelist`; -CREATE TABLE `tb_ipwhitelist` ( +CREATE TABLE `tb_ipwhitelist` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `ip` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ip', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '检测白名单', - `notifywhitelist` tinyint(1) DEFAULT NULL COMMENT '提醒白名单', + `ip` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ip', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '检测白名单', + `notifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '提醒白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='ip白名单表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'ip白名单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_ipwhitelist +-- ---------------------------- -- ---------------------------- -- Table structure for tb_location -- ---------------------------- DROP TABLE IF EXISTS `tb_location`; -CREATE TABLE `tb_location` ( +CREATE TABLE `tb_location` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '位置编号', - `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资产ip编号', - `country` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '国家', - `province` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '省份', - `road` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '道路', - `building` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '大厦', - `floor` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '楼层', - `direction` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '方位', + `assetipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产ip编号', + `country` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '国家', + `province` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '省份', + `road` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '道路', + `building` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大厦', + `floor` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '楼层', + `direction` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方位', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='位置,用于记录位置信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '位置,用于记录位置信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_location +-- ---------------------------- -- ---------------------------- -- Table structure for tb_nmapconfig -- ---------------------------- DROP TABLE IF EXISTS `tb_nmapconfig`; -CREATE TABLE `tb_nmapconfig` ( +CREATE TABLE `tb_nmapconfig` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'nmap配置编号', `taskid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务编号', - `threadnumber` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '线程数量,在mass2Nmap模式下使用', - `singleipscantime` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '单个ip扫描次数,在mass2Nmap模式下使用', - `additionoption` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '附加选项,在mass2Nmap模式下使用', + `threadnumber` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '线程数量,在mass2Nmap模式下使用', + `singleipscantime` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单个ip扫描次数,在mass2Nmap模式下使用', + `additionoption` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附加选项,在mass2Nmap模式下使用', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='mass2Nmap模式下,nmap的配置'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'mass2Nmap模式下,nmap的配置' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_nmapconfig -- ---------------------------- -BEGIN; INSERT INTO `tb_nmapconfig` VALUES ('1305055496268550144', '1304327021228331008', '10', '1', '-Pn -n -sV --max-retries=1 --open'); -COMMIT; -- ---------------------------- -- Table structure for tb_notifylog -- ---------------------------- DROP TABLE IF EXISTS `tb_notifylog`; -CREATE TABLE `tb_notifylog` ( +CREATE TABLE `tb_notifylog` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型', - `recipient` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '接收人', - `receiveuser` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '接收账户', - `content` varchar(20480) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '内容', - `success` tinyint(1) DEFAULT NULL COMMENT '发送成功', - `exception` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '异常消息', - `sendtime` datetime DEFAULT NULL COMMENT '发送时间', + `type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型', + `recipient` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人', + `receiveuser` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收账户', + `content` varchar(20480) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容', + `success` tinyint(1) NULL DEFAULT NULL COMMENT '发送成功', + `exception` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '异常消息', + `sendtime` datetime(0) NULL DEFAULT NULL COMMENT '发送时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='通知记录表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通知记录表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_notifylog +-- ---------------------------- -- ---------------------------- -- Table structure for tb_pluginassetservice -- ---------------------------- DROP TABLE IF EXISTS `tb_pluginassetservice`; -CREATE TABLE `tb_pluginassetservice` ( +CREATE TABLE `tb_pluginassetservice` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产服务编号', - `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件配置编号', + `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件配置编号', `assetservice` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产服务', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='资产服务,记录数据库中所有ip的service,根据服务确定对应的nse或者自定义插件进行扫描'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产服务,记录数据库中所有ip的service,根据服务确定对应的nse或者自定义插件进行扫描' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_pluginassetservice -- ---------------------------- -BEGIN; INSERT INTO `tb_pluginassetservice` VALUES ('1298634974131523584', '1298634973577875456', 'redis'); INSERT INTO `tb_pluginassetservice` VALUES ('1298634975737942016', '1298634975670833152', 'memcached'); INSERT INTO `tb_pluginassetservice` VALUES ('1298634975968628736', '1298634975670833152', 'memcache'); @@ -556,23 +585,21 @@ INSERT INTO `tb_pluginassetservice` VALUES ('1298635551120953344', '129863555107 INSERT INTO `tb_pluginassetservice` VALUES ('1298635551552966656', '1298635551494246400', 'ftp'); INSERT INTO `tb_pluginassetservice` VALUES ('1298635668129452032', '1298635551737516032', 'http'); INSERT INTO `tb_pluginassetservice` VALUES ('1305054771446681600', '1305054770993696768', 'http'); -COMMIT; -- ---------------------------- -- Table structure for tb_pluginassetversion -- ---------------------------- DROP TABLE IF EXISTS `tb_pluginassetversion`; -CREATE TABLE `tb_pluginassetversion` ( +CREATE TABLE `tb_pluginassetversion` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产版本编号', - `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件配置编号', + `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件配置编号', `assetversion` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产版本', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='资产版本,记录数据库中所有ip的version,根据版本确定对应的nse或者自定义插件进行扫描'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产版本,记录数据库中所有ip的version,根据版本确定对应的nse或者自定义插件进行扫描' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_pluginassetversion -- ---------------------------- -BEGIN; INSERT INTO `tb_pluginassetversion` VALUES ('1298634974316072960', '1298634973577875456', 'Redis key-value store'); INSERT INTO `tb_pluginassetversion` VALUES ('1298634975792467968', '1298634975670833152', 'Memcached'); INSERT INTO `tb_pluginassetversion` VALUES ('1298634976157372416', '1298634976069292032', 'Zookeeper'); @@ -602,28 +629,26 @@ INSERT INTO `tb_pluginassetversion` VALUES ('1298635551397777408', '129863555107 INSERT INTO `tb_pluginassetversion` VALUES ('1298635551594909696', '1298635551494246400', 'ftp'); INSERT INTO `tb_pluginassetversion` VALUES ('1298635551771070464', '1298635551737516032', 'nginx'); INSERT INTO `tb_pluginassetversion` VALUES ('1305054771866112000', '1305054770993696768', 'Elasticsearch'); -COMMIT; -- ---------------------------- -- Table structure for tb_pluginconfig -- ---------------------------- DROP TABLE IF EXISTS `tb_pluginconfig`; -CREATE TABLE `tb_pluginconfig` ( +CREATE TABLE `tb_pluginconfig` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '插件配置编号', `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '插件名称', - `args` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件参数', - `risk` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件风险级别', - `type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件类型:nse或者自定义', - `timeout` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件超时', - `plugincode` text COMMENT '插件代码', - `validatetype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'http辅助验证或dns辅助验证', + `args` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件参数', + `risk` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件风险级别', + `type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件类型:nse或者自定义', + `timeout` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件超时', + `plugincode` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '插件代码', + `validatetype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'http辅助验证或dns辅助验证', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='插件配置,用于记录插件配置信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '插件配置,用于记录插件配置信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_pluginconfig -- ---------------------------- -BEGIN; INSERT INTO `tb_pluginconfig` VALUES ('1298634973577875456', 'JavaRedisWeakPass', 'info', '高危', 'selfd', '3000', NULL, ''); INSERT INTO `tb_pluginconfig` VALUES ('1298634975670833152', 'JavaMemcachedUnauth', 'stats', '中危', 'selfd', '3000', NULL, ''); INSERT INTO `tb_pluginconfig` VALUES ('1298634976069292032', 'JavaZookeeperUnauth', 'envi', '中危', 'selfd', '3000', NULL, ''); @@ -653,78 +678,86 @@ INSERT INTO `tb_pluginconfig` VALUES ('1298635551074816000', 'MysqlWeakPass', 'm INSERT INTO `tb_pluginconfig` VALUES ('1298635551494246400', 'FTPWeakPass', '10', '中危', 'selfd', '3000', '\n# -*- coding:utf-8 -*-\nimport ftplib\n\n\ndef check(ip, port, args, timeout, payload_map):\n username_list = payload_map.get(\'username\')\n password_list = payload_map.get(\'password\')\n\n try:\n ftp = ftplib.FTP()\n ftp.timeout = int(timeout)\n for username in username_list:\n for password in password_list:\n try:\n ftp.connect(ip, int(port))\n ftp.login(username, password)\n if username == \'ftp\':\n result = \"FTP允许匿名访问\"\n else:\n result = \"用户名密码: \" + username + \":\" + password\n return result\n except ftplib.error_perm:\n pass\n ftp.quit()\n except Exception:\n raise\n', ''); INSERT INTO `tb_pluginconfig` VALUES ('1298635551737516032', 'NginxVerDetect', '', '低危', 'selfd', '3000', '\n# -*- coding:utf-8 -*-\n\n\ndef check(ip, port, args, timeout, payload_map):\n nginx_mainline_version = payload_map.get(\'Mainline version\')[0]\n nginx_stable_version = payload_map.get(\'Stable version\')[0]\n nginx_raw_version = payload_map.get(\'rawVersion\')[0]\n split_version = nginx_raw_version.split(\' \')\n if len(split_version) == 2:\n real_version = nginx_raw_version.split(\' \')[1]\n if real_version is not None:\n real_cp_mainline = compare_version(nginx_mainline_version, real_version)\n real_cp_stable = compare_version(nginx_stable_version, real_version)\n if real_cp_mainline == 0 or real_cp_stable == 0:\n return nginx_raw_version + \' is up to date\'\n else:\n # 小于主线版本\n if real_cp_mainline == 1:\n return nginx_raw_version + \' is out of date. \' + \'Mainline version: \' + nginx_mainline_version\n # 小于稳定版\n if real_cp_stable == 1:\n return nginx_raw_version + \' is out of date. \' + \'Stable version: \' + nginx_stable_version\n\n\n# 0相等,1左边大,-1右边大\n# version1----第一个要比较的版本字符串\n# version2----第二个要比较的版本字符串\n# split_flag----版本分隔符,默认为\".\",可自定义\n# 接受的版本字符形式----空/x/x.y/x.y./x.y.z;两个参数可为前边列出的形式的任一种\ndef compare_version(version1=None, version2=None, split_flag=\".\"):\n # 如果存在有为空的情况则进入\n if (version1 is None) or (version1 == \"\") or (version2 is None) or (version2 == \"\"):\n # version1为空且version2不为空,则返回version2大\n if ((version1 is None) or (version1 == \"\")) and (version2 is not None) and (version2 != \"\"):\n return -1\n # version2为空且version1不为空,则返回version1大\n if ((version2 is None) or (version2 == \"\")) and (version1 is not None) and (version1 != \"\"):\n return 1\n\n # 如果版本字符串相等,那么直接返回相等,这句会且只会在第一次比较时才可能进入\n # version1和version2都为空时也会进入这里\n if version1 == version2:\n return 0\n\n # 对版本字符串从左向右查找\".\",第一个\".\"之前的字符串即为此次要比较的版本\n # 如1.3.5中的1\n try:\n current_section_version1 = version1[:version1.index(split_flag)]\n except:\n current_section_version1 = version1\n try:\n current_section_version2 = version2[:version2.index(split_flag)]\n except:\n current_section_version2 = version2\n # 对本次要比较的版本字符转成整型进行比较\n if int(current_section_version1) > int(current_section_version2):\n return 1\n elif int(current_section_version1) < int(current_section_version2):\n return -1\n\n # 如果本次传来版本字符串中已没有版本号分隔符,那说明本次比较的版本号已是最后一位版本号,下次比较值赋空\n # 如本次传来的是5,那下次要比较的只能赋空\n try:\n other_section_version1 = version1[version1.index(split_flag) + 1:]\n except:\n other_section_version1 = \"\"\n try:\n other_section_version2 = version2[version2.index(split_flag) + 1:]\n except:\n other_section_version2 = \"\"\n\n # 递归调用比较\n return compare_version(other_section_version1, other_section_version2)\n', ''); INSERT INTO `tb_pluginconfig` VALUES ('1305054770993696768', 'HTTPElasticsearchUnauth', '', '高危', 'selfd', '0', '\n{\n \"protocol\":\"http\",\n \"method\":\"get\", \n \"url\":\"/_cat\"\n}\n', ''); -COMMIT; -- ---------------------------- -- Table structure for tb_project -- ---------------------------- DROP TABLE IF EXISTS `tb_project`; -CREATE TABLE `tb_project` ( +CREATE TABLE `tb_project` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '项目编号', `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '项目名称', - `description` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目描述', + `description` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目描述', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目,用于记录项目信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目,用于记录项目信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_project +-- ---------------------------- -- ---------------------------- -- Table structure for tb_projectinfo -- ---------------------------- DROP TABLE IF EXISTS `tb_projectinfo`; -CREATE TABLE `tb_projectinfo` ( +CREATE TABLE `tb_projectinfo` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `departmentid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '部门编号', - `projectname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目名称', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '检测白名单', - `notifywhitelist` tinyint(1) DEFAULT NULL COMMENT '提醒白名单', - `inserttime` datetime DEFAULT NULL COMMENT '插入时间', - `overrideipwhitelist` tinyint(1) DEFAULT NULL COMMENT '覆盖ip白名单,默认为false,如果为true,则会对项目下所有的ip进行白名单', + `departmentid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门编号', + `projectname` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '检测白名单', + `notifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '提醒白名单', + `inserttime` datetime(0) NULL DEFAULT NULL COMMENT '插入时间', + `overrideipwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '覆盖ip白名单,默认为false,如果为true,则会对项目下所有的ip进行白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目信息表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目信息表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_projectinfo +-- ---------------------------- -- ---------------------------- -- Table structure for tb_projectportwhitelist -- ---------------------------- DROP TABLE IF EXISTS `tb_projectportwhitelist`; -CREATE TABLE `tb_projectportwhitelist` ( +CREATE TABLE `tb_projectportwhitelist` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目信息编号', - `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '检测白名单', - `notifywhitelist` tinyint(1) DEFAULT NULL COMMENT '提醒白名单', + `projectinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目信息编号', + `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '检测白名单', + `notifywhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '提醒白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目端口白名单表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目端口白名单表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_projectportwhitelist +-- ---------------------------- -- ---------------------------- -- Table structure for tb_projectvulnnotify -- ---------------------------- DROP TABLE IF EXISTS `tb_projectvulnnotify`; -CREATE TABLE `tb_projectvulnnotify` ( +CREATE TABLE `tb_projectvulnnotify` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `risk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '风险等级', + `risk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '风险等级', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目组漏洞提醒'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目组漏洞提醒' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_projectvulnnotify -- ---------------------------- -BEGIN; INSERT INTO `tb_projectvulnnotify` VALUES ('1143092349392523271', '低危,中危,高危,严重,致命'); -COMMIT; -- ---------------------------- -- Table structure for tb_riskport -- ---------------------------- DROP TABLE IF EXISTS `tb_riskport`; -CREATE TABLE `tb_riskport` ( +CREATE TABLE `tb_riskport` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危端口', + `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危端口', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='高危端口表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '高危端口表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_riskport -- ---------------------------- -BEGIN; INSERT INTO `tb_riskport` VALUES ('1168817979845120001', '6379'); INSERT INTO `tb_riskport` VALUES ('1233467415178907648', '21'); INSERT INTO `tb_riskport` VALUES ('1233468251812532224', '22'); @@ -740,22 +773,20 @@ INSERT INTO `tb_riskport` VALUES ('1233468701420949504', '161'); INSERT INTO `tb_riskport` VALUES ('1233468746341945344', '162'); INSERT INTO `tb_riskport` VALUES ('1233468788243042304', '23'); INSERT INTO `tb_riskport` VALUES ('1233471409758539776', '5432'); -COMMIT; -- ---------------------------- -- Table structure for tb_riskservice -- ---------------------------- DROP TABLE IF EXISTS `tb_riskservice`; -CREATE TABLE `tb_riskservice` ( +CREATE TABLE `tb_riskservice` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `service` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危服务', + `service` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危服务', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='高危服务表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '高危服务表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_riskservice -- ---------------------------- -BEGIN; INSERT INTO `tb_riskservice` VALUES ('1168817979845120011', 'redis'); INSERT INTO `tb_riskservice` VALUES ('1233467447277916160', 'ftp'); INSERT INTO `tb_riskservice` VALUES ('1233468896120541184', 'ssh'); @@ -770,70 +801,64 @@ INSERT INTO `tb_riskservice` VALUES ('1233469905303638016', 'netbios-ssn'); INSERT INTO `tb_riskservice` VALUES ('1233470365368455168', 'memcached'); INSERT INTO `tb_riskservice` VALUES ('1233470924116856832', 'X11'); INSERT INTO `tb_riskservice` VALUES ('1233471342574178304', 'postgresql'); -COMMIT; -- ---------------------------- -- Table structure for tb_riskversion -- ---------------------------- DROP TABLE IF EXISTS `tb_riskversion`; -CREATE TABLE `tb_riskversion` ( +CREATE TABLE `tb_riskversion` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危版本', + `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危版本', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='高危版本表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '高危版本表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_riskversion -- ---------------------------- -BEGIN; INSERT INTO `tb_riskversion` VALUES ('1168817979845120021', 'Redis key-value store'); INSERT INTO `tb_riskversion` VALUES ('1168817979845120022', 'Redis key-value store 5.0'); INSERT INTO `tb_riskversion` VALUES ('1233470404446785536', 'Memcached'); -COMMIT; -- ---------------------------- -- Table structure for tb_sendmailconfig -- ---------------------------- DROP TABLE IF EXISTS `tb_sendmailconfig`; -CREATE TABLE `tb_sendmailconfig` ( +CREATE TABLE `tb_sendmailconfig` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `sendhost` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱host', - `sendpassword` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码', - `sendfrom` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '发件人', - `sendto` varchar(2018) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '提醒邮箱,强制提醒,不管是否在提醒白名单里,提醒包括所有资产和在收件人列表接收漏洞风险中的漏洞', - `sendtorisk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '收件人列表接收漏洞风险', - `vulnsubject` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞邮件主题', - `assetsubject` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资产邮件主题', - `vulncontent` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞邮件内容', - `assetcontent` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '资产邮件内容', - `excelauthor` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'excel作者', + `sendhost` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱host', + `sendpassword` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码', + `sendfrom` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '发件人', + `sendto` varchar(2018) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提醒邮箱,强制提醒,不管是否在提醒白名单里,提醒包括所有资产和在收件人列表接收漏洞风险中的漏洞', + `sendtorisk` varchar(35) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收件人列表接收漏洞风险', + `vulnsubject` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞邮件主题', + `assetsubject` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产邮件主题', + `vulncontent` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞邮件内容', + `assetcontent` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产邮件内容', + `excelauthor` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'excel作者', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='发邮件配置'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '发邮件配置' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_sendmailconfig -- ---------------------------- -BEGIN; INSERT INTO `tb_sendmailconfig` VALUES ('1143092349392523272', NULL, NULL, '', '', '低危,中危,高危,严重,致命', '【魔方】漏洞报告', '【魔方】资产报告', '您好,附件为漏洞报告', '您好,附件为资产报告', '信息安全部'); -COMMIT; -- ---------------------------- -- Table structure for tb_solution -- ---------------------------- DROP TABLE IF EXISTS `tb_solution`; -CREATE TABLE `tb_solution` ( +CREATE TABLE `tb_solution` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '修复方案编号', - `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞编号', - `solution` varchar(10240) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '修复方案', - `codedemo` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '修复代码示例', - `configdemo` varchar(10240) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '修复配置示例', + `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞编号', + `solution` varchar(10240) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修复方案', + `codedemo` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '修复代码示例', + `configdemo` varchar(10240) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '修复配置示例', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='修复方案,用于记录漏洞修复方案'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '修复方案,用于记录漏洞修复方案' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_solution -- ---------------------------- -BEGIN; INSERT INTO `tb_solution` VALUES ('1252508972364206080', '1252508972280320000', '默认信息修复方案', '默认信息修复代码示例', '默认信息修复配置示例'); INSERT INTO `tb_solution` VALUES ('1252508972527783936', '1252508972448092160', '默认低危修复方案', '默认低危修复代码示例', '默认低危修复配置示例'); INSERT INTO `tb_solution` VALUES ('1252508972641030144', '1252508972586504192', '默认中危修复方案', '默认中危修复代码示例', '默认中危修复配置示例'); @@ -852,76 +877,78 @@ INSERT INTO `tb_solution` VALUES ('1260513758808248320', '1260513758787276800', INSERT INTO `tb_solution` VALUES ('1260513758871162880', '1260513758854385664', '1.Oracle如果不需要外部访问,设置只对本地开放,2.对未设置密码的用户添加密码,3.权限最小化, 为不同的数据库用户赋予不同的权限,4.配置防火墙,只对业务ip开放Oracle访问权限', '', ''); INSERT INTO `tb_solution` VALUES ('1260513758942466048', '1260513758921494528', '1.PostgreSQL如果不需要外部访问,设置只对本地开放,2.对未设置密码的用户添加密码,3.权限最小化, 为不同的数据库用户赋予不同的权限,4.配置防火墙,只对业务ip开放PostgreSQL访问权限', '', ''); INSERT INTO `tb_solution` VALUES ('1260513759009574912', '1260513758992797696', '1.修改Samba密码,使密码符合公司密码复杂度要求,2.对未设置密码的用户添加密码,3.配置防火墙,只对业务ip开放Samba访问权限', '', ''); -COMMIT; -- ---------------------------- -- Table structure for tb_statistics -- ---------------------------- DROP TABLE IF EXISTS `tb_statistics`; -CREATE TABLE `tb_statistics` ( +CREATE TABLE `tb_statistics` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `ipcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ip数', - `ipcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未下线ip数', - `portcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口数', - `portcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未下线端口数', - `checkresultcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '检测结果数', - `checkresultcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复检测结果数', - `infocount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '信息检测结果数', - `lowcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '低危检测结果数', - `mediumcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '中危检测结果数', - `highcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危检测结果数', - `criticalcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '严重检测结果数', - `fatalcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '致命检测结果数', - `infocountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复信息检测结果数', - `lowcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复低危检测结果数', - `mediumcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复中危检测结果数', - `highcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复高危检测结果数', - `criticalcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复严重检测结果数', - `fatalcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未修复致命检测结果数', - `riskportcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危端口数', - `riskportcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未下线高危端口数', - `riskservicecount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危服务数', - `riskservicecountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未下线高危服务数', - `riskversioncount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '高危版本数', - `riskversioncountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '未下线高危版本数', - `updatetime` datetime DEFAULT NULL COMMENT '更新时间', + `ipcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ip数', + `ipcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未下线ip数', + `portcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口数', + `portcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未下线端口数', + `checkresultcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测结果数', + `checkresultcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复检测结果数', + `infocount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '信息检测结果数', + `lowcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '低危检测结果数', + `mediumcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '中危检测结果数', + `highcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危检测结果数', + `criticalcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '严重检测结果数', + `fatalcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '致命检测结果数', + `infocountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复信息检测结果数', + `lowcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复低危检测结果数', + `mediumcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复中危检测结果数', + `highcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复高危检测结果数', + `criticalcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复严重检测结果数', + `fatalcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未修复致命检测结果数', + `riskportcount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危端口数', + `riskportcountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未下线高危端口数', + `riskservicecount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危服务数', + `riskservicecountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未下线高危服务数', + `riskversioncount` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '高危版本数', + `riskversioncountonline` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '未下线高危版本数', + `updatetime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='统计数据'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '统计数据' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_statistics +-- ---------------------------- -- ---------------------------- -- Table structure for tb_task -- ---------------------------- DROP TABLE IF EXISTS `tb_task`; -CREATE TABLE `tb_task` ( +CREATE TABLE `tb_task` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务编号', - `taskparentid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务父编号', - `projectid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目编号', - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务名称', - `description` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务描述', - `cronexpression` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'cron表达式', - `crontask` tinyint(1) DEFAULT NULL COMMENT 'cron任务', - `starttime` datetime DEFAULT NULL COMMENT '任务开始时间', - `endtime` datetime DEFAULT NULL COMMENT '任务结束时间', - `worktype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务类型', - `checktype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '检测类型', - `threadnumber` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '线程数量', - `singleipscantime` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '1' COMMENT '单个ip扫描次数', - `additionoption` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务附加选项', - `rate` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '扫描速率', - `targetip` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '目标ip', - `targetport` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '目标端口', - `excludeip` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '排除ip', - `ipslicesize` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '255' COMMENT '分组大小', - `portslicesize` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口分组大小,nmap全端口模式时,如果该字段有值,则进行端口分组,分组大小范围:1000-10000', - `dbipisexcludeip` tinyint(1) DEFAULT NULL COMMENT 'db中ip作为排除ip', - `merge2asset` tinyint(1) DEFAULT NULL COMMENT '扫描结果合并到资产', + `taskparentid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务父编号', + `projectid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目编号', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务名称', + `description` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务描述', + `cronexpression` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'cron表达式', + `crontask` tinyint(1) NULL DEFAULT NULL COMMENT 'cron任务', + `starttime` datetime(0) NULL DEFAULT NULL COMMENT '任务开始时间', + `endtime` datetime(0) NULL DEFAULT NULL COMMENT '任务结束时间', + `worktype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务类型', + `checktype` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检测类型', + `threadnumber` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '线程数量', + `singleipscantime` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '单个ip扫描次数', + `additionoption` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务附加选项', + `rate` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '扫描速率', + `targetip` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '目标ip', + `targetport` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '目标端口', + `excludeip` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '排除ip', + `ipslicesize` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '255' COMMENT '分组大小', + `portslicesize` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口分组大小,nmap全端口模式时,如果该字段有值,则进行端口分组,分组大小范围:1000-10000', + `dbipisexcludeip` tinyint(1) NULL DEFAULT NULL COMMENT 'db中ip作为排除ip', + `merge2asset` tinyint(1) NULL DEFAULT NULL COMMENT '扫描结果合并到资产', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用于记录任务及配置信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用于记录任务及配置信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_task -- ---------------------------- -BEGIN; INSERT INTO `tb_task` VALUES ('1304326239309402112', NULL, NULL, 'nmap常规端口-demo', NULL, NULL, 0, NULL, NULL, 'nmap', NULL, '4', '1', '-Pn -n -sV --max-retries=1 --open', NULL, '127.0.0.1', 'regular', NULL, '255', NULL, 0, 1); INSERT INTO `tb_task` VALUES ('1304326543249641472', NULL, NULL, 'nmap所有端口-demo', NULL, NULL, 0, NULL, NULL, 'nmap', NULL, '4', '1', '-Pn -n -sV --max-retries=1 --open', NULL, '127.0.0.1', NULL, NULL, '255', '1000', 0, 1); INSERT INTO `tb_task` VALUES ('1304326778726256640', NULL, NULL, 'nmap指定端口-demo', NULL, NULL, 0, NULL, NULL, 'nmap', NULL, '4', '1', '-Pn -n -sV --max-retries=1 --open', NULL, '127.0.0.1', '80,443,6379', NULL, '255', NULL, 0, 1); @@ -932,140 +959,203 @@ INSERT INTO `tb_task` VALUES ('1304327185506635776', NULL, NULL, 'nse启用smb-v INSERT INTO `tb_task` VALUES ('1304327417707499520', NULL, NULL, 'selfd启用所有插件-demo', NULL, NULL, 0, NULL, NULL, 'selfd', NULL, '4', '1', '', NULL, 'assetip', NULL, NULL, NULL, NULL, 0, 1); INSERT INTO `tb_task` VALUES ('1304327508270911488', NULL, NULL, 'selfd启用JavaRedisWeakPass插件-demo', NULL, NULL, 0, NULL, NULL, 'selfd', NULL, '4', '1', '', NULL, 'assetip', NULL, NULL, NULL, NULL, 0, 1); INSERT INTO `tb_task` VALUES ('1304328077727371264', NULL, NULL, 'httpp任务-demo', NULL, NULL, 0, NULL, NULL, 'httpp', NULL, '4', '1', '', NULL, 'assetip', NULL, NULL, NULL, NULL, 0, 1); -COMMIT; -- ---------------------------- -- Table structure for tb_taskip -- ---------------------------- DROP TABLE IF EXISTS `tb_taskip`; -CREATE TABLE `tb_taskip` ( +CREATE TABLE `tb_taskip` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产ip编号', - `taskid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务编号', + `taskid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务编号', `ipaddressv4` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'ipv4地址', - `ipaddressv6` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'ipv6地址', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '安全检测白名单', + `ipaddressv6` varchar(39) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ipv6地址', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '安全检测白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='任务ip表,用于记录每次扫描任务的ip信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务ip表,用于记录每次扫描任务的ip信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_taskip +-- ---------------------------- +INSERT INTO `tb_taskip` VALUES ('1314483884750147584', '1304326543249641472', '127.0.0.1', NULL, 0); +INSERT INTO `tb_taskip` VALUES ('1314485012380389376', '1304327021228331008', '127.0.0.1', NULL, 0); +INSERT INTO `tb_taskip` VALUES ('1314485455953203200', '1314485452954275840', '127.0.0.1', NULL, 0); -- ---------------------------- -- Table structure for tb_taskpluginconfig -- ---------------------------- DROP TABLE IF EXISTS `tb_taskpluginconfig`; -CREATE TABLE `tb_taskpluginconfig` ( +CREATE TABLE `tb_taskpluginconfig` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', `taskid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务编号', - `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件编号', + `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='任务插件,nse/selfd任务,或nse/selfd任务启用的插件'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务插件,nse/selfd任务,或nse/selfd任务启用的插件' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_taskpluginconfig +-- ---------------------------- +INSERT INTO `tb_taskpluginconfig` VALUES ('1314486172193525760', '1304327185506635776', '1298634979529592832'); +INSERT INTO `tb_taskpluginconfig` VALUES ('1314486238509666304', '1304327508270911488', '1298634973577875456'); -- ---------------------------- -- Table structure for tb_taskport -- ---------------------------- DROP TABLE IF EXISTS `tb_taskport`; -CREATE TABLE `tb_taskport` ( +CREATE TABLE `tb_taskport` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '端口编号', - `taskipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '任务ip编号', + `taskipid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务ip编号', `port` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '端口', - `protocol` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口协议', - `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口开放状态', - `service` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口服务', - `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '服务版本', - `checkwhitelist` tinyint(1) DEFAULT NULL COMMENT '安全检测白名单', + `protocol` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口协议', + `state` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口开放状态', + `service` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口服务', + `version` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '服务版本', + `checkwhitelist` tinyint(1) NULL DEFAULT NULL COMMENT '安全检测白名单', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='任务端口表,用于记录每次扫描任务的端口信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务端口表,用于记录每次扫描任务的端口信息' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_taskport +-- ---------------------------- +INSERT INTO `tb_taskport` VALUES ('1314483885274435584', '1314483884750147584', '3306', 'tcp', 'open', 'mysql', 'MySQL 8.0.21', 0); +INSERT INTO `tb_taskport` VALUES ('1314483909760782336', '1314483884750147584', '22', 'tcp', 'open', 'ssh', 'OpenSSH 7.4 (protocol 2.0)', 0); +INSERT INTO `tb_taskport` VALUES ('1314483909790142464', '1314483884750147584', '25', 'tcp', 'open', 'smtp', 'Postfix smtpd', 0); +INSERT INTO `tb_taskport` VALUES ('1314483909827891200', '1314483884750147584', '80', 'tcp', 'open', 'http', 'nginx 1.19.3', 0); +INSERT INTO `tb_taskport` VALUES ('1314483911727910912', '1314483884750147584', '4369', 'tcp', 'open', 'epmd', 'Erlang Port Mapper Daemon', 0); +INSERT INTO `tb_taskport` VALUES ('1314483928450600960', '1314483884750147584', '5672', 'tcp', 'open', 'amqp', 'RabbitMQ 3.8.9 (0-9)', 0); +INSERT INTO `tb_taskport` VALUES ('1314483928479961088', '1314483884750147584', '5671', 'tcp', 'open', 'tcpwrapped', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314483953985523712', '1314483884750147584', '6379', 'tcp', 'open', 'redis', 'Redis key-value store', 0); +INSERT INTO `tb_taskport` VALUES ('1314483960394420224', '1314483884750147584', '8686', 'tcp', 'open', 'sun-as-jmxrmi?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314483960914513920', '1314483884750147584', '9001', 'tcp', 'open', 'tor-orport?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314483961065508864', '1314483884750147584', '9991', 'tcp', 'open', 'issa?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314483979763716096', '1314483884750147584', '15672', 'tcp', 'open', 'http', 'Cowboy httpd', 0); +INSERT INTO `tb_taskport` VALUES ('1314483979839213568', '1314483884750147584', '15671', 'tcp', 'open', 'tcpwrapped', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314485012434915328', '1314485012380389376', '913', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012451692544', '1314485012380389376', '903', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012468469760', '1314485012380389376', '49667', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012522995712', '1314485012380389376', '808', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012548161536', '1314485012380389376', '10001', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012569133056', '1314485012380389376', '445', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012590104576', '1314485012380389376', '443', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012615270400', '1314485012380389376', '49669', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012632047616', '1314485012380389376', '49665', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012648824832', '1314485012380389376', '49670', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012669796352', '1314485012380389376', '4000', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012682379264', '1314485012380389376', '135', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012703350784', '1314485012380389376', '5040', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012724322304', '1314485012380389376', '49664', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012745293824', '1314485012380389376', '7680', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012774653952', '1314485012380389376', '28317', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012795625472', '1314485012380389376', '2968', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012816596992', '1314485012380389376', '10000', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012833374208', '1314485012380389376', '49666', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012850151424', '1314485012380389376', '54530', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012866928640', '1314485012380389376', '49668', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012883705856', '1314485012380389376', '1362', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485012900483072', '1314485012380389376', '8307', 'tcp', 'open', NULL, NULL, 0); +INSERT INTO `tb_taskport` VALUES ('1314485456074838016', '1314485455953203200', '3306', 'tcp', 'open', 'mysql', 'MySQL 8.0.21', 0); +INSERT INTO `tb_taskport` VALUES ('1314485480770899968', '1314485455953203200', '22', 'tcp', 'open', 'ssh', 'OpenSSH 7.4 (protocol 2.0)', 0); +INSERT INTO `tb_taskport` VALUES ('1314485480796065792', '1314485455953203200', '25', 'tcp', 'open', 'smtp', 'Postfix smtpd', 0); +INSERT INTO `tb_taskport` VALUES ('1314485480821231616', '1314485455953203200', '80', 'tcp', 'open', 'http', 'nginx 1.19.3', 0); +INSERT INTO `tb_taskport` VALUES ('1314485482398289920', '1314485455953203200', '4369', 'tcp', 'open', 'epmd', 'Erlang Port Mapper Daemon', 0); +INSERT INTO `tb_taskport` VALUES ('1314485499087425536', '1314485455953203200', '5672', 'tcp', 'open', 'amqp', 'RabbitMQ 3.8.9 (0-9)', 0); +INSERT INTO `tb_taskport` VALUES ('1314485499112591360', '1314485455953203200', '5671', 'tcp', 'open', 'tcpwrapped', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314485525029195776', '1314485455953203200', '6379', 'tcp', 'open', 'redis', 'Redis key-value store', 0); +INSERT INTO `tb_taskport` VALUES ('1314485530448236544', '1314485455953203200', '8686', 'tcp', 'open', 'sun-as-jmxrmi?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314485530842501120', '1314485455953203200', '9001', 'tcp', 'open', 'tor-orport?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314485530892832768', '1314485455953203200', '9991', 'tcp', 'open', 'issa?', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314485549981110272', '1314485455953203200', '15672', 'tcp', 'open', 'http', 'Cowboy httpd', 0); +INSERT INTO `tb_taskport` VALUES ('1314485550006276096', '1314485455953203200', '15671', 'tcp', 'open', 'tcpwrapped', 'null', 0); +INSERT INTO `tb_taskport` VALUES ('1314486096687665152', '1314485455953203200', '25672', 'tcp', 'open', 'unknown', 'null', 0); -- ---------------------------- -- Table structure for tb_titlewhitelist -- ---------------------------- DROP TABLE IF EXISTS `tb_titlewhitelist`; -CREATE TABLE `tb_titlewhitelist` ( +CREATE TABLE `tb_titlewhitelist` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数编号', - `title` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '标题', + `title` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='标题白名单'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标题白名单' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_titlewhitelist -- ---------------------------- -BEGIN; INSERT INTO `tb_titlewhitelist` VALUES ('1164432912121204766', 'Welcome to nginx'); INSERT INTO `tb_titlewhitelist` VALUES ('1164432912121204767', 'Apache Tomcat'); -COMMIT; -- ---------------------------- -- Table structure for tb_url -- ---------------------------- DROP TABLE IF EXISTS `tb_url`; -CREATE TABLE `tb_url` ( +CREATE TABLE `tb_url` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'url编号', - `webinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'web信息编号', - `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '名称', - `url` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT 'url', + `webinfoid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'web信息编号', + `name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '名称', + `url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'url', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='当前页面所有url及url名称'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '当前页面所有url及url名称' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_url +-- ---------------------------- -- ---------------------------- -- Table structure for tb_user -- ---------------------------- DROP TABLE IF EXISTS `tb_user`; -CREATE TABLE `tb_user` ( +CREATE TABLE `tb_user` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户编号', - `username` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '用户名', - `password` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '密码', - `admin` tinyint(1) DEFAULT NULL COMMENT '是否管理员', - `active` tinyint(1) DEFAULT NULL COMMENT '是否有效', - `avatar` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '头像地址', - `lastdate` datetime DEFAULT NULL COMMENT '最后登录时间', + `username` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名', + `password` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码', + `admin` tinyint(1) NULL DEFAULT NULL COMMENT '是否管理员', + `active` tinyint(1) NULL DEFAULT NULL COMMENT '是否有效', + `avatar` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址', + `lastdate` datetime(0) NULL DEFAULT NULL COMMENT '最后登录时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_user -- ---------------------------- -BEGIN; -INSERT INTO `tb_user` VALUES ('1259704243355521024', 'MagiCude', '$2a$10$7wmPIhsnZS3/I1xrQQOtvep9J/GVt2ofofkF4365cAxoFP8E5Zjd6', 1, 1, '/favicon.ico', '2020-09-13 16:32:27'); -COMMIT; +INSERT INTO `tb_user` VALUES ('1259704243355521024', 'MagiCude', '$2a$10$7wmPIhsnZS3/I1xrQQOtvep9J/GVt2ofofkF4365cAxoFP8E5Zjd6', 1, 1, '/favicon.ico', '2020-10-09 20:32:27'); -- ---------------------------- -- Table structure for tb_useragent -- ---------------------------- DROP TABLE IF EXISTS `tb_useragent`; -CREATE TABLE `tb_useragent` ( +CREATE TABLE `tb_useragent` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `useragent` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'useragent', + `useragent` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'useragent', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='useragent'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'useragent' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_useragent -- ---------------------------- -BEGIN; INSERT INTO `tb_useragent` VALUES ('1168817980281327616', 'Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36'); INSERT INTO `tb_useragent` VALUES ('1168817980558151680', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50'); INSERT INTO `tb_useragent` VALUES ('1168817981279571968', 'Opera/9.80 (Windows NT 6.1; U; zh-cn) Presto/2.9.168 Version/11.50'); INSERT INTO `tb_useragent` VALUES ('1168817981397012480', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0'); INSERT INTO `tb_useragent` VALUES ('1168817981434761216', 'Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10'); -COMMIT; -- ---------------------------- -- Table structure for tb_vuln -- ---------------------------- DROP TABLE IF EXISTS `tb_vuln`; -CREATE TABLE `tb_vuln` ( +CREATE TABLE `tb_vuln` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞编号', - `categorysecondid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞二级分类编号', - `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞名称', - `description` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞描述', - `risk` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞风险级别', - `refer` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '参考', - `impactscope` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '影响范围', + `categorysecondid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞二级分类编号', + `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞名称', + `description` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞描述', + `risk` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞风险级别', + `refer` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '参考', + `impactscope` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '影响范围', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞,用于记录漏洞信息'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞,用于记录漏洞信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_vuln -- ---------------------------- -BEGIN; INSERT INTO `tb_vuln` VALUES ('1252508972280320000', '1252508922875613184', '默认信息', '默认信息描述', '信息', '默认信息参考', '默认信息影响范围'); INSERT INTO `tb_vuln` VALUES ('1252508972448092160', '1252508922875613184', '默认低危', '默认低危描述', '低危', '默认低危参考', '默认低危影响范围'); INSERT INTO `tb_vuln` VALUES ('1252508972586504192', '1252508922875613184', '默认中危', '默认中危描述', '中危', '默认中危参考', '默认中危影响范围'); @@ -1084,23 +1174,21 @@ INSERT INTO `tb_vuln` VALUES ('1260513758787276800', '1252508921818648576', 'MS INSERT INTO `tb_vuln` VALUES ('1260513758854385664', '1252508921818648576', 'Oracle弱密码/未授权访问', 'Oracle存在未设置密码的用户或存在弱密码的用户,攻击者可以获取数据库数据,即平常所说的拖库', '严重', '', '所有Oracle版本'); INSERT INTO `tb_vuln` VALUES ('1260513758921494528', '1252508921818648576', 'PostgreSQL弱密码/未授权访问', 'PostgreSQL存在未设置密码的用户或存在弱密码的用户,攻击者可以获取数据库数据,即平常所说的拖库', '严重', '', '所有PostgreSQL版本'); INSERT INTO `tb_vuln` VALUES ('1260513758992797696', '1252508921818648576', 'Samba弱密码/未授权访问', 'Samba未设置访问权限或存在弱密码的用户,攻击者可以获取共享的数据;如果用户能够远程登录,则服务器沦陷', '致命', '', '所有Samba版本'); -COMMIT; -- ---------------------------- -- Table structure for tb_vulnkeyword -- ---------------------------- DROP TABLE IF EXISTS `tb_vulnkeyword`; -CREATE TABLE `tb_vulnkeyword` ( +CREATE TABLE `tb_vulnkeyword` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '漏洞关键字编号', - `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件配置编号', - `keyword` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞关键字', + `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件配置编号', + `keyword` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞关键字', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞关键字,用于记录漏洞关键字'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞关键字,用于记录漏洞关键字' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_vulnkeyword -- ---------------------------- -BEGIN; INSERT INTO `tb_vulnkeyword` VALUES ('1298634974383181824', '1298634973577875456', 'redis_version'); INSERT INTO `tb_vulnkeyword` VALUES ('1298634974878109696', '1298634973577875456', 'Server'); INSERT INTO `tb_vulnkeyword` VALUES ('1298634975117185024', '1298634973577875456', 'Clients'); @@ -1143,23 +1231,21 @@ INSERT INTO `tb_vulnkeyword` VALUES ('1298635551225810944', '1298635551074816000 INSERT INTO `tb_vulnkeyword` VALUES ('1298635551645241344', '1298635551494246400', 'FTPWeakPass'); INSERT INTO `tb_vulnkeyword` VALUES ('1298635551796236288', '1298635551737516032', 'out'); INSERT INTO `tb_vulnkeyword` VALUES ('1305054772423954432', '1305054770993696768', '/_cat/count'); -COMMIT; -- ---------------------------- -- Table structure for tb_vulnpluginconfig -- ---------------------------- DROP TABLE IF EXISTS `tb_vulnpluginconfig`; -CREATE TABLE `tb_vulnpluginconfig` ( +CREATE TABLE `tb_vulnpluginconfig` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '编号', - `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '漏洞编号', - `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '插件配置编号', + `vulnid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '漏洞编号', + `pluginconfigid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '插件配置编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='漏洞对应的插件配置表,用于检测漏洞的插件'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '漏洞对应的插件配置表,用于检测漏洞的插件' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of tb_vulnpluginconfig -- ---------------------------- -BEGIN; INSERT INTO `tb_vulnpluginconfig` VALUES ('1298634974685171712', '1260513758078439424', '1298634973577875456'); INSERT INTO `tb_vulnpluginconfig` VALUES ('1298634975880548352', '1260513758166519808', '1298634975670833152'); INSERT INTO `tb_vulnpluginconfig` VALUES ('1298634976237064192', '1260513758560784384', '1298634976069292032'); @@ -1189,27 +1275,30 @@ INSERT INTO `tb_vulnpluginconfig` VALUES ('1298635551301308416', '12605137586530 INSERT INTO `tb_vulnpluginconfig` VALUES ('1298635551695572992', '1260513758237822976', '1298635551494246400'); INSERT INTO `tb_vulnpluginconfig` VALUES ('1298635551825596416', '1260513758720167936', '1298635551737516032'); INSERT INTO `tb_vulnpluginconfig` VALUES ('1305054772977602560', '1252508972666195968', '1305054770993696768'); -COMMIT; -- ---------------------------- -- Table structure for tb_webinfo -- ---------------------------- DROP TABLE IF EXISTS `tb_webinfo`; -CREATE TABLE `tb_webinfo` ( +CREATE TABLE `tb_webinfo` ( `id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'web信息编号', - `portid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '端口编号', - `titlewhitelistid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '标题白名单编号', - `title` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '页面标题', - `bodychildrenstextcontent` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT 'body子节点文本内容', - `server` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '响应头中的服务', - `xpoweredby` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'xpoweredby', - `setcookie` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '设置cookie', - `wwwauthenticate` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '认证方式', - `appname` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '应用名称', - `appversion` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '应用版本', - `devlanguage` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '开发语言', - `crawltime` datetime DEFAULT NULL COMMENT '页面抓取时间', + `portid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '端口编号', + `titlewhitelistid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题白名单编号', + `title` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '页面标题', + `bodychildrenstextcontent` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT 'body子节点文本内容', + `server` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '响应头中的服务', + `xpoweredby` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'xpoweredby', + `setcookie` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '设置cookie', + `wwwauthenticate` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '认证方式', + `appname` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用名称', + `appversion` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用版本', + `devlanguage` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开发语言', + `crawltime` datetime(0) NULL DEFAULT NULL COMMENT '页面抓取时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='网站信息表'; +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '网站信息表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of tb_webinfo +-- ---------------------------- SET FOREIGN_KEY_CHECKS = 1; diff --git a/deploy/defaultConf/runAgent.sh b/deploy/defaultConf/runAgent.sh old mode 100755 new mode 100644 index 024ad5a..aea958d --- a/deploy/defaultConf/runAgent.sh +++ b/deploy/defaultConf/runAgent.sh @@ -2,15 +2,16 @@ # 启动agent # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh tempPid=`ps -ef|grep agentapp|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then - echo "agentapp已在运行,PID:$tempPid" - echo "请执行 stopAgent.sh 后重试" + logErrorNotExit "agentapp已在运行,PID:$tempPid" + logError "请执行 stopAgent.sh 后重试" exit 1 fi -echo "**********启动agentapp.jar**********" +logInfo "启动agentapp.jar" nohup java -jar agentapp.jar --spring.config.location=agent.yml > /dev/null 2>&1 & sleep 5s -echo "********** ps -ef|grep agentapp|grep -v grep 查看运行状态**********" -ps -ef|grep agentapp|grep -v grep \ No newline at end of file +logInfo "状态:`ps -ef|grep agentapp|grep -v grep`" +logInfo "完成" \ No newline at end of file diff --git a/deploy/defaultConf/stopAgent.sh b/deploy/defaultConf/stopAgent.sh old mode 100755 new mode 100644 index 5dc654b..9552c8d --- a/deploy/defaultConf/stopAgent.sh +++ b/deploy/defaultConf/stopAgent.sh @@ -2,11 +2,12 @@ # 停止agent # @author 贰拾壹 # https://github.com/er10yi +source /root/MagiCude/util.sh -echo "**********停止agentapp.jar**********" +logInfo "停止agentapp.jar" # kill agentapp tempPid=`ps -ef|grep agentapp|grep -v grep|cut -c 9-15` if [ $tempPid ] ;then kill -9 $tempPid fi -echo "done." \ No newline at end of file +logInfo "完成" \ No newline at end of file diff --git a/deploy/defaultConf/util.sh b/deploy/defaultConf/util.sh new file mode 100644 index 0000000..589ba27 --- /dev/null +++ b/deploy/defaultConf/util.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# 日志输出和临时环境变量 +# source /root/.bash_profile下次登录才生效 +# 如果第一次部署,一直不重连ssh,脚本执行完java和python3的命令就用不了 + +pythonVersionArrays=("3.9.0" "3.8.5") +openjdkVersion="15" +openjdkDirName="jdk-15" +openjdk="openjdk-15_linux-x64_bin.tar.gz" +nmapUrl="https://nmap.org/dist/nmap-7.90-1.x86_64.rpm" + +export JAVA_HOME=/root/MagiCude/$openjdkDirName +export JRE_HOME=$JAVA_HOME/jre +export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH +export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH +export LD_LIBRARY_PATH=/usr/local/python3/lib + +function logInfo(){ + echo -e "*****info*****\t $1" +} + +function logError(){ + echo -e "!!!!!error!!!!!\t $1" + exit 1 +} + +function logErrorNotExit(){ + echo -e "!!!!!error!!!!!\t $1" +} \ No newline at end of file diff --git "a/\344\275\277\347\224\250\350\257\264\346\230\216.md" "b/\344\275\277\347\224\250\350\257\264\346\230\216.md" index 1b9fab4..97e5505 100755 --- "a/\344\275\277\347\224\250\350\257\264\346\230\216.md" +++ "b/\344\275\277\347\224\250\350\257\264\346\230\216.md" @@ -23,7 +23,7 @@ by [贰拾壹](https://github.com/er10yi ) 3. VUE(前端模板基于https://github.com/PanJiaChen/vue-admin-template),其实有很大的改动 4. 图表统计基于echarts 5. JDK 15 -6. python3.8 +6. python3.9 | 功能 | 详情 | | ------------------ | ------------------------------------------------------------ | @@ -215,12 +215,12 @@ systemctl restart docker 1. agent服务器的root目录下新建```MagiCude```目录,将以下文件上传到```MagiCude```目录 ```shell -agentDependency 修改后的agent.yml agentapp.jar initAgentEnvironmentAndStart.sh runAgent.sh stopAgent.sh +util.sh ``` 2. 然后执行初始化agent环境并启动agent