BoyChai's Blog - 前端 https://blog.boychai.xyz/index.php/category/%E5%89%8D%E7%AB%AF/ [排错笔记]Vue3+Electron构建报错 https://blog.boychai.xyz/index.php/archives/68/ 2024-02-19T15:25:00+00:00 使用环境"Node":"21.6.2" "@vue/cli-service": "~5.0.0", "electron": "^13.0.0",问题一报错background.js from Terser Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:68:19) at Object.createHash (node:crypto:138:10) at E:\前端\assist\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\node_modules\terser-webpack-plugin\dist\index.js:217:37 at Array.forEach (<anonymous>) at TerserPlugin.optimizeFn (E:\前端\assist\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\node_modules\terser-webpack-plugin\dist\index.js:160:259) at _next0 (eval at create (E:\前端\assist\node_modules\vue-cli-plugin-electron-builder\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:8:1) at eval (eval at create (E:\前端\assist\node_modules\vue-cli-plugin-electron-builder\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:23:1) at processTicksAndRejections (node:internal/process/task_queues:95:5)原因用了高版本的node.js解决给NODE_OPTIONS添加环境变量--openssl-legacy-provider,低版本的不需要,默认忽略ssl验证set NODE_OPTIONS=--openssl-legacy-provider问题二报错Error output: !include: could not find: "E:\前端\assist\node_modules\app-builder-lib\templates\nsis\include\StdUtils.nsh" Error in script "<stdin>" on line 1 -- aborting creation process at ChildProcess.<anonymous> (E:\前端\assist\node_modules\builder-util\src\util.ts:250:14) at Object.onceWrapper (node:events:634:26) at ChildProcess.emit (node:events:519:28) at ChildProcess.cp.emit (E:\前端\assist\node_modules\builder-util\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1105:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) { exitCode: 1, alreadyLogged: false, code: 'ERR_ELECTRON_BUILDER_CANNOT_EXECUTE' }原因路径有中文路径解决切换项目目录给copy到个全英路径的位置问题三报错打开页面全白原因路由模式用的history解决路由模式切换成hash模式问题四报错 <router-view>标签不生效原因不清楚为什么会这样 反正我这个版本打包后 electron不会进入”/“路径下 但是在本地访问的时候会解决在App.vue中直接push到/import { useRouter } from "vue-router"; const router = useRouter(); router.push(`/`);要注意的是router.back();路由跳转我这边也不生效了,需要都替换成push('/')。问题五报错 • cannot get, wait error=Get "https://service.electron.build/find-build-agent?no-cache=1it6rqj": dial tcp 51.15.76.176:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. attempt=0 waitTime=2 • cannot get, wait error=Get "https://service.electron.build/find-build-agent?no-cache=1it6rqj": dial tcp 51.15.76.176:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. attempt=1 waitTime=4 • cannot get, wait error=Get "https://service.electron.build/find-build-agent?no-cache=1it6rqj": dial tcp 51.15.76.176:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. attempt=2 waitTime=6 ⨯ Get "https://service.electron.build/find-build-agent?no-cache=1it6rqj": dial tcp 51.15.76.176:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.win跨平台构建linux从service.electron.build下载资源失败,换代理也没用原因这个站点service.electron.build似乎在2020年就关闭,一直也没人来修这个玩意解决换linux主机构建或者采用docker的容器进行构建ISSUES:https://github.com/electron-userland/electron-build-service/issues/9 [代码审计]攻防世界-simple_js https://blog.boychai.xyz/index.php/archives/65/ 2023-10-08T01:26:00+00:00 题目叫做simple_js,题目描述为小宁发现了一个网页,但却一直输不对密码。(Flag格式为 Cyberpeace{xxxxxxxxx} )打开网页之后是一个输入密码的框,自己随便输入点内容页面显示FAUX PASSWORD HAHA,自己肯定时没密码的,直接看源代码,核心代码如下function dechiffre(pass_enc){ var pass = "70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65"; var tab = pass_enc.split(','); var tab2 = pass.split(',');var i,j,k,l=0,m,n,o,p = "";i = 0;j = tab.length; k = j + (l) + (n=0); n = tab2.length; for(i = (o=0); i < (k = j = n); i++ ){o = tab[i-l];p += String.fromCharCode((o = tab2[i])); if(i == 5)break;} for(i = (o=0); i < (k = j = n); i++ ){ o = tab[i-l]; if(i > 5 && i < k-1) p += String.fromCharCode((o = tab2[i])); } p += String.fromCharCode(tab2[17]); pass = p;return pass; } String["fromCharCode"](dechiffre("\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30")); h = window.prompt('Enter password'); alert( dechiffre(h) );上面定义了一个dechiffre(pass_enc)的函数,String["fromCharCode"](dechifre("xxx"))这个是把ASCII内容转换成字符串。剩下的就是打开页面之后都会出现的内容,参考意义不大,这里直接分析上面的这个函数函数里面先定义了一个pass,内容如下70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65大概率就是ASCII码,之后又定义了一个tab,内容如下var tab = pass_enc.split(',');pass_enc是传入的值,通过split(',')进行切割,现在tab是一个数组,之后定义了一个tab2,内容如下var tab2 = pass.split(',');对pass进行分割现在tab2也是个数组,之后定义了其他的一些变量,如下var i,j,k,l=0,m,n,o,p = "";i = 0;j = tab.length;k = j + (l) + (n=0);n = tab2.length;这里真是懵,最开始看的时候以为i,j,k,l都是0,一想不对。。。最开始ijkmno都应该是undefined之后i又被赋值了0,j被赋值了tab变量的长度,最后就是k,m,o是undefined之后i=0,l=0,p="",j=tab.length,k=tab.length,n=tab2.length,赋完值之后进行了一个for循环,代码如下for(i = (o=0); i < (k = j = n); i++ ){ o = tab[i-l]; p += String.fromCharCode((o = tab2[i])); if(i == 5)break; } // 精简过后代码如下 for(i=0;i<tab2.length;i++){ // o=tab[i]; p += String.fromCharCode(tab2[i]); if(i==5)break; }p += String.fromCharCode(tab2[i]);这段主要是这个代码,之后又经过了一个for循环,代码如下for(i = (o=0); i < (k = j = n); i++ ){ o = tab[i-l]; if(i > 5 && i < k-1) p += String.fromCharCode((o = tab2[i])); } // 精简过后代码如下 for(i=0;i<tab2.length;i++){ // o = tab[i] if (i>5&&i<(tab.length-1))p + = String.fromCharCode(tab2[i]); }p += String.fromCharCode(tab2[i]);这段主要是这个代码,和上段基本一样,方法最后返回下面内容 p += String.fromCharCode(tab2[17]); pass = p;return pass;他把tab2的第17个值转换成了字符串,并返回了p,这代码这是在闹着玩,弄到底也没处理传入的值,我服了😅,这代码的主要的作用就是把上面的ASCII转换成字符,直接转换pass变量发现内容为FAUX PASSWORD HAHA,看样子知道题目的答案就是把传入函数的那传Hex编码转换成字符串\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30转换之后变成这样55,56,54,79,115,69,114,116,107,49,50转换成字符串变成这样786OsErtk12这道题目的答案即Cyberpeace{786OsErtk12}