manageos 2.3.2 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -57
- package/package.json +26 -49
- package/packages/windows/BUILD_TOOLS/build.bat +55 -0
- package/packages/windows/BUILD_TOOLS/clean.bat +14 -0
- package/packages/windows/BUILD_TOOLS/commands.json +54 -0
- package/{dist → packages/windows/dist}/Keyboard/keyboard.exe +0 -0
- package/{dist → packages/windows/dist}/Mouse/mouse.exe +0 -0
- package/{dist → packages/windows/dist}/Server/HTTP/http.exe +0 -0
- package/{dist → packages/windows/dist}/index.d.ts +1 -1
- package/{dist → packages/windows/dist}/index.d.ts.map +1 -1
- package/{dist → packages/windows/dist}/index.js +1 -1
- package/{dist → packages/windows/dist}/index.js.map +1 -1
- package/packages/windows/docs/.nojekyll +1 -0
- package/packages/windows/docs/assets/hierarchy.js +1 -0
- package/packages/windows/docs/assets/highlight.css +22 -0
- package/packages/windows/docs/assets/icons.js +18 -0
- package/packages/windows/docs/assets/icons.svg +1 -0
- package/packages/windows/docs/assets/main.js +60 -0
- package/packages/windows/docs/assets/material-style.css +261 -0
- package/packages/windows/docs/assets/navigation.js +1 -0
- package/packages/windows/docs/assets/search.js +1 -0
- package/packages/windows/docs/assets/style.css +1633 -0
- package/packages/windows/docs/classes/Android.default.html +215 -0
- package/packages/windows/docs/classes/Android_adb.default.html +215 -0
- package/packages/windows/docs/classes/Android_fastboot.default.html +215 -0
- package/packages/windows/docs/classes/Keyboard.default.html +215 -0
- package/packages/windows/docs/classes/Mouse.default.html +215 -0
- package/packages/windows/docs/classes/PsExec.default.html +217 -0
- package/packages/windows/docs/classes/PsExec_psexec.default.html +215 -0
- package/packages/windows/docs/classes/PsExec_psfile.default.html +215 -0
- package/packages/windows/docs/classes/PsExec_psgetsid.default.html +215 -0
- package/packages/windows/docs/classes/PsExec_psinfo.default.html +215 -0
- package/packages/windows/docs/classes/Server.default.html +215 -0
- package/packages/windows/docs/classes/Server_FTP.default.html +215 -0
- package/packages/windows/docs/classes/Server_HTTP.default.html +215 -0
- package/packages/windows/docs/classes/antivirus.default.html +215 -0
- package/packages/windows/docs/classes/audio.default.html +215 -0
- package/packages/windows/docs/classes/auditpolicy.default.html +215 -0
- package/packages/windows/docs/classes/bitlocker.default.html +215 -0
- package/packages/windows/docs/classes/camera.default.html +215 -0
- package/packages/windows/docs/classes/certificates.default.html +215 -0
- package/packages/windows/docs/classes/clipboard.default.html +215 -0
- package/packages/windows/docs/classes/encryption.default.html +220 -0
- package/packages/windows/docs/classes/eventlogs.default.html +217 -0
- package/packages/windows/docs/classes/filesystem.default.html +215 -0
- package/packages/windows/docs/classes/firewall.default.html +215 -0
- package/packages/windows/docs/classes/index.default.html +250 -0
- package/packages/windows/docs/classes/joystick.default.html +215 -0
- package/packages/windows/docs/classes/localization.default.html +215 -0
- package/packages/windows/docs/classes/microphone.default.html +215 -0
- package/packages/windows/docs/classes/msconfig.default.html +215 -0
- package/packages/windows/docs/classes/network.default.html +215 -0
- package/packages/windows/docs/classes/notification.default.html +215 -0
- package/packages/windows/docs/classes/power.default.html +215 -0
- package/packages/windows/docs/classes/printer.default.html +215 -0
- package/packages/windows/docs/classes/regedit.default.html +219 -0
- package/packages/windows/docs/classes/scheduler.default.html +215 -0
- package/packages/windows/docs/classes/screen.default.html +325 -0
- package/packages/windows/docs/classes/secpol.default.html +215 -0
- package/packages/windows/docs/classes/services.default.html +215 -0
- package/packages/windows/docs/classes/shell.default.html +217 -0
- package/packages/windows/docs/classes/startup.default.html +215 -0
- package/packages/windows/docs/classes/taskmgr.default.html +215 -0
- package/packages/windows/docs/classes/taskscheduler.default.html +215 -0
- package/packages/windows/docs/classes/uac.default.html +215 -0
- package/packages/windows/docs/classes/usb.default.html +215 -0
- package/packages/windows/docs/classes/users.default.html +235 -0
- package/packages/windows/docs/classes/windowsupdate.default.html +215 -0
- package/packages/windows/docs/functions/systeminfo.default.html +212 -0
- package/packages/windows/docs/hierarchy.html +212 -0
- package/packages/windows/docs/index.html +212 -0
- package/packages/windows/docs/interfaces/Server_FTP.FTPOptions.html +225 -0
- package/packages/windows/docs/interfaces/joystick.JoystickDevice.html +218 -0
- package/packages/windows/docs/interfaces/taskscheduler.TaskInfo.html +241 -0
- package/packages/windows/docs/modules/Android.html +212 -0
- package/packages/windows/docs/modules/Android_adb.html +212 -0
- package/packages/windows/docs/modules/Android_fastboot.html +212 -0
- package/packages/windows/docs/modules/Keyboard.html +212 -0
- package/packages/windows/docs/modules/Mouse.html +212 -0
- package/packages/windows/docs/modules/PsExec.html +212 -0
- package/packages/windows/docs/modules/PsExec_psexec.html +212 -0
- package/packages/windows/docs/modules/PsExec_psfile.html +212 -0
- package/packages/windows/docs/modules/PsExec_psgetsid.html +212 -0
- package/packages/windows/docs/modules/PsExec_psinfo.html +212 -0
- package/packages/windows/docs/modules/Server.html +212 -0
- package/packages/windows/docs/modules/Server_FTP.html +212 -0
- package/packages/windows/docs/modules/Server_HTTP.html +212 -0
- package/packages/windows/docs/modules/antivirus.html +212 -0
- package/packages/windows/docs/modules/audio.html +212 -0
- package/packages/windows/docs/modules/auditpolicy.html +212 -0
- package/packages/windows/docs/modules/bitlocker.html +212 -0
- package/packages/windows/docs/modules/camera.html +212 -0
- package/packages/windows/docs/modules/certificates.html +212 -0
- package/packages/windows/docs/modules/clipboard.html +212 -0
- package/packages/windows/docs/modules/encryption.html +212 -0
- package/packages/windows/docs/modules/eventlogs.html +212 -0
- package/packages/windows/docs/modules/filesystem.html +212 -0
- package/packages/windows/docs/modules/firewall.html +212 -0
- package/packages/windows/docs/modules/index-1.html +212 -0
- package/packages/windows/docs/modules/index.html +212 -0
- package/packages/windows/docs/modules/joystick.html +212 -0
- package/packages/windows/docs/modules/localization.html +212 -0
- package/packages/windows/docs/modules/microphone.html +212 -0
- package/packages/windows/docs/modules/msconfig.html +212 -0
- package/packages/windows/docs/modules/network.html +212 -0
- package/packages/windows/docs/modules/notification.html +212 -0
- package/packages/windows/docs/modules/power.html +212 -0
- package/packages/windows/docs/modules/printer.html +212 -0
- package/packages/windows/docs/modules/regedit.html +212 -0
- package/packages/windows/docs/modules/scheduler.html +212 -0
- package/packages/windows/docs/modules/screen.html +212 -0
- package/packages/windows/docs/modules/secpol.html +212 -0
- package/packages/windows/docs/modules/services.html +212 -0
- package/packages/windows/docs/modules/shell.html +212 -0
- package/packages/windows/docs/modules/startup.html +212 -0
- package/packages/windows/docs/modules/systeminfo.html +212 -0
- package/packages/windows/docs/modules/taskmgr.html +212 -0
- package/packages/windows/docs/modules/taskscheduler.html +212 -0
- package/packages/windows/docs/modules/uac.html +212 -0
- package/packages/windows/docs/modules/usb.html +212 -0
- package/packages/windows/docs/modules/users.html +212 -0
- package/packages/windows/docs/modules/windowsupdate.html +212 -0
- package/packages/windows/docs/openapi.json +25925 -0
- package/packages/windows/docs/types/PsExec_psexec.PsExecOptions.html +231 -0
- package/packages/windows/docs/types/PsExec_psfile.PsFileOptions.html +219 -0
- package/packages/windows/docs/types/PsExec_psgetsid.PsGetSidOptions.html +218 -0
- package/packages/windows/docs/types/PsExec_psinfo.PsInfoOptions.html +222 -0
- package/packages/windows/docs/types/joystick.JoystickDataCallback.html +212 -0
- package/packages/windows/docs/types/windowsupdate.Parser.html +212 -0
- package/packages/windows/package.json +60 -0
- package/packages/windows/scripts/install-os-deps.js +0 -0
- package/packages/windows/src/Android/adb.ts +1398 -0
- package/packages/windows/src/Android/dependencies/AdbWinApi.dll +0 -0
- package/packages/windows/src/Android/dependencies/AdbWinUsbApi.dll +0 -0
- package/packages/windows/src/Android/dependencies/adb.exe +0 -0
- package/packages/windows/src/Android/dependencies/cmd-here.exe +0 -0
- package/packages/windows/src/Android/dependencies/fastboot.exe +0 -0
- package/packages/windows/src/Android/fastboot.ts +217 -0
- package/packages/windows/src/Android/index.ts +7 -0
- package/packages/windows/src/Keyboard/index.ts +139 -0
- package/packages/windows/src/Keyboard/keyboard.c +181 -0
- package/packages/windows/src/Mouse/index.ts +173 -0
- package/packages/windows/src/Mouse/mouse.c +239 -0
- package/packages/windows/src/PsExec/dependencies/PsExec.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/PsExec64.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/PsGetsid.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/PsGetsid64.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/PsInfo.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/PsInfo64.exe +0 -0
- package/packages/windows/src/PsExec/dependencies/psfile.exe +0 -0
- package/packages/windows/src/PsExec/index.ts +11 -0
- package/packages/windows/src/PsExec/psexec.ts +129 -0
- package/packages/windows/src/PsExec/psfile.ts +110 -0
- package/packages/windows/src/PsExec/psgetsid.ts +111 -0
- package/packages/windows/src/PsExec/psinfo.ts +123 -0
- package/packages/windows/src/Server/FTP.ts +165 -0
- package/packages/windows/src/Server/HTTP/http.c +226 -0
- package/packages/windows/src/Server/HTTP/index.ts +51 -0
- package/packages/windows/src/Server/index.ts +7 -0
- package/packages/windows/src/antivirus.ts +139 -0
- package/packages/windows/src/audio.ts +195 -0
- package/packages/windows/src/auditpolicy.ts +125 -0
- package/packages/windows/src/bitlocker.ts +257 -0
- package/packages/windows/src/camera.ts +229 -0
- package/packages/windows/src/certificates.ts +154 -0
- package/packages/windows/src/clipboard.ts +52 -0
- package/packages/windows/src/encryption.ts +56 -0
- package/packages/windows/src/eventlogs.ts +179 -0
- package/packages/windows/src/filesystem.ts +166 -0
- package/packages/windows/src/firewall.ts +143 -0
- package/packages/windows/src/index.ts +77 -0
- package/packages/windows/src/joystick.ts +87 -0
- package/packages/windows/src/localization.ts +133 -0
- package/packages/windows/src/microphone.ts +132 -0
- package/packages/windows/src/msconfig.ts +233 -0
- package/packages/windows/src/network.ts +466 -0
- package/packages/windows/src/notification.ts +196 -0
- package/packages/windows/src/power.ts +62 -0
- package/packages/windows/src/printer.ts +225 -0
- package/packages/windows/src/regedit.ts +73 -0
- package/packages/windows/src/scheduler.ts +152 -0
- package/packages/windows/src/screen.ts +1229 -0
- package/packages/windows/src/secpol.ts +99 -0
- package/packages/windows/src/services.ts +371 -0
- package/packages/windows/src/shell.ts +227 -0
- package/packages/windows/src/startup.ts +91 -0
- package/packages/windows/src/systeminfo.ts +35 -0
- package/packages/windows/src/taskmgr.ts +212 -0
- package/packages/windows/src/taskscheduler.ts +401 -0
- package/packages/windows/src/uac.ts +83 -0
- package/packages/windows/src/usb.ts +224 -0
- package/packages/windows/src/users.ts +409 -0
- package/packages/windows/src/windowsupdate.ts +188 -0
- package/packages/windows/tsconfig.json +23 -0
- package/packages/windows/typedoc.json +18 -0
- package/packages/windows/types/regedit.d.ts +9 -0
- package/packages/windows/types/ssh2-sftp-server.d.ts +80 -0
- package/scripts/postinstall.js +28 -0
- package/src/index.ts +17 -0
- package/tsconfig.json +23 -0
- /package/{dist → packages/windows/dist}/Android/adb.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Android/adb.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Android/adb.js +0 -0
- /package/{dist → packages/windows/dist}/Android/adb.js.map +0 -0
- /package/{dist → packages/windows/dist}/Android/dependencies/AdbWinApi.dll +0 -0
- /package/{dist → packages/windows/dist}/Android/dependencies/AdbWinUsbApi.dll +0 -0
- /package/{dist → packages/windows/dist}/Android/dependencies/adb.exe +0 -0
- /package/{dist → packages/windows/dist}/Android/dependencies/cmd-here.exe +0 -0
- /package/{dist → packages/windows/dist}/Android/dependencies/fastboot.exe +0 -0
- /package/{dist → packages/windows/dist}/Android/fastboot.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Android/fastboot.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Android/fastboot.js +0 -0
- /package/{dist → packages/windows/dist}/Android/fastboot.js.map +0 -0
- /package/{dist → packages/windows/dist}/Android/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Android/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Android/index.js +0 -0
- /package/{dist → packages/windows/dist}/Android/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/Keyboard/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Keyboard/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Keyboard/index.js +0 -0
- /package/{dist → packages/windows/dist}/Keyboard/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/Mouse/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Mouse/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Mouse/index.js +0 -0
- /package/{dist → packages/windows/dist}/Mouse/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsExec.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsExec64.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsGetsid.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsGetsid64.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsInfo.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/PsInfo64.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/dependencies/psfile.exe +0 -0
- /package/{dist → packages/windows/dist}/PsExec/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/PsExec/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/index.js +0 -0
- /package/{dist → packages/windows/dist}/PsExec/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psexec.d.ts +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psexec.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psexec.js +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psexec.js.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psfile.d.ts +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psfile.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psfile.js +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psfile.js.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psgetsid.d.ts +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psgetsid.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psgetsid.js +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psgetsid.js.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psinfo.d.ts +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psinfo.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psinfo.js +0 -0
- /package/{dist → packages/windows/dist}/PsExec/psinfo.js.map +0 -0
- /package/{dist → packages/windows/dist}/Server/FTP.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Server/FTP.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Server/FTP.js +0 -0
- /package/{dist → packages/windows/dist}/Server/FTP.js.map +0 -0
- /package/{dist → packages/windows/dist}/Server/HTTP/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Server/HTTP/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Server/HTTP/index.js +0 -0
- /package/{dist → packages/windows/dist}/Server/HTTP/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/Server/index.d.ts +0 -0
- /package/{dist → packages/windows/dist}/Server/index.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/Server/index.js +0 -0
- /package/{dist → packages/windows/dist}/Server/index.js.map +0 -0
- /package/{dist → packages/windows/dist}/antivirus.d.ts +0 -0
- /package/{dist → packages/windows/dist}/antivirus.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/antivirus.js +0 -0
- /package/{dist → packages/windows/dist}/antivirus.js.map +0 -0
- /package/{dist → packages/windows/dist}/audio.d.ts +0 -0
- /package/{dist → packages/windows/dist}/audio.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/audio.js +0 -0
- /package/{dist → packages/windows/dist}/audio.js.map +0 -0
- /package/{dist → packages/windows/dist}/auditpolicy.d.ts +0 -0
- /package/{dist → packages/windows/dist}/auditpolicy.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/auditpolicy.js +0 -0
- /package/{dist → packages/windows/dist}/auditpolicy.js.map +0 -0
- /package/{dist → packages/windows/dist}/bitlocker.d.ts +0 -0
- /package/{dist → packages/windows/dist}/bitlocker.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/bitlocker.js +0 -0
- /package/{dist → packages/windows/dist}/bitlocker.js.map +0 -0
- /package/{dist → packages/windows/dist}/camera.d.ts +0 -0
- /package/{dist → packages/windows/dist}/camera.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/camera.js +0 -0
- /package/{dist → packages/windows/dist}/camera.js.map +0 -0
- /package/{dist → packages/windows/dist}/certificates.d.ts +0 -0
- /package/{dist → packages/windows/dist}/certificates.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/certificates.js +0 -0
- /package/{dist → packages/windows/dist}/certificates.js.map +0 -0
- /package/{dist → packages/windows/dist}/clipboard.d.ts +0 -0
- /package/{dist → packages/windows/dist}/clipboard.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/clipboard.js +0 -0
- /package/{dist → packages/windows/dist}/clipboard.js.map +0 -0
- /package/{dist → packages/windows/dist}/encryption.d.ts +0 -0
- /package/{dist → packages/windows/dist}/encryption.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/encryption.js +0 -0
- /package/{dist → packages/windows/dist}/encryption.js.map +0 -0
- /package/{dist → packages/windows/dist}/eventlogs.d.ts +0 -0
- /package/{dist → packages/windows/dist}/eventlogs.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/eventlogs.js +0 -0
- /package/{dist → packages/windows/dist}/eventlogs.js.map +0 -0
- /package/{dist → packages/windows/dist}/filesystem.d.ts +0 -0
- /package/{dist → packages/windows/dist}/filesystem.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/filesystem.js +0 -0
- /package/{dist → packages/windows/dist}/filesystem.js.map +0 -0
- /package/{dist → packages/windows/dist}/firewall.d.ts +0 -0
- /package/{dist → packages/windows/dist}/firewall.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/firewall.js +0 -0
- /package/{dist → packages/windows/dist}/firewall.js.map +0 -0
- /package/{dist → packages/windows/dist}/joystick.d.ts +0 -0
- /package/{dist → packages/windows/dist}/joystick.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/joystick.js +0 -0
- /package/{dist → packages/windows/dist}/joystick.js.map +0 -0
- /package/{dist → packages/windows/dist}/localization.d.ts +0 -0
- /package/{dist → packages/windows/dist}/localization.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/localization.js +0 -0
- /package/{dist → packages/windows/dist}/localization.js.map +0 -0
- /package/{dist → packages/windows/dist}/microphone.d.ts +0 -0
- /package/{dist → packages/windows/dist}/microphone.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/microphone.js +0 -0
- /package/{dist → packages/windows/dist}/microphone.js.map +0 -0
- /package/{dist → packages/windows/dist}/msconfig.d.ts +0 -0
- /package/{dist → packages/windows/dist}/msconfig.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/msconfig.js +0 -0
- /package/{dist → packages/windows/dist}/msconfig.js.map +0 -0
- /package/{dist → packages/windows/dist}/network.d.ts +0 -0
- /package/{dist → packages/windows/dist}/network.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/network.js +0 -0
- /package/{dist → packages/windows/dist}/network.js.map +0 -0
- /package/{dist → packages/windows/dist}/notification.d.ts +0 -0
- /package/{dist → packages/windows/dist}/notification.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/notification.js +0 -0
- /package/{dist → packages/windows/dist}/notification.js.map +0 -0
- /package/{dist → packages/windows/dist}/power.d.ts +0 -0
- /package/{dist → packages/windows/dist}/power.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/power.js +0 -0
- /package/{dist → packages/windows/dist}/power.js.map +0 -0
- /package/{dist → packages/windows/dist}/printer.d.ts +0 -0
- /package/{dist → packages/windows/dist}/printer.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/printer.js +0 -0
- /package/{dist → packages/windows/dist}/printer.js.map +0 -0
- /package/{dist → packages/windows/dist}/regedit.d.ts +0 -0
- /package/{dist → packages/windows/dist}/regedit.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/regedit.js +0 -0
- /package/{dist → packages/windows/dist}/regedit.js.map +0 -0
- /package/{dist → packages/windows/dist}/scheduler.d.ts +0 -0
- /package/{dist → packages/windows/dist}/scheduler.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/scheduler.js +0 -0
- /package/{dist → packages/windows/dist}/scheduler.js.map +0 -0
- /package/{dist → packages/windows/dist}/screen.d.ts +0 -0
- /package/{dist → packages/windows/dist}/screen.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/screen.js +0 -0
- /package/{dist → packages/windows/dist}/screen.js.map +0 -0
- /package/{dist → packages/windows/dist}/secpol.d.ts +0 -0
- /package/{dist → packages/windows/dist}/secpol.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/secpol.js +0 -0
- /package/{dist → packages/windows/dist}/secpol.js.map +0 -0
- /package/{dist → packages/windows/dist}/services.d.ts +0 -0
- /package/{dist → packages/windows/dist}/services.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/services.js +0 -0
- /package/{dist → packages/windows/dist}/services.js.map +0 -0
- /package/{dist → packages/windows/dist}/shell.d.ts +0 -0
- /package/{dist → packages/windows/dist}/shell.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/shell.js +0 -0
- /package/{dist → packages/windows/dist}/shell.js.map +0 -0
- /package/{dist → packages/windows/dist}/startup.d.ts +0 -0
- /package/{dist → packages/windows/dist}/startup.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/startup.js +0 -0
- /package/{dist → packages/windows/dist}/startup.js.map +0 -0
- /package/{dist → packages/windows/dist}/systeminfo.d.ts +0 -0
- /package/{dist → packages/windows/dist}/systeminfo.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/systeminfo.js +0 -0
- /package/{dist → packages/windows/dist}/systeminfo.js.map +0 -0
- /package/{dist → packages/windows/dist}/taskmgr.d.ts +0 -0
- /package/{dist → packages/windows/dist}/taskmgr.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/taskmgr.js +0 -0
- /package/{dist → packages/windows/dist}/taskmgr.js.map +0 -0
- /package/{dist → packages/windows/dist}/taskscheduler.d.ts +0 -0
- /package/{dist → packages/windows/dist}/taskscheduler.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/taskscheduler.js +0 -0
- /package/{dist → packages/windows/dist}/taskscheduler.js.map +0 -0
- /package/{dist → packages/windows/dist}/uac.d.ts +0 -0
- /package/{dist → packages/windows/dist}/uac.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/uac.js +0 -0
- /package/{dist → packages/windows/dist}/uac.js.map +0 -0
- /package/{dist → packages/windows/dist}/usb.d.ts +0 -0
- /package/{dist → packages/windows/dist}/usb.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/usb.js +0 -0
- /package/{dist → packages/windows/dist}/usb.js.map +0 -0
- /package/{dist → packages/windows/dist}/users.d.ts +0 -0
- /package/{dist → packages/windows/dist}/users.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/users.js +0 -0
- /package/{dist → packages/windows/dist}/users.js.map +0 -0
- /package/{dist → packages/windows/dist}/windowsupdate.d.ts +0 -0
- /package/{dist → packages/windows/dist}/windowsupdate.d.ts.map +0 -0
- /package/{dist → packages/windows/dist}/windowsupdate.js +0 -0
- /package/{dist → packages/windows/dist}/windowsupdate.js.map +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { exec, execSync } from "child_process";
|
|
2
|
+
|
|
3
|
+
class Async {
|
|
4
|
+
static validatePolicy(filePath: string): Promise<void> {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
exec(`secedit /validate /cfg "${filePath}"`, (error, stdout, stderr) => {
|
|
7
|
+
if (error) reject(stderr || error);
|
|
8
|
+
else resolve();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static analyzePolicy(outputReport: string): Promise<void> {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
exec(
|
|
16
|
+
`secedit /analyze /db secedit.sdb /log "${outputReport}"`,
|
|
17
|
+
(error) => {
|
|
18
|
+
if (error) reject(error);
|
|
19
|
+
else resolve();
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static resetPolicy(): Promise<void> {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
exec(
|
|
28
|
+
`secedit /configure /cfg %windir%\\inf\\defltbase.inf /db secedit.sdb /overwrite`,
|
|
29
|
+
(error) => {
|
|
30
|
+
if (error) reject(error);
|
|
31
|
+
else resolve();
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static applyPolicy(filePath: string): Promise<void> {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
exec(
|
|
39
|
+
`secedit /configure /db secedit.sdb /cfg "${filePath}" /overwrite`,
|
|
40
|
+
(error) => {
|
|
41
|
+
if (error) reject(error);
|
|
42
|
+
else resolve();
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static exportPolicy(outputPath: string): Promise<void> {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
exec(`secedit /export /cfg "${outputPath}"`, (error) => {
|
|
50
|
+
if (error) reject(error);
|
|
51
|
+
else resolve();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static verifyPolicy(): Promise<void> {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
exec(`secedit /analyze /db secedit.sdb`, (error, stdout, stderr) => {
|
|
59
|
+
if (error) reject(stderr || error);
|
|
60
|
+
else resolve();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class Sync {
|
|
67
|
+
static validatePolicy(filePath: string): void {
|
|
68
|
+
execSync(`secedit /validate /cfg "${filePath}"`, { stdio: "inherit" });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static analyzePolicy(outputReport: string): void {
|
|
72
|
+
execSync(`secedit /analyze /db secedit.sdb /log "${outputReport}"`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static resetPolicy(): void {
|
|
76
|
+
execSync(
|
|
77
|
+
`secedit /configure /cfg %windir%\\inf\\defltbase.inf /db secedit.sdb /overwrite`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static applyPolicy(filePath: string): void {
|
|
82
|
+
execSync(
|
|
83
|
+
`secedit /configure /db secedit.sdb /cfg "${filePath}" /overwrite`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static exportPolicy(outputPath: string): void {
|
|
88
|
+
execSync(`secedit /export /cfg "${outputPath}"`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static verifyPolicy(): void {
|
|
92
|
+
execSync(`secedit /analyze /db secedit.sdb`, { stdio: "inherit" });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default class SecPol {
|
|
97
|
+
public static readonly Sync = Sync;
|
|
98
|
+
public static readonly Async = Async;
|
|
99
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { exec, execSync } from "child_process";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import { Service } from "node-windows";
|
|
4
|
+
|
|
5
|
+
type ServiceInfo = {
|
|
6
|
+
name: string;
|
|
7
|
+
status: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type ServiceResult = {
|
|
11
|
+
success: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class Sync {
|
|
16
|
+
static createService(config: {
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
scriptPath: string;
|
|
20
|
+
args?: string[];
|
|
21
|
+
cwd?: string;
|
|
22
|
+
userName?: string;
|
|
23
|
+
password?: string;
|
|
24
|
+
}): ServiceResult {
|
|
25
|
+
try {
|
|
26
|
+
const svcConfig: any = {
|
|
27
|
+
name: config.name,
|
|
28
|
+
description: config.description || "Node.js Service",
|
|
29
|
+
script: path.resolve(config.scriptPath),
|
|
30
|
+
cwd: config.cwd || path.dirname(config.scriptPath),
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
if (config.userName) {
|
|
34
|
+
svcConfig.user = {
|
|
35
|
+
account: config.userName,
|
|
36
|
+
password: config.password || "",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (config.args && config.args.length) {
|
|
41
|
+
svcConfig.env = config.args.map((arg, index) => ({
|
|
42
|
+
name: `ARG${index}`,
|
|
43
|
+
value: arg,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const svc = new Service(svcConfig);
|
|
48
|
+
|
|
49
|
+
svc.on("install", () => svc.start());
|
|
50
|
+
svc.on("error", (err) => {});
|
|
51
|
+
|
|
52
|
+
svc.install();
|
|
53
|
+
|
|
54
|
+
return { success: true };
|
|
55
|
+
} catch (error: any) {
|
|
56
|
+
return { success: false, error: error.message || String(error) };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static list(): ServiceInfo[] {
|
|
61
|
+
try {
|
|
62
|
+
const output = execSync(
|
|
63
|
+
`powershell "Get-Service | Select-Object -Property Name, Status | Format-Table -HideTableHeaders"`,
|
|
64
|
+
{ encoding: "utf-8" }
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const lines = output
|
|
68
|
+
.split("\n")
|
|
69
|
+
.map((line) => line.trim())
|
|
70
|
+
.filter((line) => line.length > 0);
|
|
71
|
+
|
|
72
|
+
return lines.map((line) => {
|
|
73
|
+
const [name, ...statusParts] = line.split(/\s{2,}/);
|
|
74
|
+
return { name, status: statusParts.join(" ") };
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static start(serviceName: string): ServiceResult {
|
|
82
|
+
try {
|
|
83
|
+
execSync(`powershell Start-Service -Name "${serviceName}"`);
|
|
84
|
+
return { success: true };
|
|
85
|
+
} catch (error: any) {
|
|
86
|
+
return { success: false, error: error.message || String(error) };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static stop(serviceName: string): ServiceResult {
|
|
91
|
+
try {
|
|
92
|
+
execSync(`powershell Stop-Service -Name "${serviceName}"`);
|
|
93
|
+
return { success: true };
|
|
94
|
+
} catch (error: any) {
|
|
95
|
+
return { success: false, error: error.message || String(error) };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static restart(serviceName: string): ServiceResult {
|
|
100
|
+
try {
|
|
101
|
+
execSync(`powershell Restart-Service -Name "${serviceName}"`);
|
|
102
|
+
return { success: true };
|
|
103
|
+
} catch (error: any) {
|
|
104
|
+
return { success: false, error: error.message || String(error) };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static enable(serviceName: string): ServiceResult {
|
|
109
|
+
try {
|
|
110
|
+
execSync(
|
|
111
|
+
`powershell Set-Service -Name "${serviceName}" -StartupType Automatic`
|
|
112
|
+
);
|
|
113
|
+
return { success: true };
|
|
114
|
+
} catch (error: any) {
|
|
115
|
+
return { success: false, error: error.message || String(error) };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static disable(serviceName: string): ServiceResult {
|
|
120
|
+
try {
|
|
121
|
+
execSync(
|
|
122
|
+
`powershell Set-Service -Name "${serviceName}" -StartupType Disabled`
|
|
123
|
+
);
|
|
124
|
+
return { success: true };
|
|
125
|
+
} catch (error: any) {
|
|
126
|
+
return { success: false, error: error.message || String(error) };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static status(serviceName: string): { status: string; error?: string } {
|
|
131
|
+
try {
|
|
132
|
+
const output = execSync(
|
|
133
|
+
`powershell "(Get-Service -Name '${serviceName}').Status"`,
|
|
134
|
+
{ encoding: "utf-8" }
|
|
135
|
+
);
|
|
136
|
+
return { status: output.trim() };
|
|
137
|
+
} catch (error: any) {
|
|
138
|
+
return { status: "unknown", error: error.message || String(error) };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static install(
|
|
143
|
+
scriptPath: string,
|
|
144
|
+
serviceName: string,
|
|
145
|
+
description: string = "Node.js Service"
|
|
146
|
+
): ServiceResult {
|
|
147
|
+
try {
|
|
148
|
+
const svc = new Service({
|
|
149
|
+
name: serviceName,
|
|
150
|
+
description,
|
|
151
|
+
script: path.resolve(scriptPath),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
svc.on("install", () => svc.start());
|
|
155
|
+
svc.install();
|
|
156
|
+
|
|
157
|
+
return { success: true };
|
|
158
|
+
} catch (error: any) {
|
|
159
|
+
return { success: false, error: error.message || String(error) };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static uninstall(serviceName: string): ServiceResult {
|
|
164
|
+
try {
|
|
165
|
+
const svc = new Service({
|
|
166
|
+
name: serviceName,
|
|
167
|
+
script: "C:\\Windows\\System32\\cmd.exe",
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
svc.on("uninstall", () => {});
|
|
171
|
+
svc.uninstall();
|
|
172
|
+
|
|
173
|
+
return { success: true };
|
|
174
|
+
} catch (error: any) {
|
|
175
|
+
return { success: false, error: error.message || String(error) };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
class Async {
|
|
181
|
+
static createService(config: {
|
|
182
|
+
name: string;
|
|
183
|
+
description?: string;
|
|
184
|
+
scriptPath: string;
|
|
185
|
+
args?: string[];
|
|
186
|
+
cwd?: string;
|
|
187
|
+
userName?: string;
|
|
188
|
+
password?: string;
|
|
189
|
+
}): Promise<ServiceResult> {
|
|
190
|
+
return new Promise((resolve) => {
|
|
191
|
+
try {
|
|
192
|
+
const svcConfig: any = {
|
|
193
|
+
name: config.name,
|
|
194
|
+
description: config.description || "Node.js Service",
|
|
195
|
+
script: path.resolve(config.scriptPath),
|
|
196
|
+
cwd: config.cwd || path.dirname(config.scriptPath),
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
if (config.userName) {
|
|
200
|
+
svcConfig.user = {
|
|
201
|
+
account: config.userName,
|
|
202
|
+
password: config.password || "",
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (config.args && config.args.length) {
|
|
207
|
+
svcConfig.env = config.args.map((arg, index) => ({
|
|
208
|
+
name: `ARG${index}`,
|
|
209
|
+
value: arg,
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const svc = new Service(svcConfig);
|
|
214
|
+
|
|
215
|
+
svc.on("install", () => svc.start());
|
|
216
|
+
svc.on("error", (err) =>
|
|
217
|
+
resolve({ success: false, error: err.message })
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
svc.install();
|
|
221
|
+
resolve({ success: true });
|
|
222
|
+
} catch (error: any) {
|
|
223
|
+
resolve({ success: false, error: error.message || String(error) });
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
static list(): Promise<ServiceInfo[]> {
|
|
229
|
+
return new Promise((resolve) => {
|
|
230
|
+
exec(
|
|
231
|
+
`powershell "Get-Service | Select-Object -Property Name, Status | Format-Table -HideTableHeaders"`,
|
|
232
|
+
{ encoding: "utf-8" },
|
|
233
|
+
(err, stdout) => {
|
|
234
|
+
if (err) {
|
|
235
|
+
resolve([]);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const lines = stdout
|
|
240
|
+
.split("\n")
|
|
241
|
+
.map((line) => line.trim())
|
|
242
|
+
.filter((line) => line.length > 0);
|
|
243
|
+
|
|
244
|
+
const services = lines.map((line) => {
|
|
245
|
+
const [name, ...statusParts] = line.split(/\s{2,}/);
|
|
246
|
+
return { name, status: statusParts.join(" ") };
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
resolve(services);
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static start(serviceName: string): Promise<ServiceResult> {
|
|
256
|
+
return new Promise((resolve) => {
|
|
257
|
+
exec(`powershell Start-Service -Name "${serviceName}"`, (err) => {
|
|
258
|
+
if (err) resolve({ success: false, error: err.message });
|
|
259
|
+
else resolve({ success: true });
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
static stop(serviceName: string): Promise<ServiceResult> {
|
|
265
|
+
return new Promise((resolve) => {
|
|
266
|
+
exec(`powershell Stop-Service -Name "${serviceName}"`, (err) => {
|
|
267
|
+
if (err) resolve({ success: false, error: err.message });
|
|
268
|
+
else resolve({ success: true });
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
static restart(serviceName: string): Promise<ServiceResult> {
|
|
274
|
+
return new Promise((resolve) => {
|
|
275
|
+
exec(`powershell Restart-Service -Name "${serviceName}"`, (err) => {
|
|
276
|
+
if (err) resolve({ success: false, error: err.message });
|
|
277
|
+
else resolve({ success: true });
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
static enable(serviceName: string): Promise<ServiceResult> {
|
|
283
|
+
return new Promise((resolve) => {
|
|
284
|
+
exec(
|
|
285
|
+
`powershell Set-Service -Name "${serviceName}" -StartupType Automatic`,
|
|
286
|
+
(err) => {
|
|
287
|
+
if (err) resolve({ success: false, error: err.message });
|
|
288
|
+
else resolve({ success: true });
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
static disable(serviceName: string): Promise<ServiceResult> {
|
|
295
|
+
return new Promise((resolve) => {
|
|
296
|
+
exec(
|
|
297
|
+
`powershell Set-Service -Name "${serviceName}" -StartupType Disabled`,
|
|
298
|
+
(err) => {
|
|
299
|
+
if (err) resolve({ success: false, error: err.message });
|
|
300
|
+
else resolve({ success: true });
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
static status(
|
|
307
|
+
serviceName: string
|
|
308
|
+
): Promise<{ status: string; error?: string }> {
|
|
309
|
+
return new Promise((resolve) => {
|
|
310
|
+
exec(
|
|
311
|
+
`powershell "(Get-Service -Name '${serviceName}').Status"`,
|
|
312
|
+
{ encoding: "utf-8" },
|
|
313
|
+
(err, stdout) => {
|
|
314
|
+
if (err) resolve({ status: "unknown", error: err.message });
|
|
315
|
+
else resolve({ status: stdout.trim() });
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
static install(
|
|
322
|
+
scriptPath: string,
|
|
323
|
+
serviceName: string,
|
|
324
|
+
description: string = "Node.js Service"
|
|
325
|
+
): Promise<ServiceResult> {
|
|
326
|
+
return new Promise((resolve) => {
|
|
327
|
+
try {
|
|
328
|
+
const svc = new Service({
|
|
329
|
+
name: serviceName,
|
|
330
|
+
description,
|
|
331
|
+
script: path.resolve(scriptPath),
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
svc.on("install", () => svc.start());
|
|
335
|
+
svc.on("error", (err) =>
|
|
336
|
+
resolve({ success: false, error: err.message })
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
svc.install();
|
|
340
|
+
resolve({ success: true });
|
|
341
|
+
} catch (error: any) {
|
|
342
|
+
resolve({ success: false, error: error.message || String(error) });
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
static uninstall(serviceName: string): Promise<ServiceResult> {
|
|
348
|
+
return new Promise((resolve) => {
|
|
349
|
+
try {
|
|
350
|
+
const svc = new Service({
|
|
351
|
+
name: serviceName,
|
|
352
|
+
script: "C:\\Windows\\System32\\cmd.exe",
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
svc.on("uninstall", () => resolve({ success: true }));
|
|
356
|
+
svc.on("error", (err) =>
|
|
357
|
+
resolve({ success: false, error: err.message })
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
svc.uninstall();
|
|
361
|
+
} catch (error: any) {
|
|
362
|
+
resolve({ success: false, error: error.message || String(error) });
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export default class Services {
|
|
369
|
+
public static readonly Sync = Sync;
|
|
370
|
+
public static readonly Async = Async;
|
|
371
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { execSync, exec as _exec } from "child_process";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
|
|
4
|
+
const exec = promisify(_exec);
|
|
5
|
+
|
|
6
|
+
interface ShellInfo {
|
|
7
|
+
name: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getDetectionCommand(name: string) {
|
|
12
|
+
const safeName = name.replace(/'/g, "''");
|
|
13
|
+
return `where.exe ${safeName} 2>nul`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class ShellInstance {
|
|
17
|
+
constructor(public info: ShellInfo) {}
|
|
18
|
+
showPath(): string {
|
|
19
|
+
if (this.info.path) return this.info.path;
|
|
20
|
+
try {
|
|
21
|
+
const out = execSync(getDetectionCommand(this.info.name), {
|
|
22
|
+
encoding: "utf8",
|
|
23
|
+
});
|
|
24
|
+
return String(out).split(/\r?\n/)[0].trim();
|
|
25
|
+
} catch {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class AsyncShellInstance {
|
|
32
|
+
constructor(public info: ShellInfo) {}
|
|
33
|
+
async showPath(): Promise<string> {
|
|
34
|
+
if (this.info.path) return this.info.path;
|
|
35
|
+
try {
|
|
36
|
+
const { stdout } = (await exec(getDetectionCommand(this.info.name))) as {
|
|
37
|
+
stdout: string;
|
|
38
|
+
stderr: string;
|
|
39
|
+
};
|
|
40
|
+
return stdout ? stdout.split(/\r?\n/)[0].trim() : "";
|
|
41
|
+
} catch {
|
|
42
|
+
return "";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class SyncShell {
|
|
48
|
+
static listShells(): ShellInstance[] {
|
|
49
|
+
const shellsToCheck = [
|
|
50
|
+
"cmd.exe",
|
|
51
|
+
"powershell.exe",
|
|
52
|
+
"pwsh.exe",
|
|
53
|
+
"bash.exe",
|
|
54
|
+
"zsh.exe",
|
|
55
|
+
"wsl.exe",
|
|
56
|
+
];
|
|
57
|
+
const found: ShellInstance[] = [];
|
|
58
|
+
for (const s of shellsToCheck) {
|
|
59
|
+
try {
|
|
60
|
+
const p = execSync(getDetectionCommand(s), { encoding: "utf8" })
|
|
61
|
+
.split(/\r?\n/)[0]
|
|
62
|
+
.trim();
|
|
63
|
+
if (p) found.push(new ShellInstance({ name: s, path: p }));
|
|
64
|
+
} catch {}
|
|
65
|
+
}
|
|
66
|
+
return found;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static showPath(shell: string): string {
|
|
70
|
+
try {
|
|
71
|
+
return execSync(getDetectionCommand(shell), { encoding: "utf8" })
|
|
72
|
+
.split(/\r?\n/)[0]
|
|
73
|
+
.trim();
|
|
74
|
+
} catch {
|
|
75
|
+
return "";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class AsyncShell {
|
|
81
|
+
static async listShells(): Promise<AsyncShellInstance[]> {
|
|
82
|
+
const shellsToCheck = [
|
|
83
|
+
"cmd.exe",
|
|
84
|
+
"powershell.exe",
|
|
85
|
+
"pwsh.exe",
|
|
86
|
+
"bash.exe",
|
|
87
|
+
"zsh.exe",
|
|
88
|
+
"wsl.exe",
|
|
89
|
+
];
|
|
90
|
+
const found: AsyncShellInstance[] = [];
|
|
91
|
+
for (const s of shellsToCheck) {
|
|
92
|
+
try {
|
|
93
|
+
const { stdout } = (await exec(getDetectionCommand(s))) as {
|
|
94
|
+
stdout: string;
|
|
95
|
+
stderr: string;
|
|
96
|
+
};
|
|
97
|
+
const p = stdout ? stdout.split(/\r?\n/)[0].trim() : "";
|
|
98
|
+
if (p) found.push(new AsyncShellInstance({ name: s, path: p }));
|
|
99
|
+
} catch {}
|
|
100
|
+
}
|
|
101
|
+
return found;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static async showPath(shell: string): Promise<string> {
|
|
105
|
+
try {
|
|
106
|
+
const { stdout } = (await exec(getDetectionCommand(shell))) as {
|
|
107
|
+
stdout: string;
|
|
108
|
+
stderr: string;
|
|
109
|
+
};
|
|
110
|
+
return stdout ? stdout.split(/\r?\n/)[0].trim() : "";
|
|
111
|
+
} catch {
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class SyncWSL {
|
|
118
|
+
static getPath(): string {
|
|
119
|
+
return execSync(getDetectionCommand("wsl.exe"), {
|
|
120
|
+
encoding: "utf8",
|
|
121
|
+
}).trim();
|
|
122
|
+
}
|
|
123
|
+
static exists(): boolean {
|
|
124
|
+
return !!this.getPath();
|
|
125
|
+
}
|
|
126
|
+
static getVersion(): string {
|
|
127
|
+
return execSync("wsl.exe --version", { encoding: "utf8" }).trim();
|
|
128
|
+
}
|
|
129
|
+
static listDistributions(): string[] {
|
|
130
|
+
const output = execSync("wsl.exe --list --quiet", { encoding: "utf8" });
|
|
131
|
+
return output
|
|
132
|
+
? output
|
|
133
|
+
.split(/\r?\n/)
|
|
134
|
+
.map((d) => d.trim())
|
|
135
|
+
.filter(Boolean)
|
|
136
|
+
: [];
|
|
137
|
+
}
|
|
138
|
+
static runCommand(distribution: string, command: string): string {
|
|
139
|
+
return execSync(`wsl.exe -d ${distribution} -- ${command}`, {
|
|
140
|
+
encoding: "utf8",
|
|
141
|
+
}).trim();
|
|
142
|
+
}
|
|
143
|
+
static terminate(distribution?: string): void {
|
|
144
|
+
if (distribution) {
|
|
145
|
+
execSync(`wsl.exe --terminate ${distribution}`);
|
|
146
|
+
} else {
|
|
147
|
+
execSync(`wsl.exe --shutdown`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
class AsyncWSL {
|
|
153
|
+
static async getPath(): Promise<string> {
|
|
154
|
+
const { stdout } = await exec(getDetectionCommand("wsl.exe"));
|
|
155
|
+
return stdout.trim();
|
|
156
|
+
}
|
|
157
|
+
static async exists(): Promise<boolean> {
|
|
158
|
+
return !!(await this.getPath());
|
|
159
|
+
}
|
|
160
|
+
static async getVersion(): Promise<string> {
|
|
161
|
+
const { stdout } = await exec("wsl.exe --version");
|
|
162
|
+
return stdout.trim();
|
|
163
|
+
}
|
|
164
|
+
static async listDistributions(): Promise<string[]> {
|
|
165
|
+
const { stdout } = await exec("wsl.exe --list --quiet");
|
|
166
|
+
return stdout
|
|
167
|
+
? stdout
|
|
168
|
+
.split(/\r?\n/)
|
|
169
|
+
.map((d) => d.trim())
|
|
170
|
+
.filter(Boolean)
|
|
171
|
+
: [];
|
|
172
|
+
}
|
|
173
|
+
static async runCommand(
|
|
174
|
+
distribution: string,
|
|
175
|
+
command: string
|
|
176
|
+
): Promise<string> {
|
|
177
|
+
const { stdout } = await exec(`wsl.exe -d ${distribution} -- ${command}`);
|
|
178
|
+
return stdout.trim();
|
|
179
|
+
}
|
|
180
|
+
static async terminate(distribution?: string): Promise<void> {
|
|
181
|
+
if (distribution) {
|
|
182
|
+
await exec(`wsl.exe --terminate ${distribution}`);
|
|
183
|
+
} else {
|
|
184
|
+
await exec(`wsl.exe --shutdown`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const Sync = new Proxy(SyncShell, {
|
|
190
|
+
get(target, prop) {
|
|
191
|
+
if (typeof prop === "string" && /^\d+$/.test(prop)) {
|
|
192
|
+
const list = target.listShells();
|
|
193
|
+
return list[Number(prop)];
|
|
194
|
+
}
|
|
195
|
+
const value = (target as any)[prop];
|
|
196
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const Async = new Proxy(AsyncShell, {
|
|
201
|
+
get(target, prop) {
|
|
202
|
+
const value = (target as any)[prop];
|
|
203
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export default class Shell {
|
|
208
|
+
public static readonly Sync = Sync;
|
|
209
|
+
public static readonly Async = Async;
|
|
210
|
+
|
|
211
|
+
public static readonly WSL: {
|
|
212
|
+
Sync?: typeof SyncWSL;
|
|
213
|
+
Async?: typeof AsyncWSL;
|
|
214
|
+
} = {};
|
|
215
|
+
|
|
216
|
+
static initWSL() {
|
|
217
|
+
try {
|
|
218
|
+
const path = execSync(getDetectionCommand("wsl.exe"), {
|
|
219
|
+
encoding: "utf8",
|
|
220
|
+
}).trim();
|
|
221
|
+
if (path) {
|
|
222
|
+
this.WSL.Sync = SyncWSL;
|
|
223
|
+
this.WSL.Async = AsyncWSL;
|
|
224
|
+
}
|
|
225
|
+
} catch {}
|
|
226
|
+
}
|
|
227
|
+
}
|