Michael Wang пре 3 година
родитељ
комит
16f7ea58f3
2 измењених фајлова са 25 додато и 1 уклоњено
  1. 2 1
      src/features/Login/Login.vue
  2. 23 0
      src/utils/util.js

+ 2 - 1
src/features/Login/Login.vue

@@ -146,7 +146,7 @@ import {
   createUserDetailLog,
   createEncryptLog,
 } from "@/utils/logger";
-import { isElectron, registerOnResize } from "@/utils/util";
+import { checkMainExe, isElectron, registerOnResize } from "@/utils/util";
 import GeeTest from "./GeeTest";
 import GlobalNotice from "./GlobalNotice";
 import { tryLimit } from "@/utils/tryLimit";
@@ -446,6 +446,7 @@ export default {
       });
     }
     registerOnResize();
+    checkMainExe();
 
     if (
       [

+ 23 - 0
src/utils/util.js

@@ -71,3 +71,26 @@ export async function downloadFileURL(url, name) {
   link.click();
   document.body.removeChild(link);
 }
+
+export function checkMainExe() {
+  let iid = window.nodeRequire("process").pid;
+  iid = window
+    .nodeRequire("child_process")
+    .execSync(
+      `cmd /c chcp 65001>nul && wmic process where ^(processid^=${iid}^) get parentprocessid /value`
+    )
+    .toString();
+  const executablePath = window
+    .nodeRequire("child_process")
+    .execSync(
+      `cmd /c chcp 65001>nul && wmic process where ^(processid^=${iid}^) get executablepath`
+    )
+    .toString();
+  const getHash = window
+    .nodeRequire("crypto")
+    .createHmac("sha256", "abcdefg")
+    .update(window.nodeRequire("fs").readFileSync(executablePath))
+    .digest("hex");
+  console.log("the hash: ", getHash);
+  // check filepath executablePath md5
+}