First commit!

This commit is contained in:
sda
2022-11-06 15:51:33 +01:00
parent 283cf9630f
commit 64daa44e9f
225 changed files with 94329 additions and 1 deletions
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 805 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

+1
View File
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>@felixaime/spyguard-backend</title><link href="/js/chunk-2d0a3726.bebe5116.js" rel="prefetch"><link href="/js/chunk-2d0c0c86.cf098d4b.js" rel="prefetch"><link href="/js/chunk-2d0c8321.78ca1407.js" rel="prefetch"><link href="/js/chunk-2d0c9378.fb16a6a2.js" rel="prefetch"><link href="/js/chunk-2d0cc2b4.6cd43049.js" rel="prefetch"><link href="/js/chunk-2d0cfa15.4b2166d6.js" rel="prefetch"><link href="/js/chunk-2d0e4bf5.fac73388.js" rel="prefetch"><link href="/js/chunk-2d20faf8.c983e105.js" rel="prefetch"><link href="/js/chunk-2d215cd3.f0d8ba06.js" rel="prefetch"><link href="/js/chunk-2d2245cf.ea4d33bd.js" rel="prefetch"><link href="/js/chunk-2d22d432.91ebbe55.js" rel="prefetch"><link href="/js/chunk-3c0d118e.e3f2944c.js" rel="prefetch"><link href="/css/app.b563f628.css" rel="preload" as="style"><link href="/js/app.a3c6f292.js" rel="preload" as="script"><link href="/js/chunk-vendors.dbaccf43.js" rel="preload" as="script"><link href="/css/app.b563f628.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but @felixaime/spyguard-backend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.dbaccf43.js"></script><script src="/js/app.a3c6f292.js"></script></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0a3726"],{"01e4":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e._self._c;return t("div",{staticClass:"backend-content",attrs:{id:"content"}},[t("div",{staticClass:"column col-8 col-xs-12"},[t("br"),t("p",[t("strong",[e._v("A new SpyGuard version is available ("+e._s(e.next_version)+").")]),t("br"),e.update_launched?e._e():t("span",[e._v("Please click on the button below to update your instance.")]),e.update_launched&&!e.update_finished?t("span",[e._v("Updating SpyGuard, please wait. You'll be redirected once updated.")]):e._e(),e.update_launched&&e.update_finished?t("span",{staticClass:"color-green"},[e._v("✓ Update finished!")]):e._e()]),e.update_finished?e._e():t("button",{staticClass:"btn btn-primary",class:[e.update_launched?"loading":""],on:{click:function(t){return e.launch_update()}}},[e._v("Update Spyguard")])])])},s=[],i=n("bc3a"),o=n.n(i),c={name:"update",data(){return{translation:{},update_launched:null,check_interval:null,next_version:null,current_version:null,update_finished:!1,jwt:""}},methods:{check_version:function(){o.a.get("/api/update/get-version",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&e.data.current_version==this.next_version&&(window.current_version=e.data.current_version,this.update_finished=!0,clearInterval(this.check_interval),setTimeout((function(){window.location.href="/"}),3e3))}).catch(e=>{console.log(e)})},launch_update:function(){o.a.get("/api/update/process",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&"Update successfully launched"==e.data.message&&(this.update_launched=!0,this.check_interval=setInterval(function(){this.check_version()}.bind(this),3e3))}).catch(e=>{console.log(e)})},async get_jwt(){await o.a.get("/api/get-token",{timeout:1e4}).then(e=>{e.data.token&&(this.jwt=e.data.token)}).catch(e=>console.log(e))},get_versions:function(){o.a.get("/api/update/check",{timeout:6e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&(this.current_version=e.data.current_version,this.next_version=e.data.next_version,this.current_version==this.next_version&&(window.location.href="/"))}).catch(e=>{console.log(e)})}},created:function(){this.get_jwt().then(()=>{this.get_versions()})}},u=c,r=n("2877"),d=Object(r["a"])(u,a,s,!1,null,null,null);t["default"]=d.exports}}]);
//# sourceMappingURL=chunk-2d0a3726.bebe5116.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0cc2b4"],{"4d7e":function(t,s,e){"use strict";e.r(s);var a=function(){var t=this,s=t._self._c;return s("div",{staticClass:"backend-content",attrs:{id:"content"}},[s("div",{staticClass:"column col-12 col-xs-12"},[s("h3",{staticClass:"s-title"},[t._v("Search IOCs")]),s("div",{staticClass:"form-group"},[s("textarea",{directives:[{name:"model",rawName:"v-model",value:t.iocs,expression:"iocs"}],staticClass:"form-input",attrs:{id:"input-example-3",placeholder:"Paste your IOCs here",rows:"3"},domProps:{value:t.iocs},on:{input:function(s){s.target.composing||(t.iocs=s.target.value)}}})]),s("div",{staticClass:"form-group"},[s("button",{staticClass:"btn btn-primary col-12",on:{click:function(s){return t.search_iocs()}}},[t._v("Search")])]),t.results.length>0?s("div",{staticClass:"form-group"},[s("table",{staticClass:"table table-striped table-hover"},[t._m(0),s("tbody",t._l(t.results,(function(e){return s("tr",{key:e.tlp},[s("td",[t._v(t._s(e.value))]),s("td",{staticClass:"upper"},[t._v(t._s(e.tag))]),s("td",[s("label",{class:["tlp-"+e.tlp]},[t._v(t._s(e.tlp))])]),s("td",{staticClass:"capi"},[t._v(t._s(e.source))]),s("td",[s("button",{staticClass:"btn btn-sm",on:{click:function(s){return t.remove(e)}}},[t._v("Delete")])])])})),0)])]):0==t.first_search?s("div",[t.loading?s("div",[t._m(1)]):s("div",[s("div",{staticClass:"empty"},[s("p",{staticClass:"empty-title h5"},[t._v("IOC"),this.iocs.match(/[^\r\n]+/g).length>1?s("span",[t._v("s")]):t._e(),t._v(" not found.")]),s("p",{staticClass:"empty-subtitle"},[t._v("Try wildcard search to expend your search.")])])])]):t._e()])])},i=[function(){var t=this,s=t._self._c;return s("thead",[s("tr",[s("th",[t._v("Indicator")]),s("th",[t._v("Tag")]),s("th",[t._v("TLP")]),s("th",[t._v("Source")]),s("th",[t._v("Action")])])])},function(){var t=this,s=t._self._c;return s("div",{staticClass:"empty"},[s("p",{staticClass:"empty-title h5"},[s("span",{staticClass:"loading loading-lg"})]),s("p",{staticClass:"empty-subtitle"},[t._v("Finding your IOC(s)...")])])}],c=e("bc3a"),o=e.n(c),n={name:"iocs-search",data(){return{results:[],first_search:!0,jwt:"",loading:!1}},props:{},methods:{search_iocs:function(){return this.results=[],this.first_search=!1,this.loading=!0,this.iocs.match(/[^\r\n]+/g).forEach(t=>{t=t.trim(),"alert "!=t.slice(0,6)&&(t=t.replace(" ",""),t=t.replace("[",""),t=t.replace("]",""),t=t.replace("\\",""),t=t.replace("(",""),t=t.replace(")","")),o.a.get("/api/ioc/search/"+t,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.results.length>0&&(this.results=[].concat(this.results,t.data.results)),this.loading=!1}).catch(t=>console.log(t))}),!0},remove:function(t){o.a.get("/api/ioc/delete/"+t.id,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(s=>{s.data.status&&(this.results=this.results.filter((function(s){return s!=t})))}).catch(t=>console.log(t))},load_config:function(){o.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))},async get_jwt(){await o.a.get("/api/get-token",{timeout:1e4}).then(t=>{t.data.token&&(this.jwt=t.data.token)}).catch(t=>console.log(t))}},created:function(){this.get_jwt()}},l=n,r=e("2877"),u=Object(r["a"])(l,a,i,!1,null,null,null);s["default"]=u.exports}}]);
//# sourceMappingURL=chunk-2d0cc2b4.6cd43049.js.map
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0cfa15"],{6511:function(t,s,e){"use strict";e.r(s);var a=function(){var t=this;t._self._c;return t._m(0)},i=[function(){var t=this,s=t._self._c;return s("div",{staticClass:"backend-content",attrs:{id:"content"}},[s("div",{staticClass:"column col-8 col-xs-12"},[s("div",{staticClass:"container"},[s("h3",{staticClass:"s-title"},[t._v("Getting started")]),s("br"),s("p",[t._v("SpyGuard is a forked and enhanced version of TinyCheck, an application developed by Kaspersky. SpyGuard's main objective is to detect signs of compromise by monitoring network flows transmitted by a device.")]),s("p",[t._v("As it uses WiFi, SpyGuard can be used against a wide range of devices, such as smartphones, laptops, IOTs or workstations. To do its job, the analysis engine of SpyGuard is using Indicators of Compromise (IOCs), anomaly detection and is supported by Suricata. ")]),s("p",[t._v("This backend lets you configure your SpyGuard instance. You can push some IOCs for detection and whitelist elements which can be seen during legit communications in order to prevent false positives.")]),s("p",[t._v("_")])]),s("div",{staticClass:"backend-footer container grid-lg",attrs:{id:"copyright"}},[s("p",[t._v("For any question, bug report or feedback, please contact the "),s("a",{attrs:{href:"mailto:spyguard@protonmail.com",target:"_blank"}},[t._v("SpyGuard's Team")]),t._v(" or open an issue on the "),s("a",{attrs:{href:"https://github.com/SpyGuard/spyguard/issues",target:"_blank"}},[t._v("SpyGuard Github repository")]),t._v(".")])])])])}],n=e("2877"),o={},r=Object(n["a"])(o,a,i,!1,null,null,null);s["default"]=r.exports}}]);
//# sourceMappingURL=chunk-2d0cfa15.4b2166d6.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["webpack:///./src/views/home.vue","webpack:///./src/views/home.vue?46ae"],"names":["render","_vm","this","_self","_c","_m","staticRenderFns","staticClass","attrs","_v","script","component"],"mappings":"uHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAQD,EAAIE,MAAMC,GAAG,OAAOH,EAAII,GAAG,IAEtEC,EAAkB,CAAC,WAAY,IAAIL,EAAIC,KAAKE,EAAGH,EAAIE,MAAMC,GAAG,OAAOA,EAAG,MAAM,CAACG,YAAY,kBAAkBC,MAAM,CAAC,GAAK,YAAY,CAACJ,EAAG,MAAM,CAACG,YAAY,0BAA0B,CAACH,EAAG,MAAM,CAACG,YAAY,aAAa,CAACH,EAAG,KAAK,CAACG,YAAY,WAAW,CAACN,EAAIQ,GAAG,qBAAqBL,EAAG,MAAMA,EAAG,IAAI,CAACH,EAAIQ,GAAG,oNAAoNL,EAAG,IAAI,CAACH,EAAIQ,GAAG,0QAA0QL,EAAG,IAAI,CAACH,EAAIQ,GAAG,4MAA4ML,EAAG,IAAI,CAACH,EAAIQ,GAAG,SAASL,EAAG,MAAM,CAACG,YAAY,mCAAmCC,MAAM,CAAC,GAAK,cAAc,CAACJ,EAAG,IAAI,CAACH,EAAIQ,GAAG,iEAAiEL,EAAG,IAAI,CAACI,MAAM,CAAC,KAAO,iCAAiC,OAAS,WAAW,CAACP,EAAIQ,GAAG,qBAAqBR,EAAIQ,GAAG,6BAA6BL,EAAG,IAAI,CAACI,MAAM,CAAC,KAAO,8CAA8C,OAAS,WAAW,CAACP,EAAIQ,GAAG,gCAAgCR,EAAIQ,GAAG,e,YCDr8CC,EAAS,GAKTC,EAAY,eACdD,EACAV,EACAM,GACA,EACA,KACA,KACA,MAIa,aAAAK,E","file":"js/chunk-2d0cfa15.4b2166d6.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _vm._m(0)\n}\nvar staticRenderFns = [function (){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('div',{staticClass:\"container\"},[_c('h3',{staticClass:\"s-title\"},[_vm._v(\"Getting started\")]),_c('br'),_c('p',[_vm._v(\"SpyGuard is a forked and enhanced version of TinyCheck, an application developed by Kaspersky. SpyGuard's main objective is to detect signs of compromise by monitoring network flows transmitted by a device.\")]),_c('p',[_vm._v(\"As it uses WiFi, SpyGuard can be used against a wide range of devices, such as smartphones, laptops, IOTs or workstations. To do its job, the analysis engine of SpyGuard is using Indicators of Compromise (IOCs), anomaly detection and is supported by Suricata. \")]),_c('p',[_vm._v(\"This backend lets you configure your SpyGuard instance. You can push some IOCs for detection and whitelist elements which can be seen during legit communications in order to prevent false positives.\")]),_c('p',[_vm._v(\"_\")])]),_c('div',{staticClass:\"backend-footer container grid-lg\",attrs:{\"id\":\"copyright\"}},[_c('p',[_vm._v(\"For any question, bug report or feedback, please contact the \"),_c('a',{attrs:{\"href\":\"mailto:spyguard@protonmail.com\",\"target\":\"_blank\"}},[_vm._v(\"SpyGuard's Team\")]),_vm._v(\" or open an issue on the \"),_c('a',{attrs:{\"href\":\"https://github.com/SpyGuard/spyguard/issues\",\"target\":\"_blank\"}},[_vm._v(\"SpyGuard Github repository\")]),_vm._v(\".\")])])])])\n}]\n\nexport { render, staticRenderFns }","import { render, staticRenderFns } from \"./home.vue?vue&type=template&id=34abb80e&\"\nvar script = {}\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":""}
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e4bf5"],{9217:function(t,a,e){"use strict";e.r(a);var s=function(){var t=this,a=t._self._c;return a("div",{staticClass:"backend-content",attrs:{id:"content"}},[a("div",{staticClass:"column col-8 col-xs-12"},[a("h3",{staticClass:"s-title"},[t._v("Manage database")]),a("ul",{staticClass:"tab tab-block"},[a("li",{staticClass:"tab-item"},[a("a",{class:{active:t.tabs.import},attrs:{href:"#"},on:{click:function(a){return t.switch_tab("import")}}},[t._v("Import database")])]),a("li",{staticClass:"tab-item"},[a("a",{class:{active:t.tabs.export},attrs:{href:"#"},on:{click:function(a){return t.switch_tab("export")}}},[t._v("Export database")])])]),t.tabs.export?a("div",[a("iframe",{staticClass:"frame-export",attrs:{src:t.export_url}})]):t._e(),t.tabs.import?a("div",[a("label",{staticClass:"form-upload empty",attrs:{for:"upload"}},[a("input",{staticClass:"upload-field",attrs:{type:"file",id:"upload"},on:{change:t.import_from_file}}),a("p",{staticClass:"empty-title h5"},[t._v("Drop or select a database to import.")]),a("p",{staticClass:"empty-subtitle"},[t._v("The database needs to be an export from a SpyGuard instance.")])])]):t._e()])])},i=[],o=e("bc3a"),r=e.n(o),n={name:"db-manage",data(){return{tabs:{import:!0,export:!1},jwt:""}},props:{},methods:{switch_tab:function(t){Object.keys(this.tabs).forEach(a=>{this.tabs[a]=a==t})},import_from_file:function(t){var a=new FormData;a.append("file",t.target.files[0]),r.a.post("/api/config/db/import",a,{headers:{"Content-Type":"multipart/form-data","X-Token":this.jwt}})},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))}},created:function(){this.get_jwt().then(()=>{this.export_url="/api/config/db/export?token="+this.jwt})}},c=n,l=e("2877"),p=Object(l["a"])(c,s,i,!1,null,null,null);a["default"]=p.exports}}]);
//# sourceMappingURL=chunk-2d0e4bf5.fac73388.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d2245cf"],{e08f: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-12 col-xs-12"},[e("h3",{staticClass:"s-title"},[t._v("Search whitelisted elements")]),e("div",{staticClass:"form-group"},[e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.elements,expression:"elements"}],staticClass:"form-input",attrs:{id:"input-example-3",placeholder:"Paste the elements here",rows:"3"},domProps:{value:t.elements},on:{input:function(e){e.target.composing||(t.elements=e.target.value)}}})]),e("div",{staticClass:"form-group"},[e("button",{staticClass:"btn btn-primary col-12",on:{click:function(e){return t.search_elements()}}},[t._v("Search")])]),t.results.length>0?e("div",{staticClass:"form-group"},[e("table",{staticClass:"table table-striped table-hover"},[t._m(0),e("tbody",t._l(t.results,(function(s){return e("tr",{key:s.element},[e("td",[t._v(t._s(s.element))]),e("td",[t._v(t._s(s.type))]),e("td",[e("button",{staticClass:"btn btn-sm",on:{click:function(e){return t.remove(s)}}},[t._v("Delete")])])])})),0)])]):0==t.first_search?e("div",[e("div",{staticClass:"empty"},[e("p",{staticClass:"empty-title h5"},[t._v("Element"),this.elements.match(/[^\r\n]+/g).length>1?e("span",[t._v("s")]):t._e(),t._v(" not found.")]),e("p",{staticClass:"empty-subtitle"},[t._v("Try wildcard search to expend your search.")])])]):t._e()])])},n=[function(){var t=this,e=t._self._c;return e("thead",[e("tr",[e("th",[t._v("Element")]),e("th",[t._v("Element type")]),e("th")])])}],l=s("bc3a"),r=s.n(l),i={name:"elements-search",data(){return{results:[],first_search:!0,jwt:""}},props:{},methods:{search_elements:function(){return this.results=[],this.first_search=!1,this.elements.match(/[^\r\n]+/g).forEach(t=>{r.a.get("/api/whitelist/search/"+t.trim(),{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.results.length>0&&(this.results=[].concat(this.results,t.data.results))}).catch(t=>console.log(t))}),!0},remove:function(t){r.a.get("/api/whitelist/delete/"+t.id,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(e=>{e.data.status&&(this.results=this.results.filter((function(e){return e!=t})))}).catch(t=>console.log(t))},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))}},created:function(){this.get_jwt()}},c=i,o=s("2877"),h=Object(o["a"])(c,a,n,!1,null,null,null);e["default"]=h.exports}}]);
//# sourceMappingURL=chunk-2d2245cf.ea4d33bd.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
View File
@@ -0,0 +1,2 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3c0d118e"],{"42e0":function(t,e,s){t.exports=s.p+"img/network.33d31f9d.png"},"7e11":function(t,e,s){"use strict";s.r(e);var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"backend-content",attrs:{id:"content"}},[e("div",{class:{"alert-toaster-visible":t.toaster.show,"alert-toaster-hidden":!t.toaster.show}},[t._v(t._s(t.toaster.message))]),e("div",{staticClass:"column col-8 col-xs-12"},[e("h3",{staticClass:"s-title"},[t._v("Network configuration")]),e("h5",{staticClass:"s-subtitle"},[t._v("Interfaces configuration")]),e("img",{attrs:{src:s("42e0"),id:"network-thumbnail"}}),e("div",{staticClass:"container interfaces-container"},[e("div",{staticClass:"columns"},[e("div",{staticClass:"column col-6"},[e("span",{staticClass:"interface-label"},[t._v("Wireless AP interface")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.iface_in,expression:"iface_in"}],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.iface_in=e.target.multiple?s:s[0]},function(e){return t.change_interface("in",t.iface_in)}]}},t._l(t.config.ifaces_in,(function(s){return e("option",{key:s,domProps:{value:s}},[t._v(" "+t._s(s.toUpperCase())+" ")])})),0)]),e("div",{staticClass:"column col-6"},[e("span",{staticClass:"interface-label"},[t._v("Internet link interface")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.iface_out,expression:"iface_out"}],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.iface_out=e.target.multiple?s:s[0]},function(e){return t.change_interface("out",t.iface_out)}]}},t._l(t.config.ifaces_out,(function(s){return e("option",{key:s,domProps:{value:s}},[t._v(" "+t._s(s.toUpperCase())+" ")])})),0)])])]),e("h5",{staticClass:"s-subtitle"},[t._v("Edit SSIDs names")]),e("div",{staticClass:"form-group"},[e("table",{staticClass:"table table-striped table-hover"},[t._m(0),e("tbody",[t._l(t.config.network.ssids,(function(s){return e("tr",{key:s},[e("td",[t._v(t._s(s))]),e("td",[e("button",{staticClass:"btn btn-sm",on:{click:function(e){return t.delete_ssid(s)}}},[t._v("Delete")])])])})),e("tr",[e("td",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.ssid,expression:"ssid"}],staticClass:"form-input",attrs:{type:"text",placeholder:"SSID name"},domProps:{value:t.ssid},on:{input:function(e){e.target.composing||(t.ssid=e.target.value)}}})]),e("td",[e("button",{staticClass:"btn btn-sm",on:{click:function(e){return t.add_ssid()}}},[t._v("Add")])])])],2)])])])])},n=[function(){var t=this,e=t._self._c;return e("thead",[e("tr",[e("th",[t._v("Network name")]),e("th",[t._v("Action")])])])}],a=(s("14d9"),s("bc3a")),o=s.n(a),c={name:"manageinterface",data(){return{config:{},ssid:"",iface_in:"",toaster:{show:!1,message:"",type:null}}},props:{},methods:{async get_jwt(){await o.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(){o.a.get("/api/config/list",{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data&&(this.config=t.data,this.iface_in=this.config.network.in,this.iface_out=this.config.network.out,console.log(this.iface_in))}).catch(t=>console.log(t))},delete_ssid:function(t){var e=this.config.network.ssids.indexOf(t);this.config.network.ssids.splice(e,1),this.update_ssids()},add_ssid:function(){this.config.network.ssids.push(this.ssid),this.ssid="",this.update_ssids()},update_ssids:function(){o.a.get("/api/config/edit/network/ssids/"+this.config.network.ssids.join("|"),{timeout:1e4,headers:{"X-Token":this.jwt}}).then(t=>{t.data.status&&(this.toaster={show:!0,message:"Configuration updated",type:"success"},setTimeout(function(){this.toaster={show:!1}}.bind(this),1e3))}).catch(t=>console.log(t))},change_interface:function(t,e){o.a.get(`/api/config/edit/network/${t}/${e}`,{timeout:1e4,headers:{"X-Token":this.jwt}}).then(s=>{this.toaster={show:!0,message:"Configuration updated",type:"success"},setTimeout(function(){this.toaster={show:!1}}.bind(this),1e3),s.data.status&&(this.config.network[t]=e)}).catch(t=>console.log(t))}},created:function(){this.get_jwt().then(()=>{this.load_config()})}},r=c,l=s("2877"),u=Object(l["a"])(r,i,n,!1,null,null,null);e["default"]=u.exports}}]);
//# sourceMappingURL=chunk-3c0d118e.e3f2944c.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long