2 lines
7.5 KiB
JavaScript
2 lines
7.5 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c0c86"],{"42f8":function(t,e,s){"use strict";s.r(e);var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"backend-content",attrs:{id:"content"}},[e("div",{staticClass:"column col-8 col-xs-12"},[e("h3",{staticClass:"s-title"},[t._v("Manage IOCs")]),e("ul",{staticClass:"tab tab-block"},[e("li",{staticClass:"tab-item"},[e("a",{class:{active:t.tabs.bulk},attrs:{href:"#"},on:{click:function(e){return t.switch_tab("bulk")}}},[t._v("Bulk import")])]),e("li",{staticClass:"tab-item"},[e("a",{class:{active:t.tabs.file},attrs:{href:"#"},on:{click:function(e){return t.switch_tab("file")}}},[t._v("File import")])]),e("li",{staticClass:"tab-item"},[e("a",{class:{active:t.tabs.export},attrs:{href:"#"},on:{click:function(e){return t.switch_tab("export")}}},[t._v("Export IOCs")])])]),t.tabs.export?e("div",[e("iframe",{staticClass:"frame-export",attrs:{src:t.export_url}})]):t._e(),t.tabs.file?e("div",[e("label",{staticClass:"form-upload empty",attrs:{for:"upload"}},[e("input",{staticClass:"upload-field",attrs:{type:"file",id:"upload"},on:{change:t.import_from_file}}),e("p",{staticClass:"empty-title h5"},[t._v("Drop or select a file to import.")]),e("p",{staticClass:"empty-subtitle"},[t._v("The file needs to be an export from a SpyGuard instance.")])])]):t._e(),t.tabs.bulk?e("div",[e("div",{staticClass:"columns"},[e("div",{staticClass:"column col-4 col-xs-4"},[e("div",{staticClass:"form-group"},[e("select",{directives:[{name:"model",rawName:"v-model",value:t.tag,expression:"tag"}],staticClass:"form-select",on:{change:function(e){var s=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.tag=e.target.multiple?s:s[0]}}},[e("option",{attrs:{value:""}},[t._v("IOC(s) Tag")]),t._l(t.tags,(function(s){return e("option",{key:s,domProps:{value:s}},[t._v(" "+t._s(s.toUpperCase())+" ")])}))],2)])]),e("div",{staticClass:"column col-4 col-xs-4"},[e("div",{staticClass:"form-group"},[e("select",{directives:[{name:"model",rawName:"v-model",value:t.type,expression:"type"}],staticClass:"form-select width-full",on:{change:function(e){var s=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.type=e.target.multiple?s:s[0]}}},[e("option",{attrs:{value:""}},[t._v("IOC(s) Type")]),e("option",{attrs:{value:"unknown"}},[t._v("Multiple (regex parsing)")]),t._l(t.types,(function(s){return e("option",{key:s.type,domProps:{value:s.type}},[t._v(" "+t._s(s.name)+" ")])}))],2)])]),e("div",{staticClass:"column col-4 col-xs-4"},[e("div",{staticClass:"form-group"},[e("select",{directives:[{name:"model",rawName:"v-model",value:t.tlp,expression:"tlp"}],staticClass:"form-select width-full",on:{change:function(e){var s=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.tlp=e.target.multiple?s:s[0]}}},[e("option",{attrs:{value:""}},[t._v("IOC(s) TLP")]),e("option",{attrs:{value:"white"}},[t._v("TLP:WHITE")]),e("option",{attrs:{value:"green"}},[t._v("TLP:GREEN")]),e("option",{attrs:{value:"amber"}},[t._v("TLP:AMBER")]),e("option",{attrs:{value:"red"}},[t._v("TLP:RED")])])])])]),e("div",{staticClass:"form-group"},[e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.iocs,expression:"iocs"}],staticClass:"form-input",attrs:{id:"input-example-3",placeholder:"Paste your Indicators of Compromise here",rows:"15"},domProps:{value:t.iocs},on:{input:function(e){e.target.composing||(t.iocs=e.target.value)}}})]),e("div",{staticClass:"form-group"},[e("button",{staticClass:"btn-primary btn col-12",on:{click:function(e){return t.import_from_bulk()}}},[t._v("Import the IOCs")])])]):t._e(),t.imported.length>0?e("div",{staticClass:"form-group"},[e("div",{staticClass:"toast toast-success"},[t._v(" ✓ "+t._s(t.imported.length)+" IOC"),t.errors.length>1?e("span",[t._v("s")]):t._e(),t._v(" imported successfully. ")])]):t._e(),t.errors.length>0?e("div",[e("div",{staticClass:"form-group"},[e("div",{staticClass:"toast toast-error"},[t._v(" ✗ "+t._s(t.errors.length)+" IOC"),t.errors.length>1?e("span",[t._v("s")]):t._e(),t._v(" not imported, see details below. ")])]),e("div",{staticClass:"form-group"},[e("table",{staticClass:"table table-striped table-hover"},[t._m(0),e("tbody",t._l(t.errors,(function(s){return e("tr",{key:s.ioc},[e("td",[t._v(t._s(s.ioc))]),e("td",[t._v(t._s(s.message))])])})),0)])])]):1==t.type_tag_error?e("div",[t._m(1),t._m(2)]):t._e()])])},i=[function(){var t=this,e=t._self._c;return e("thead",[e("tr",[e("th",[t._v("Indicator")]),e("th",[t._v("Importation error")])])])},function(){var t=this,e=t._self._c;return e("div",{staticClass:"form-group"},[e("div",{staticClass:"toast toast-error"},[t._v(" ✗ IOC(s) not imported, see details below. ")])])},function(){var t=this,e=t._self._c;return e("div",{staticClass:"form-group"},[e("div",{staticClass:"empty"},[e("p",{staticClass:"empty-title h5"},[t._v("Please select a tag and a type.")]),e("p",{staticClass:"empty-subtitle"},[t._v('If different IOCs types, select "Unknown (regex parsing)".')])])])}],o=(s("14d9"),s("bc3a")),r=s.n(o),l={name:"manageiocs",data(){return{type:"",tag:"",tlp:"",iocs:"",types:[],tags:[],errors:[],imported:[],type_tag_error:!1,wrong_ioc_file:!1,tabs:{bulk:!0,file:!1,export:!1},jwt:"",export_url:"",config:{},watcher:""}},props:{},methods:{import_from_bulk:function(){this.errors=[],this.imported=[],""!=this.tag&&""!=this.type&&""!=this.tlp?(this.iocs.match(/[^\r\n]+/g).forEach(t=>{this.import_ioc(this.tag,this.type,this.tlp,t)}),this.iocs=""):this.type_tag_error=!0},import_ioc:function(t,e,s,a){""!=a&&"#"!=a.slice(0,1)&&("alert "!=a.slice(0,6)&&(a=a.trim(),a=a.replace(" ",""),a=a.replace("[",""),a=a.replace("]",""),a=a.replace("\\",""),a=a.replace("(",""),a=a.replace(")","")),r.a.get(`/api/ioc/add/${e.trim()}/${t.trim()}/${s.trim()}/${a}`,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.status?this.imported.push(t.data):t.data.message&&this.errors.push(t.data)}).catch(t=>console.log(t)))},delete_watcher:function(t){var e=this.config.watchers.indexOf(t);this.config.watchers.splice(e,1)},add_watcher:function(){this.config.watchers.push(this.watcher),this.watcher=""},enrich_selects:function(){r.a.get("/api/ioc/get/tags",{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.tags&&(this.tags=t.data.tags)}).catch(t=>console.log(t)),r.a.get("/api/ioc/get/types",{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.types&&(this.types=t.data.types)}).catch(t=>console.log(t))},switch_tab:function(t){this.errors=[],this.imported=[],Object.keys(this.tabs).forEach(e=>{this.tabs[e]=e==t})},import_from_file:function(t){this.errors=[],this.imported=[];const e=t.target.files[0],s=new FileReader;s.onload=t=>this.$emit("load",t.target.result),s.onload=()=>{try{JSON.parse(s.result).iocs.forEach(t=>{this.import_ioc(t["tag"],t["type"],t["tlp"],t["value"])})}catch(t){this.wrong_ioc_file=!0}},s.readAsText(e)},async get_jwt(){await r.a.get("/api/get-token",{timeout:1e4}).then(t=>{t.data.token&&(this.jwt=t.data.token)}).catch(t=>console.log(t))},load_config:function(){r.a.get("/api/config/list",{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data&&(this.config=t.data)}).catch(t=>console.log(t))}},created:function(){this.get_jwt().then(()=>{this.enrich_selects(),this.load_config(),this.export_url="/api/ioc/export?token="+this.jwt})}},c=l,n=s("2877"),p=Object(n["a"])(c,a,i,!1,null,null,null);e["default"]=p.exports}}]);
|
|
//# sourceMappingURL=chunk-2d0c0c86.cf098d4b.js.map
|