|
1 |
| -const {getProcessInfo} = require('windows-tlist') |
| 1 | +const { getProcessInfo } = require('windows-tlist') |
2 | 2 | const wqlImport = import('wql-process-monitor')
|
3 | 3 |
|
| 4 | + |
4 | 5 | function send(...args) {
|
5 |
| - process.send(...args) |
| 6 | + process.send(...args) |
6 | 7 | }
|
7 | 8 |
|
8 | 9 | wqlImport.then((wql) => {
|
9 |
| - const {subscribe} = wql |
10 |
| - return subscribe({ |
11 |
| - creation: true, |
12 |
| - deletion: false, |
13 |
| - bin: { |
14 |
| - filter: ['cmd.exe', 'tlist.exe', 'conhost.exe'], |
15 |
| - }, |
16 |
| - }) |
| 10 | + const { subscribe } = wql |
| 11 | + return subscribe({ |
| 12 | + creation: true, |
| 13 | + deletion: false, |
| 14 | + bin: { |
| 15 | + filter: ['cmd.exe', 'tlist.exe', 'conhost.exe'], |
| 16 | + }, |
| 17 | + }) |
17 | 18 | })
|
18 |
| - .then((processMonitor) => { |
| 19 | + .then((processMonitor) => { |
19 | 20 |
|
20 |
| - processMonitor.on('creation', ([process, pid, filepath, user]) => { |
| 21 | + processMonitor.on('creation', ([process, pid, filepath, user]) => { |
21 | 22 |
|
22 |
| - console.log(`[game-detection]: process creation - ${process}::${pid}(${user}) ["${filepath}"]`) |
23 |
| - // getProcessInfo(pid) |
24 |
| - // .then(processInfo => { |
25 |
| - const isGame = [ |
26 |
| - // processInfo.modules.find(module => module.path.includes('d3d')), |
27 |
| - // processInfo.modules.find(module => module.path.includes('dxgi')), |
28 |
| - // processInfo.modules.find(module => module.path.includes('steamapps')), |
29 |
| - filepath.includes('steamapps'), |
30 |
| - filepath.includes('demo.exe'), |
31 |
| - ].some(Boolean) |
32 |
| - if (isGame) { |
33 |
| - console.log('[game-detection]: Game launched', filepath) |
34 |
| - send({ |
35 |
| - type: 'game-detection', |
36 |
| - payload: { |
37 |
| - process, pid, filepath, user, |
38 |
| - }, |
39 |
| - }) |
40 |
| - } |
41 |
| - // }) |
| 23 | + console.log(`[game-detection]: process creation - ${process}::${pid}(${user}) ["${filepath}"]`) |
| 24 | + // getProcessInfo(pid) |
| 25 | + // .then(processInfo => { |
| 26 | + const isGame = [ |
| 27 | + // processInfo.modules.find(module => module.path.includes('d3d')), |
| 28 | + // processInfo.modules.find(module => module.path.includes('dxgi')), |
| 29 | + // processInfo.modules.find(module => module.path.includes('steamapps')), |
| 30 | + filepath.includes('steamapps'), |
| 31 | + filepath.includes('demo.exe'), |
| 32 | + ].some(Boolean) |
| 33 | + if (isGame) { |
| 34 | + console.log('[game-detection]: Game launched', filepath) |
| 35 | + send({ |
| 36 | + type: 'game-detection', |
| 37 | + payload: { |
| 38 | + process, pid, filepath, user, |
| 39 | + }, |
42 | 40 | })
|
| 41 | + // getProcessInfo(pid).then(console.log) |
| 42 | + } |
| 43 | + // }) |
43 | 44 | })
|
| 45 | + }) |
44 | 46 |
|
45 | 47 | setInterval(() => {
|
46 | 48 | }, 1000 * 60 * 60)
|
|
0 commit comments