|
@@ -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
|
|
|
+}
|