1 line
25 KiB
Plaintext
1 line
25 KiB
Plaintext
{"version":3,"sources":["webpack:///./src/views/iocs-manage.vue","webpack:///src/views/iocs-manage.vue","webpack:///./src/views/iocs-manage.vue?bd2c","webpack:///./src/views/iocs-manage.vue?d419"],"names":["render","_vm","this","_c","_self","staticClass","attrs","_v","class","active","tabs","bulk","on","$event","switch_tab","file","export","export_url","_e","import_from_file","directives","name","rawName","value","tag","expression","$$selectedVal","Array","prototype","filter","call","target","options","o","selected","map","val","_value","multiple","_l","tags","t","key","domProps","_s","toUpperCase","type","types","tlp","iocs","composing","import_from_bulk","imported","length","errors","_m","e","ioc","message","type_tag_error","staticRenderFns","data","wrong_ioc_file","jwt","config","watcher","props","methods","import_ioc","axios","timeout","headers","then","catch","delete_watcher","add_watcher","enrich_selects","Object","reader","JSON","load_config","created","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,kBAAkBC,MAAM,CAAC,GAAK,YAAY,CAACH,EAAG,MAAM,CAACE,YAAY,0BAA0B,CAACF,EAAG,KAAK,CAACE,YAAY,WAAW,CAACJ,EAAIM,GAAG,iBAAiBJ,EAAG,KAAK,CAACE,YAAY,iBAAiB,CAACF,EAAG,KAAK,CAACE,YAAY,YAAY,CAACF,EAAG,IAAI,CAACK,MAAM,CAAEC,OAAQR,EAAIS,KAAKC,MAAOL,MAAM,CAAC,KAAO,KAAKM,GAAG,CAAC,MAAQ,SAASC,GAAQ,OAAOZ,EAAIa,WAAW,WAAW,CAACb,EAAIM,GAAG,mBAAmBJ,EAAG,KAAK,CAACE,YAAY,YAAY,CAACF,EAAG,IAAI,CAACK,MAAM,CAAEC,OAAQR,EAAIS,KAAKK,MAAOT,MAAM,CAAC,KAAO,KAAKM,GAAG,CAAC,MAAQ,SAASC,GAAQ,OAAOZ,EAAIa,WAAW,WAAW,CAACb,EAAIM,GAAG,mBAAmBJ,EA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MAIa,aAAAsB,E","file":"js/chunk-2d0c0c86.cf098d4b.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"backend-content\",attrs:{\"id\":\"content\"}},[_c('div',{staticClass:\"column col-8 col-xs-12\"},[_c('h3',{staticClass:\"s-title\"},[_vm._v(\"Manage IOCs\")]),_c('ul',{staticClass:\"tab tab-block\"},[_c('li',{staticClass:\"tab-item\"},[_c('a',{class:{ active: _vm.tabs.bulk },attrs:{\"href\":\"#\"},on:{\"click\":function($event){return _vm.switch_tab('bulk')}}},[_vm._v(\"Bulk import\")])]),_c('li',{staticClass:\"tab-item\"},[_c('a',{class:{ active: _vm.tabs.file },attrs:{\"href\":\"#\"},on:{\"click\":function($event){return _vm.switch_tab('file')}}},[_vm._v(\"File import\")])]),_c('li',{staticClass:\"tab-item\"},[_c('a',{class:{ active: _vm.tabs.export },attrs:{\"href\":\"#\"},on:{\"click\":function($event){return _vm.switch_tab('export')}}},[_vm._v(\"Export IOCs\")])])]),(_vm.tabs.export)?_c('div',[_c('iframe',{staticClass:\"frame-export\",attrs:{\"src\":_vm.export_url}})]):_vm._e(),(_vm.tabs.file)?_c('div',[_c('label',{staticClass:\"form-upload empty\",attrs:{\"for\":\"upload\"}},[_c('input',{staticClass:\"upload-field\",attrs:{\"type\":\"file\",\"id\":\"upload\"},on:{\"change\":_vm.import_from_file}}),_c('p',{staticClass:\"empty-title h5\"},[_vm._v(\"Drop or select a file to import.\")]),_c('p',{staticClass:\"empty-subtitle\"},[_vm._v(\"The file needs to be an export from a SpyGuard instance.\")])])]):_vm._e(),(_vm.tabs.bulk)?_c('div',[_c('div',{staticClass:\"columns\"},[_c('div',{staticClass:\"column col-4 col-xs-4\"},[_c('div',{staticClass:\"form-group\"},[_c('select',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.tag),expression:\"tag\"}],staticClass:\"form-select\",on:{\"change\":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = \"_value\" in o ? o._value : o.value;return val}); _vm.tag=$event.target.multiple ? $$selectedVal : $$selectedVal[0]}}},[_c('option',{attrs:{\"value\":\"\"}},[_vm._v(\"IOC(s) Tag\")]),_vm._l((_vm.tags),function(t){return _c('option',{key:t,domProps:{\"value\":t}},[_vm._v(\" \"+_vm._s(t.toUpperCase())+\" \")])})],2)])]),_c('div',{staticClass:\"column col-4 col-xs-4\"},[_c('div',{staticClass:\"form-group\"},[_c('select',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.type),expression:\"type\"}],staticClass:\"form-select width-full\",on:{\"change\":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = \"_value\" in o ? o._value : o.value;return val}); _vm.type=$event.target.multiple ? $$selectedVal : $$selectedVal[0]}}},[_c('option',{attrs:{\"value\":\"\"}},[_vm._v(\"IOC(s) Type\")]),_c('option',{attrs:{\"value\":\"unknown\"}},[_vm._v(\"Multiple (regex parsing)\")]),_vm._l((_vm.types),function(t){return _c('option',{key:t.type,domProps:{\"value\":t.type}},[_vm._v(\" \"+_vm._s(t.name)+\" \")])})],2)])]),_c('div',{staticClass:\"column col-4 col-xs-4\"},[_c('div',{staticClass:\"form-group\"},[_c('select',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.tlp),expression:\"tlp\"}],staticClass:\"form-select width-full\",on:{\"change\":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = \"_value\" in o ? o._value : o.value;return val}); _vm.tlp=$event.target.multiple ? $$selectedVal : $$selectedVal[0]}}},[_c('option',{attrs:{\"value\":\"\"}},[_vm._v(\"IOC(s) TLP\")]),_c('option',{attrs:{\"value\":\"white\"}},[_vm._v(\"TLP:WHITE\")]),_c('option',{attrs:{\"value\":\"green\"}},[_vm._v(\"TLP:GREEN\")]),_c('option',{attrs:{\"value\":\"amber\"}},[_vm._v(\"TLP:AMBER\")]),_c('option',{attrs:{\"value\":\"red\"}},[_vm._v(\"TLP:RED\")])])])])]),_c('div',{staticClass:\"form-group\"},[_c('textarea',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.iocs),expression:\"iocs\"}],staticClass:\"form-input\",attrs:{\"id\":\"input-example-3\",\"placeholder\":\"Paste your Indicators of Compromise here\",\"rows\":\"15\"},domProps:{\"value\":(_vm.iocs)},on:{\"input\":function($event){if($event.target.composing)return;_vm.iocs=$event.target.value}}})]),_c('div',{staticClass:\"form-group\"},[_c('button',{staticClass:\"btn-primary btn col-12\",on:{\"click\":function($event){return _vm.import_from_bulk()}}},[_vm._v(\"Import the IOCs\")])])]):_vm._e(),(_vm.imported.length>0)?_c('div',{staticClass:\"form-group\"},[_c('div',{staticClass:\"toast toast-success\"},[_vm._v(\" ✓ \"+_vm._s(_vm.imported.length)+\" IOC\"),(_vm.errors.length>1)?_c('span',[_vm._v(\"s\")]):_vm._e(),_vm._v(\" imported successfully. \")])]):_vm._e(),(_vm.errors.length>0)?_c('div',[_c('div',{staticClass:\"form-group\"},[_c('div',{staticClass:\"toast toast-error\"},[_vm._v(\" ✗ \"+_vm._s(_vm.errors.length)+\" IOC\"),(_vm.errors.length>1)?_c('span',[_vm._v(\"s\")]):_vm._e(),_vm._v(\" not imported, see details below. \")])]),_c('div',{staticClass:\"form-group\"},[_c('table',{staticClass:\"table table-striped table-hover\"},[_vm._m(0),_c('tbody',_vm._l((_vm.errors),function(e){return _c('tr',{key:e.ioc},[_c('td',[_vm._v(_vm._s(e.ioc))]),_c('td',[_vm._v(_vm._s(e.message))])])}),0)])])]):(_vm.type_tag_error==true)?_c('div',[_vm._m(1),_vm._m(2)]):_vm._e()])])\n}\nvar staticRenderFns = [function (){var _vm=this,_c=_vm._self._c;return _c('thead',[_c('tr',[_c('th',[_vm._v(\"Indicator\")]),_c('th',[_vm._v(\"Importation error\")])])])\n},function (){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"form-group\"},[_c('div',{staticClass:\"toast toast-error\"},[_vm._v(\" ✗ IOC(s) not imported, see details below. \")])])\n},function (){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"form-group\"},[_c('div',{staticClass:\"empty\"},[_c('p',{staticClass:\"empty-title h5\"},[_vm._v(\"Please select a tag and a type.\")]),_c('p',{staticClass:\"empty-subtitle\"},[_vm._v(\"If different IOCs types, select \\\"Unknown (regex parsing)\\\".\")])])])\n}]\n\nexport { render, staticRenderFns }","<template>\r\n <div class=\"backend-content\" id=\"content\">\r\n <div class=\"column col-8 col-xs-12\">\r\n <h3 class=\"s-title\">Manage IOCs</h3>\r\n <ul class=\"tab tab-block\">\r\n <li class=\"tab-item\">\r\n <a href=\"#\" v-on:click=\"switch_tab('bulk')\" v-bind:class=\"{ active: tabs.bulk }\">Bulk import</a>\r\n </li>\r\n <li class=\"tab-item\">\r\n <a href=\"#\" v-on:click=\"switch_tab('file')\" v-bind:class=\"{ active: tabs.file }\">File import</a>\r\n </li>\r\n <li class=\"tab-item\">\r\n <a href=\"#\" v-on:click=\"switch_tab('export')\" v-bind:class=\"{ active: tabs.export }\">Export IOCs</a>\r\n </li>\r\n </ul>\r\n <div v-if=\"tabs.export\">\r\n <iframe :src=\"export_url\" class=\"frame-export\"></iframe>\r\n </div>\r\n <div v-if=\"tabs.file\">\r\n <label class=\"form-upload empty\" for=\"upload\">\r\n <input type=\"file\" class=\"upload-field\" id=\"upload\" @change=\"import_from_file\">\r\n <p class=\"empty-title h5\">Drop or select a file to import.</p>\r\n <p class=\"empty-subtitle\">The file needs to be an export from a SpyGuard instance.</p>\r\n </label>\r\n </div>\r\n <div v-if=\"tabs.bulk\">\r\n <div class=\"columns\">\r\n <div class=\"column col-4 col-xs-4\">\r\n <div class=\"form-group\">\r\n <select class=\"form-select\" v-model=\"tag\">\r\n <option value=\"\">IOC(s) Tag</option>\r\n <option v-for=\"t in tags\" :value=\"t\" :key=\"t\">\r\n {{ t.toUpperCase() }}\r\n </option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"column col-4 col-xs-4\">\r\n <div class=\"form-group\">\r\n <select class=\"form-select width-full\" v-model=\"type\">\r\n <option value=\"\">IOC(s) Type</option>\r\n <option value=\"unknown\">Multiple (regex parsing)</option>\r\n <option v-for=\"t in types\" :value=\"t.type\" :key=\"t.type\">\r\n {{ t.name }}\r\n </option>\r\n </select>\r\n </div>\r\n </div>\r\n <div class=\"column col-4 col-xs-4\">\r\n <div class=\"form-group\">\r\n <select class=\"form-select width-full\" v-model=\"tlp\">\r\n <option value=\"\">IOC(s) TLP</option>\r\n <option value=\"white\">TLP:WHITE</option>\r\n <option value=\"green\">TLP:GREEN</option>\r\n <option value=\"amber\">TLP:AMBER</option>\r\n <option value=\"red\">TLP:RED</option>\r\n </select>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"form-group\">\r\n <textarea class=\"form-input\" id=\"input-example-3\" placeholder=\"Paste your Indicators of Compromise here\" rows=\"15\" v-model=\"iocs\"></textarea>\r\n </div>\r\n <div class=\"form-group\">\r\n <button class=\"btn-primary btn col-12\" v-on:click=\"import_from_bulk()\">Import the IOCs</button>\r\n </div>\r\n </div>\r\n <div class=\"form-group\" v-if=\"imported.length>0\">\r\n <div class=\"toast toast-success\">\r\n ✓ {{imported.length}} IOC<span v-if=\"errors.length>1\">s</span> imported successfully.\r\n </div>\r\n </div>\r\n <div v-if=\"errors.length>0\">\r\n <div class=\"form-group\">\r\n <div class=\"toast toast-error\">\r\n ✗ {{errors.length}} IOC<span v-if=\"errors.length>1\">s</span> not imported, see details below.\r\n </div>\r\n </div>\r\n <div class=\"form-group\">\r\n <table class=\"table table-striped table-hover\">\r\n <thead>\r\n <tr>\r\n <th>Indicator</th>\r\n <th>Importation error</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr v-for=\"e in errors\" v-bind:key=\"e.ioc\">\r\n <td>{{ e.ioc }}</td>\r\n <td>{{ e.message }}</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <div v-else-if=\"type_tag_error==true\">\r\n <div class=\"form-group\">\r\n <div class=\"toast toast-error\">\r\n ✗ IOC(s) not imported, see details below.\r\n </div>\r\n </div>\r\n <div class=\"form-group\">\r\n <div class=\"empty\">\r\n <p class=\"empty-title h5\">Please select a tag and a type.</p>\r\n <p class=\"empty-subtitle\">If different IOCs types, select \"Unknown (regex parsing)\".</p>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport axios from 'axios'\r\n\r\nexport default {\r\n name: 'manageiocs', \r\n data() {\r\n return { \r\n type:\"\",\r\n tag:\"\",\r\n tlp:\"\",\r\n iocs:\"\",\r\n types:[],\r\n tags:[],\r\n errors:[],\r\n imported:[],\r\n type_tag_error: false,\r\n wrong_ioc_file: false,\r\n tabs: { \"bulk\" : true, \"file\" : false, \"export\" : false },\r\n jwt:\"\",\r\n export_url:\"\",\r\n config: {},\r\n watcher: \"\"\r\n }\r\n },\r\n props: { },\r\n methods: {\r\n import_from_bulk: function() {\r\n this.errors = []\r\n this.imported = []\r\n if (this.tag != \"\" && this.type != \"\" && this.tlp != \"\"){\r\n this.iocs.match(/[^\\r\\n]+/g).forEach(ioc => {\r\n this.import_ioc(this.tag, this.type, this.tlp, ioc);\r\n });\r\n this.iocs = \"\";\r\n } else {\r\n this.type_tag_error = true\r\n }\r\n },\r\n import_ioc: function(tag, type, tlp, ioc) {\r\n if (ioc != \"\" && ioc.slice(0,1) != \"#\"){\r\n if(\"alert \" != ioc.slice(0,6)) {\r\n ioc = ioc.trim()\r\n ioc = ioc.replace(\" \", \"\")\r\n ioc = ioc.replace(\"[\", \"\")\r\n ioc = ioc.replace(\"]\", \"\")\r\n ioc = ioc.replace(\"\\\\\", \"\")\r\n ioc = ioc.replace(\"(\", \"\")\r\n ioc = ioc.replace(\")\", \"\")\r\n }\r\n axios.get(`/api/ioc/add/${type.trim()}/${tag.trim()}/${tlp.trim()}/${ioc}`, { timeout: 10000, headers: {'X-Token': this.jwt} })\r\n .then(response => {\r\n if(response.data.status){\r\n this.imported.push(response.data);\r\n } else if (response.data.message){\r\n this.errors.push(response.data);\r\n }\r\n })\r\n .catch(err => (console.log(err)))\r\n }\r\n },\r\n delete_watcher: function(watcher) {\r\n var i = this.config.watchers.indexOf(watcher);\r\n this.config.watchers.splice(i, 1);\r\n },\r\n add_watcher: function() {\r\n this.config.watchers.push(this.watcher);\r\n this.watcher = \"\";\r\n },\r\n enrich_selects: function() {\r\n axios.get(`/api/ioc/get/tags`, { timeout: 10000, headers: {'X-Token': this.jwt} })\r\n .then(response => {\r\n if(response.data.tags) this.tags = response.data.tags\r\n })\r\n .catch(err => (console.log(err)));\r\n axios.get(`/api/ioc/get/types`, { timeout: 10000, headers: {'X-Token': this.jwt} })\r\n .then(response => {\r\n if(response.data.types) this.types = response.data.types\r\n })\r\n .catch(err => (console.log(err)));\r\n },\r\n switch_tab: function(tab) {\r\n this.errors = []\r\n this.imported = []\r\n\r\n Object.keys(this.tabs).forEach(key => {\r\n if( key == tab ){\r\n this.tabs[key] = true\r\n } else {\r\n this.tabs[key] = false\r\n }\r\n });\r\n },\r\n import_from_file: function(ev) {\r\n this.errors = []\r\n this.imported = []\r\n \r\n const file = ev.target.files[0];\r\n const reader = new FileReader();\r\n\r\n reader.onload = e => this.$emit(\"load\", e.target.result);\r\n reader.onload = () => {\r\n try {\r\n JSON.parse(reader.result).iocs.forEach(ioc => {\r\n this.import_ioc(ioc[\"tag\"], ioc[\"type\"], ioc[\"tlp\"], ioc[\"value\"])\r\n })\r\n } catch (error) {\r\n this.wrong_ioc_file = true\r\n }\r\n\r\n } \r\n reader.readAsText(file);\r\n },\r\n async get_jwt(){\r\n await axios.get(`/api/get-token`, { timeout: 10000 })\r\n .then(response => {\r\n if(response.data.token){\r\n this.jwt = response.data.token\r\n }\r\n })\r\n .catch(err => (console.log(err)))\r\n },\r\n load_config: function() {\r\n axios.get(`/api/config/list`, {\r\n timeout: 10000,\r\n headers: { 'X-Token': this.jwt }\r\n }).then(response => {\r\n if (response.data) {\r\n this.config = response.data\r\n }\r\n })\r\n .catch(err => (console.log(err)))\r\n }\r\n },\r\n created: function() {\r\n this.get_jwt().then(() => {\r\n this.enrich_selects(); \r\n this.load_config();\r\n this.export_url = `/api/ioc/export?token=${this.jwt}`\r\n });\r\n }\r\n}\r\n</script>","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./iocs-manage.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./iocs-manage.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./iocs-manage.vue?vue&type=template&id=55155ced&\"\nimport script from \"./iocs-manage.vue?vue&type=script&lang=js&\"\nexport * from \"./iocs-manage.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""} |