manageos 2.3.1 → 2.3.4

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.
Files changed (398) hide show
  1. package/README.md +147 -0
  2. package/package.json +26 -46
  3. package/packages/windows/BUILD_TOOLS/build.bat +55 -0
  4. package/packages/windows/BUILD_TOOLS/clean.bat +14 -0
  5. package/packages/windows/BUILD_TOOLS/commands.json +54 -0
  6. package/packages/windows/dist/Keyboard/index.d.ts +24 -0
  7. package/packages/windows/dist/Keyboard/index.d.ts.map +1 -0
  8. package/packages/windows/dist/Keyboard/index.js +128 -0
  9. package/packages/windows/dist/Keyboard/index.js.map +1 -0
  10. package/packages/windows/dist/Keyboard/keyboard.exe +0 -0
  11. package/{dist → packages/windows/dist}/Mouse/mouse.exe +0 -0
  12. package/packages/windows/dist/Server/FTP.d.ts +28 -0
  13. package/packages/windows/dist/Server/FTP.d.ts.map +1 -0
  14. package/packages/windows/dist/Server/FTP.js +119 -0
  15. package/packages/windows/dist/Server/FTP.js.map +1 -0
  16. package/packages/windows/dist/Server/HTTP/http.exe +0 -0
  17. package/packages/windows/dist/Server/HTTP/index.d.ts +17 -0
  18. package/packages/windows/dist/Server/HTTP/index.d.ts.map +1 -0
  19. package/packages/windows/dist/Server/HTTP/index.js +42 -0
  20. package/packages/windows/dist/Server/HTTP/index.js.map +1 -0
  21. package/packages/windows/dist/Server/index.d.ts +7 -0
  22. package/packages/windows/dist/Server/index.d.ts.map +1 -0
  23. package/packages/windows/dist/Server/index.js +7 -0
  24. package/packages/windows/dist/Server/index.js.map +1 -0
  25. package/{dist → packages/windows/dist}/index.d.ts +7 -1
  26. package/packages/windows/dist/index.d.ts.map +1 -0
  27. package/{dist → packages/windows/dist}/index.js +7 -1
  28. package/packages/windows/dist/index.js.map +1 -0
  29. package/packages/windows/dist/joystick.d.ts +25 -0
  30. package/packages/windows/dist/joystick.d.ts.map +1 -0
  31. package/packages/windows/dist/joystick.js +61 -0
  32. package/packages/windows/dist/joystick.js.map +1 -0
  33. package/packages/windows/dist/startup.d.ts +21 -0
  34. package/packages/windows/dist/startup.d.ts.map +1 -0
  35. package/packages/windows/dist/startup.js +71 -0
  36. package/packages/windows/dist/startup.js.map +1 -0
  37. package/packages/windows/docs/.nojekyll +1 -0
  38. package/packages/windows/docs/assets/hierarchy.js +1 -0
  39. package/packages/windows/docs/assets/highlight.css +22 -0
  40. package/packages/windows/docs/assets/icons.js +18 -0
  41. package/packages/windows/docs/assets/icons.svg +1 -0
  42. package/packages/windows/docs/assets/main.js +60 -0
  43. package/packages/windows/docs/assets/material-style.css +261 -0
  44. package/packages/windows/docs/assets/navigation.js +1 -0
  45. package/packages/windows/docs/assets/search.js +1 -0
  46. package/packages/windows/docs/assets/style.css +1633 -0
  47. package/packages/windows/docs/classes/Android.default.html +215 -0
  48. package/packages/windows/docs/classes/Android_adb.default.html +215 -0
  49. package/packages/windows/docs/classes/Android_fastboot.default.html +215 -0
  50. package/packages/windows/docs/classes/Keyboard.default.html +215 -0
  51. package/packages/windows/docs/classes/Mouse.default.html +215 -0
  52. package/packages/windows/docs/classes/PsExec.default.html +217 -0
  53. package/packages/windows/docs/classes/PsExec_psexec.default.html +215 -0
  54. package/packages/windows/docs/classes/PsExec_psfile.default.html +215 -0
  55. package/packages/windows/docs/classes/PsExec_psgetsid.default.html +215 -0
  56. package/packages/windows/docs/classes/PsExec_psinfo.default.html +215 -0
  57. package/packages/windows/docs/classes/Server.default.html +215 -0
  58. package/packages/windows/docs/classes/Server_FTP.default.html +215 -0
  59. package/packages/windows/docs/classes/Server_HTTP.default.html +215 -0
  60. package/packages/windows/docs/classes/antivirus.default.html +215 -0
  61. package/packages/windows/docs/classes/audio.default.html +215 -0
  62. package/packages/windows/docs/classes/auditpolicy.default.html +215 -0
  63. package/packages/windows/docs/classes/bitlocker.default.html +215 -0
  64. package/packages/windows/docs/classes/camera.default.html +215 -0
  65. package/packages/windows/docs/classes/certificates.default.html +215 -0
  66. package/packages/windows/docs/classes/clipboard.default.html +215 -0
  67. package/packages/windows/docs/classes/encryption.default.html +220 -0
  68. package/packages/windows/docs/classes/eventlogs.default.html +217 -0
  69. package/packages/windows/docs/classes/filesystem.default.html +215 -0
  70. package/packages/windows/docs/classes/firewall.default.html +215 -0
  71. package/packages/windows/docs/classes/index.default.html +250 -0
  72. package/packages/windows/docs/classes/joystick.default.html +215 -0
  73. package/packages/windows/docs/classes/localization.default.html +215 -0
  74. package/packages/windows/docs/classes/microphone.default.html +215 -0
  75. package/packages/windows/docs/classes/msconfig.default.html +215 -0
  76. package/packages/windows/docs/classes/network.default.html +215 -0
  77. package/packages/windows/docs/classes/notification.default.html +215 -0
  78. package/packages/windows/docs/classes/power.default.html +215 -0
  79. package/packages/windows/docs/classes/printer.default.html +215 -0
  80. package/packages/windows/docs/classes/regedit.default.html +219 -0
  81. package/packages/windows/docs/classes/scheduler.default.html +215 -0
  82. package/packages/windows/docs/classes/screen.default.html +325 -0
  83. package/packages/windows/docs/classes/secpol.default.html +215 -0
  84. package/packages/windows/docs/classes/services.default.html +215 -0
  85. package/packages/windows/docs/classes/shell.default.html +217 -0
  86. package/packages/windows/docs/classes/startup.default.html +215 -0
  87. package/packages/windows/docs/classes/taskmgr.default.html +215 -0
  88. package/packages/windows/docs/classes/taskscheduler.default.html +215 -0
  89. package/packages/windows/docs/classes/uac.default.html +215 -0
  90. package/packages/windows/docs/classes/usb.default.html +215 -0
  91. package/packages/windows/docs/classes/users.default.html +235 -0
  92. package/packages/windows/docs/classes/windowsupdate.default.html +215 -0
  93. package/packages/windows/docs/functions/systeminfo.default.html +212 -0
  94. package/packages/windows/docs/hierarchy.html +212 -0
  95. package/packages/windows/docs/index.html +212 -0
  96. package/packages/windows/docs/interfaces/Server_FTP.FTPOptions.html +225 -0
  97. package/packages/windows/docs/interfaces/joystick.JoystickDevice.html +218 -0
  98. package/packages/windows/docs/interfaces/taskscheduler.TaskInfo.html +241 -0
  99. package/packages/windows/docs/modules/Android.html +212 -0
  100. package/packages/windows/docs/modules/Android_adb.html +212 -0
  101. package/packages/windows/docs/modules/Android_fastboot.html +212 -0
  102. package/packages/windows/docs/modules/Keyboard.html +212 -0
  103. package/packages/windows/docs/modules/Mouse.html +212 -0
  104. package/packages/windows/docs/modules/PsExec.html +212 -0
  105. package/packages/windows/docs/modules/PsExec_psexec.html +212 -0
  106. package/packages/windows/docs/modules/PsExec_psfile.html +212 -0
  107. package/packages/windows/docs/modules/PsExec_psgetsid.html +212 -0
  108. package/packages/windows/docs/modules/PsExec_psinfo.html +212 -0
  109. package/packages/windows/docs/modules/Server.html +212 -0
  110. package/packages/windows/docs/modules/Server_FTP.html +212 -0
  111. package/packages/windows/docs/modules/Server_HTTP.html +212 -0
  112. package/packages/windows/docs/modules/antivirus.html +212 -0
  113. package/packages/windows/docs/modules/audio.html +212 -0
  114. package/packages/windows/docs/modules/auditpolicy.html +212 -0
  115. package/packages/windows/docs/modules/bitlocker.html +212 -0
  116. package/packages/windows/docs/modules/camera.html +212 -0
  117. package/packages/windows/docs/modules/certificates.html +212 -0
  118. package/packages/windows/docs/modules/clipboard.html +212 -0
  119. package/packages/windows/docs/modules/encryption.html +212 -0
  120. package/packages/windows/docs/modules/eventlogs.html +212 -0
  121. package/packages/windows/docs/modules/filesystem.html +212 -0
  122. package/packages/windows/docs/modules/firewall.html +212 -0
  123. package/packages/windows/docs/modules/index-1.html +212 -0
  124. package/packages/windows/docs/modules/index.html +212 -0
  125. package/packages/windows/docs/modules/joystick.html +212 -0
  126. package/packages/windows/docs/modules/localization.html +212 -0
  127. package/packages/windows/docs/modules/microphone.html +212 -0
  128. package/packages/windows/docs/modules/msconfig.html +212 -0
  129. package/packages/windows/docs/modules/network.html +212 -0
  130. package/packages/windows/docs/modules/notification.html +212 -0
  131. package/packages/windows/docs/modules/power.html +212 -0
  132. package/packages/windows/docs/modules/printer.html +212 -0
  133. package/packages/windows/docs/modules/regedit.html +212 -0
  134. package/packages/windows/docs/modules/scheduler.html +212 -0
  135. package/packages/windows/docs/modules/screen.html +212 -0
  136. package/packages/windows/docs/modules/secpol.html +212 -0
  137. package/packages/windows/docs/modules/services.html +212 -0
  138. package/packages/windows/docs/modules/shell.html +212 -0
  139. package/packages/windows/docs/modules/startup.html +212 -0
  140. package/packages/windows/docs/modules/systeminfo.html +212 -0
  141. package/packages/windows/docs/modules/taskmgr.html +212 -0
  142. package/packages/windows/docs/modules/taskscheduler.html +212 -0
  143. package/packages/windows/docs/modules/uac.html +212 -0
  144. package/packages/windows/docs/modules/usb.html +212 -0
  145. package/packages/windows/docs/modules/users.html +212 -0
  146. package/packages/windows/docs/modules/windowsupdate.html +212 -0
  147. package/packages/windows/docs/openapi.json +25925 -0
  148. package/packages/windows/docs/types/PsExec_psexec.PsExecOptions.html +231 -0
  149. package/packages/windows/docs/types/PsExec_psfile.PsFileOptions.html +219 -0
  150. package/packages/windows/docs/types/PsExec_psgetsid.PsGetSidOptions.html +218 -0
  151. package/packages/windows/docs/types/PsExec_psinfo.PsInfoOptions.html +222 -0
  152. package/packages/windows/docs/types/joystick.JoystickDataCallback.html +212 -0
  153. package/packages/windows/docs/types/windowsupdate.Parser.html +212 -0
  154. package/packages/windows/package.json +60 -0
  155. package/packages/windows/scripts/install-os-deps.js +0 -0
  156. package/packages/windows/src/Android/adb.ts +1398 -0
  157. package/packages/windows/src/Android/dependencies/AdbWinApi.dll +0 -0
  158. package/packages/windows/src/Android/dependencies/AdbWinUsbApi.dll +0 -0
  159. package/packages/windows/src/Android/dependencies/adb.exe +0 -0
  160. package/packages/windows/src/Android/dependencies/cmd-here.exe +0 -0
  161. package/packages/windows/src/Android/dependencies/fastboot.exe +0 -0
  162. package/packages/windows/src/Android/fastboot.ts +217 -0
  163. package/packages/windows/src/Android/index.ts +7 -0
  164. package/packages/windows/src/Keyboard/index.ts +139 -0
  165. package/packages/windows/src/Keyboard/keyboard.c +181 -0
  166. package/packages/windows/src/Mouse/index.ts +173 -0
  167. package/packages/windows/src/Mouse/mouse.c +239 -0
  168. package/packages/windows/src/PsExec/dependencies/PsExec.exe +0 -0
  169. package/packages/windows/src/PsExec/dependencies/PsExec64.exe +0 -0
  170. package/packages/windows/src/PsExec/dependencies/PsGetsid.exe +0 -0
  171. package/packages/windows/src/PsExec/dependencies/PsGetsid64.exe +0 -0
  172. package/packages/windows/src/PsExec/dependencies/PsInfo.exe +0 -0
  173. package/packages/windows/src/PsExec/dependencies/PsInfo64.exe +0 -0
  174. package/packages/windows/src/PsExec/dependencies/psfile.exe +0 -0
  175. package/packages/windows/src/PsExec/index.ts +11 -0
  176. package/packages/windows/src/PsExec/psexec.ts +129 -0
  177. package/packages/windows/src/PsExec/psfile.ts +110 -0
  178. package/packages/windows/src/PsExec/psgetsid.ts +111 -0
  179. package/packages/windows/src/PsExec/psinfo.ts +123 -0
  180. package/packages/windows/src/Server/FTP.ts +165 -0
  181. package/packages/windows/src/Server/HTTP/http.c +226 -0
  182. package/packages/windows/src/Server/HTTP/index.ts +51 -0
  183. package/packages/windows/src/Server/index.ts +7 -0
  184. package/packages/windows/src/antivirus.ts +139 -0
  185. package/packages/windows/src/audio.ts +195 -0
  186. package/packages/windows/src/auditpolicy.ts +125 -0
  187. package/packages/windows/src/bitlocker.ts +257 -0
  188. package/packages/windows/src/camera.ts +229 -0
  189. package/packages/windows/src/certificates.ts +154 -0
  190. package/packages/windows/src/clipboard.ts +52 -0
  191. package/packages/windows/src/encryption.ts +56 -0
  192. package/packages/windows/src/eventlogs.ts +179 -0
  193. package/packages/windows/src/filesystem.ts +166 -0
  194. package/packages/windows/src/firewall.ts +143 -0
  195. package/packages/windows/src/index.ts +77 -0
  196. package/packages/windows/src/joystick.ts +87 -0
  197. package/packages/windows/src/localization.ts +133 -0
  198. package/packages/windows/src/microphone.ts +132 -0
  199. package/packages/windows/src/msconfig.ts +233 -0
  200. package/packages/windows/src/network.ts +466 -0
  201. package/packages/windows/src/notification.ts +196 -0
  202. package/packages/windows/src/power.ts +62 -0
  203. package/packages/windows/src/printer.ts +225 -0
  204. package/packages/windows/src/regedit.ts +73 -0
  205. package/packages/windows/src/scheduler.ts +152 -0
  206. package/packages/windows/src/screen.ts +1229 -0
  207. package/packages/windows/src/secpol.ts +99 -0
  208. package/packages/windows/src/services.ts +371 -0
  209. package/packages/windows/src/shell.ts +227 -0
  210. package/packages/windows/src/startup.ts +91 -0
  211. package/packages/windows/src/systeminfo.ts +35 -0
  212. package/packages/windows/src/taskmgr.ts +212 -0
  213. package/packages/windows/src/taskscheduler.ts +401 -0
  214. package/packages/windows/src/uac.ts +83 -0
  215. package/packages/windows/src/usb.ts +224 -0
  216. package/packages/windows/src/users.ts +409 -0
  217. package/packages/windows/src/windowsupdate.ts +188 -0
  218. package/packages/windows/tsconfig.json +23 -0
  219. package/packages/windows/typedoc.json +18 -0
  220. package/packages/windows/types/regedit.d.ts +9 -0
  221. package/packages/windows/types/ssh2-sftp-server.d.ts +80 -0
  222. package/scripts/postinstall.js +28 -0
  223. package/src/index.ts +17 -0
  224. package/tsconfig.json +23 -0
  225. package/dist/index.d.ts.map +0 -1
  226. package/dist/index.js.map +0 -1
  227. /package/{dist → packages/windows/dist}/Android/adb.d.ts +0 -0
  228. /package/{dist → packages/windows/dist}/Android/adb.d.ts.map +0 -0
  229. /package/{dist → packages/windows/dist}/Android/adb.js +0 -0
  230. /package/{dist → packages/windows/dist}/Android/adb.js.map +0 -0
  231. /package/{dist → packages/windows/dist}/Android/dependencies/AdbWinApi.dll +0 -0
  232. /package/{dist → packages/windows/dist}/Android/dependencies/AdbWinUsbApi.dll +0 -0
  233. /package/{dist → packages/windows/dist}/Android/dependencies/adb.exe +0 -0
  234. /package/{dist → packages/windows/dist}/Android/dependencies/cmd-here.exe +0 -0
  235. /package/{dist → packages/windows/dist}/Android/dependencies/fastboot.exe +0 -0
  236. /package/{dist → packages/windows/dist}/Android/fastboot.d.ts +0 -0
  237. /package/{dist → packages/windows/dist}/Android/fastboot.d.ts.map +0 -0
  238. /package/{dist → packages/windows/dist}/Android/fastboot.js +0 -0
  239. /package/{dist → packages/windows/dist}/Android/fastboot.js.map +0 -0
  240. /package/{dist → packages/windows/dist}/Android/index.d.ts +0 -0
  241. /package/{dist → packages/windows/dist}/Android/index.d.ts.map +0 -0
  242. /package/{dist → packages/windows/dist}/Android/index.js +0 -0
  243. /package/{dist → packages/windows/dist}/Android/index.js.map +0 -0
  244. /package/{dist → packages/windows/dist}/Mouse/index.d.ts +0 -0
  245. /package/{dist → packages/windows/dist}/Mouse/index.d.ts.map +0 -0
  246. /package/{dist → packages/windows/dist}/Mouse/index.js +0 -0
  247. /package/{dist → packages/windows/dist}/Mouse/index.js.map +0 -0
  248. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsExec.exe +0 -0
  249. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsExec64.exe +0 -0
  250. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsGetsid.exe +0 -0
  251. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsGetsid64.exe +0 -0
  252. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsInfo.exe +0 -0
  253. /package/{dist → packages/windows/dist}/PsExec/dependencies/PsInfo64.exe +0 -0
  254. /package/{dist → packages/windows/dist}/PsExec/dependencies/psfile.exe +0 -0
  255. /package/{dist → packages/windows/dist}/PsExec/index.d.ts +0 -0
  256. /package/{dist → packages/windows/dist}/PsExec/index.d.ts.map +0 -0
  257. /package/{dist → packages/windows/dist}/PsExec/index.js +0 -0
  258. /package/{dist → packages/windows/dist}/PsExec/index.js.map +0 -0
  259. /package/{dist → packages/windows/dist}/PsExec/psexec.d.ts +0 -0
  260. /package/{dist → packages/windows/dist}/PsExec/psexec.d.ts.map +0 -0
  261. /package/{dist → packages/windows/dist}/PsExec/psexec.js +0 -0
  262. /package/{dist → packages/windows/dist}/PsExec/psexec.js.map +0 -0
  263. /package/{dist → packages/windows/dist}/PsExec/psfile.d.ts +0 -0
  264. /package/{dist → packages/windows/dist}/PsExec/psfile.d.ts.map +0 -0
  265. /package/{dist → packages/windows/dist}/PsExec/psfile.js +0 -0
  266. /package/{dist → packages/windows/dist}/PsExec/psfile.js.map +0 -0
  267. /package/{dist → packages/windows/dist}/PsExec/psgetsid.d.ts +0 -0
  268. /package/{dist → packages/windows/dist}/PsExec/psgetsid.d.ts.map +0 -0
  269. /package/{dist → packages/windows/dist}/PsExec/psgetsid.js +0 -0
  270. /package/{dist → packages/windows/dist}/PsExec/psgetsid.js.map +0 -0
  271. /package/{dist → packages/windows/dist}/PsExec/psinfo.d.ts +0 -0
  272. /package/{dist → packages/windows/dist}/PsExec/psinfo.d.ts.map +0 -0
  273. /package/{dist → packages/windows/dist}/PsExec/psinfo.js +0 -0
  274. /package/{dist → packages/windows/dist}/PsExec/psinfo.js.map +0 -0
  275. /package/{dist → packages/windows/dist}/antivirus.d.ts +0 -0
  276. /package/{dist → packages/windows/dist}/antivirus.d.ts.map +0 -0
  277. /package/{dist → packages/windows/dist}/antivirus.js +0 -0
  278. /package/{dist → packages/windows/dist}/antivirus.js.map +0 -0
  279. /package/{dist → packages/windows/dist}/audio.d.ts +0 -0
  280. /package/{dist → packages/windows/dist}/audio.d.ts.map +0 -0
  281. /package/{dist → packages/windows/dist}/audio.js +0 -0
  282. /package/{dist → packages/windows/dist}/audio.js.map +0 -0
  283. /package/{dist → packages/windows/dist}/auditpolicy.d.ts +0 -0
  284. /package/{dist → packages/windows/dist}/auditpolicy.d.ts.map +0 -0
  285. /package/{dist → packages/windows/dist}/auditpolicy.js +0 -0
  286. /package/{dist → packages/windows/dist}/auditpolicy.js.map +0 -0
  287. /package/{dist → packages/windows/dist}/bitlocker.d.ts +0 -0
  288. /package/{dist → packages/windows/dist}/bitlocker.d.ts.map +0 -0
  289. /package/{dist → packages/windows/dist}/bitlocker.js +0 -0
  290. /package/{dist → packages/windows/dist}/bitlocker.js.map +0 -0
  291. /package/{dist → packages/windows/dist}/camera.d.ts +0 -0
  292. /package/{dist → packages/windows/dist}/camera.d.ts.map +0 -0
  293. /package/{dist → packages/windows/dist}/camera.js +0 -0
  294. /package/{dist → packages/windows/dist}/camera.js.map +0 -0
  295. /package/{dist → packages/windows/dist}/certificates.d.ts +0 -0
  296. /package/{dist → packages/windows/dist}/certificates.d.ts.map +0 -0
  297. /package/{dist → packages/windows/dist}/certificates.js +0 -0
  298. /package/{dist → packages/windows/dist}/certificates.js.map +0 -0
  299. /package/{dist → packages/windows/dist}/clipboard.d.ts +0 -0
  300. /package/{dist → packages/windows/dist}/clipboard.d.ts.map +0 -0
  301. /package/{dist → packages/windows/dist}/clipboard.js +0 -0
  302. /package/{dist → packages/windows/dist}/clipboard.js.map +0 -0
  303. /package/{dist → packages/windows/dist}/encryption.d.ts +0 -0
  304. /package/{dist → packages/windows/dist}/encryption.d.ts.map +0 -0
  305. /package/{dist → packages/windows/dist}/encryption.js +0 -0
  306. /package/{dist → packages/windows/dist}/encryption.js.map +0 -0
  307. /package/{dist → packages/windows/dist}/eventlogs.d.ts +0 -0
  308. /package/{dist → packages/windows/dist}/eventlogs.d.ts.map +0 -0
  309. /package/{dist → packages/windows/dist}/eventlogs.js +0 -0
  310. /package/{dist → packages/windows/dist}/eventlogs.js.map +0 -0
  311. /package/{dist → packages/windows/dist}/filesystem.d.ts +0 -0
  312. /package/{dist → packages/windows/dist}/filesystem.d.ts.map +0 -0
  313. /package/{dist → packages/windows/dist}/filesystem.js +0 -0
  314. /package/{dist → packages/windows/dist}/filesystem.js.map +0 -0
  315. /package/{dist → packages/windows/dist}/firewall.d.ts +0 -0
  316. /package/{dist → packages/windows/dist}/firewall.d.ts.map +0 -0
  317. /package/{dist → packages/windows/dist}/firewall.js +0 -0
  318. /package/{dist → packages/windows/dist}/firewall.js.map +0 -0
  319. /package/{dist → packages/windows/dist}/localization.d.ts +0 -0
  320. /package/{dist → packages/windows/dist}/localization.d.ts.map +0 -0
  321. /package/{dist → packages/windows/dist}/localization.js +0 -0
  322. /package/{dist → packages/windows/dist}/localization.js.map +0 -0
  323. /package/{dist → packages/windows/dist}/microphone.d.ts +0 -0
  324. /package/{dist → packages/windows/dist}/microphone.d.ts.map +0 -0
  325. /package/{dist → packages/windows/dist}/microphone.js +0 -0
  326. /package/{dist → packages/windows/dist}/microphone.js.map +0 -0
  327. /package/{dist → packages/windows/dist}/msconfig.d.ts +0 -0
  328. /package/{dist → packages/windows/dist}/msconfig.d.ts.map +0 -0
  329. /package/{dist → packages/windows/dist}/msconfig.js +0 -0
  330. /package/{dist → packages/windows/dist}/msconfig.js.map +0 -0
  331. /package/{dist → packages/windows/dist}/network.d.ts +0 -0
  332. /package/{dist → packages/windows/dist}/network.d.ts.map +0 -0
  333. /package/{dist → packages/windows/dist}/network.js +0 -0
  334. /package/{dist → packages/windows/dist}/network.js.map +0 -0
  335. /package/{dist → packages/windows/dist}/notification.d.ts +0 -0
  336. /package/{dist → packages/windows/dist}/notification.d.ts.map +0 -0
  337. /package/{dist → packages/windows/dist}/notification.js +0 -0
  338. /package/{dist → packages/windows/dist}/notification.js.map +0 -0
  339. /package/{dist → packages/windows/dist}/power.d.ts +0 -0
  340. /package/{dist → packages/windows/dist}/power.d.ts.map +0 -0
  341. /package/{dist → packages/windows/dist}/power.js +0 -0
  342. /package/{dist → packages/windows/dist}/power.js.map +0 -0
  343. /package/{dist → packages/windows/dist}/printer.d.ts +0 -0
  344. /package/{dist → packages/windows/dist}/printer.d.ts.map +0 -0
  345. /package/{dist → packages/windows/dist}/printer.js +0 -0
  346. /package/{dist → packages/windows/dist}/printer.js.map +0 -0
  347. /package/{dist → packages/windows/dist}/regedit.d.ts +0 -0
  348. /package/{dist → packages/windows/dist}/regedit.d.ts.map +0 -0
  349. /package/{dist → packages/windows/dist}/regedit.js +0 -0
  350. /package/{dist → packages/windows/dist}/regedit.js.map +0 -0
  351. /package/{dist → packages/windows/dist}/scheduler.d.ts +0 -0
  352. /package/{dist → packages/windows/dist}/scheduler.d.ts.map +0 -0
  353. /package/{dist → packages/windows/dist}/scheduler.js +0 -0
  354. /package/{dist → packages/windows/dist}/scheduler.js.map +0 -0
  355. /package/{dist → packages/windows/dist}/screen.d.ts +0 -0
  356. /package/{dist → packages/windows/dist}/screen.d.ts.map +0 -0
  357. /package/{dist → packages/windows/dist}/screen.js +0 -0
  358. /package/{dist → packages/windows/dist}/screen.js.map +0 -0
  359. /package/{dist → packages/windows/dist}/secpol.d.ts +0 -0
  360. /package/{dist → packages/windows/dist}/secpol.d.ts.map +0 -0
  361. /package/{dist → packages/windows/dist}/secpol.js +0 -0
  362. /package/{dist → packages/windows/dist}/secpol.js.map +0 -0
  363. /package/{dist → packages/windows/dist}/services.d.ts +0 -0
  364. /package/{dist → packages/windows/dist}/services.d.ts.map +0 -0
  365. /package/{dist → packages/windows/dist}/services.js +0 -0
  366. /package/{dist → packages/windows/dist}/services.js.map +0 -0
  367. /package/{dist → packages/windows/dist}/shell.d.ts +0 -0
  368. /package/{dist → packages/windows/dist}/shell.d.ts.map +0 -0
  369. /package/{dist → packages/windows/dist}/shell.js +0 -0
  370. /package/{dist → packages/windows/dist}/shell.js.map +0 -0
  371. /package/{dist → packages/windows/dist}/systeminfo.d.ts +0 -0
  372. /package/{dist → packages/windows/dist}/systeminfo.d.ts.map +0 -0
  373. /package/{dist → packages/windows/dist}/systeminfo.js +0 -0
  374. /package/{dist → packages/windows/dist}/systeminfo.js.map +0 -0
  375. /package/{dist → packages/windows/dist}/taskmgr.d.ts +0 -0
  376. /package/{dist → packages/windows/dist}/taskmgr.d.ts.map +0 -0
  377. /package/{dist → packages/windows/dist}/taskmgr.js +0 -0
  378. /package/{dist → packages/windows/dist}/taskmgr.js.map +0 -0
  379. /package/{dist → packages/windows/dist}/taskscheduler.d.ts +0 -0
  380. /package/{dist → packages/windows/dist}/taskscheduler.d.ts.map +0 -0
  381. /package/{dist → packages/windows/dist}/taskscheduler.js +0 -0
  382. /package/{dist → packages/windows/dist}/taskscheduler.js.map +0 -0
  383. /package/{dist → packages/windows/dist}/uac.d.ts +0 -0
  384. /package/{dist → packages/windows/dist}/uac.d.ts.map +0 -0
  385. /package/{dist → packages/windows/dist}/uac.js +0 -0
  386. /package/{dist → packages/windows/dist}/uac.js.map +0 -0
  387. /package/{dist → packages/windows/dist}/usb.d.ts +0 -0
  388. /package/{dist → packages/windows/dist}/usb.d.ts.map +0 -0
  389. /package/{dist → packages/windows/dist}/usb.js +0 -0
  390. /package/{dist → packages/windows/dist}/usb.js.map +0 -0
  391. /package/{dist → packages/windows/dist}/users.d.ts +0 -0
  392. /package/{dist → packages/windows/dist}/users.d.ts.map +0 -0
  393. /package/{dist → packages/windows/dist}/users.js +0 -0
  394. /package/{dist → packages/windows/dist}/users.js.map +0 -0
  395. /package/{dist → packages/windows/dist}/windowsupdate.d.ts +0 -0
  396. /package/{dist → packages/windows/dist}/windowsupdate.d.ts.map +0 -0
  397. /package/{dist → packages/windows/dist}/windowsupdate.js +0 -0
  398. /package/{dist → packages/windows/dist}/windowsupdate.js.map +0 -0
@@ -0,0 +1,1398 @@
1
+ import { exec, execSync } from "child_process";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import util from "util";
5
+
6
+ const execAsync = util.promisify(exec);
7
+
8
+ interface StorageInfo {
9
+ device: string;
10
+ size: string;
11
+ used: string;
12
+ available: string;
13
+ use: string;
14
+ mount: string;
15
+ }
16
+
17
+ type PowerCommand = "shutdown" | "reboot" | "bootloader" | "fastbootd" | string;
18
+
19
+ interface PowerResult {
20
+ success: boolean;
21
+ command: string;
22
+ error?: string;
23
+ }
24
+
25
+ type DeviceState = "device" | "offline" | "unauthorized" | "unknown";
26
+
27
+ interface DeviceInfo {
28
+ serial: string;
29
+ state: DeviceState;
30
+ }
31
+
32
+ class Sync {
33
+ static getLocale(
34
+ serial: string
35
+ ): { language: string; country: string } | null {
36
+ try {
37
+ const adb = this.getAdbPath();
38
+ const lang = execSync(
39
+ `"${adb}" -s ${serial} shell getprop persist.sys.locale`,
40
+ { encoding: "utf8" }
41
+ ).trim();
42
+ if (!lang.includes("-")) return null;
43
+ const [language, country] = lang.split("-");
44
+ return { language, country };
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+
50
+ static clearAppData(serial: string, packageName: string) {
51
+ try {
52
+ const adb = this.getAdbPath();
53
+ const cmd = `"${adb}" -s ${serial} shell pm clear ${packageName}`;
54
+ const output = execSync(cmd, { encoding: "utf8" });
55
+ const success = /Success/i.test(output);
56
+ return { success, command: cmd, output: output.trim() };
57
+ } catch (error: any) {
58
+ return { success: false, command: "clearAppData", error: error.message };
59
+ }
60
+ }
61
+
62
+ static getUptime(serial: string): string | null {
63
+ try {
64
+ const adb = this.getAdbPath();
65
+ const output = execSync(`"${adb}" -s ${serial} shell uptime`, {
66
+ encoding: "utf8",
67
+ });
68
+ return output.trim();
69
+ } catch {
70
+ return null;
71
+ }
72
+ }
73
+
74
+ static isRooted(serial: string): boolean {
75
+ try {
76
+ const adb = this.getAdbPath();
77
+ const output = execSync(`"${adb}" -s ${serial} shell which su`, {
78
+ encoding: "utf8",
79
+ });
80
+ return output.trim().length > 0;
81
+ } catch {
82
+ return false;
83
+ }
84
+ }
85
+
86
+ static getCpuUsage(serial: string): string | null {
87
+ try {
88
+ const adb = this.getAdbPath();
89
+ const output = execSync(`"${adb}" -s ${serial} shell top -n 1 -b`, {
90
+ encoding: "utf8",
91
+ });
92
+ const cpuMatch = output.match(/CPU usage:\s+(.*)%/i);
93
+ return cpuMatch ? cpuMatch[1].trim() + "%" : null;
94
+ } catch {
95
+ return null;
96
+ }
97
+ }
98
+
99
+ static getTopApp(
100
+ serial: string
101
+ ): { package: string; activity: string } | null {
102
+ try {
103
+ const adb = this.getAdbPath();
104
+ const output = execSync(
105
+ `"${adb}" -s ${serial} shell dumpsys window windows | grep -E 'mCurrentFocus'`,
106
+ { encoding: "utf8" }
107
+ );
108
+ const match = output.match(/Window\{.*\s([^\s\/]+)\/([^\s}]+)\}/);
109
+ if (!match) return null;
110
+ return { package: match[1], activity: match[2] };
111
+ } catch {
112
+ return null;
113
+ }
114
+ }
115
+
116
+ static killProcess(serial: string, pid: number) {
117
+ try {
118
+ const adb = this.getAdbPath();
119
+ const cmd = `"${adb}" -s ${serial} shell kill ${pid}`;
120
+ execSync(cmd);
121
+ return { success: true, command: cmd };
122
+ } catch (error: any) {
123
+ return { success: false, command: "kill", error: error.message };
124
+ }
125
+ }
126
+
127
+ static getProcesses(
128
+ serial: string
129
+ ): Array<{ pid: number; user: string; name: string }> | null {
130
+ try {
131
+ const adb = this.getAdbPath();
132
+ const cmd = `"${adb}" -s ${serial} shell ps -A`;
133
+ const output = execSync(cmd, { encoding: "utf8" });
134
+ const lines = output.trim().split("\n").slice(1);
135
+
136
+ return lines.map((line) => {
137
+ const parts = line.trim().split(/\s+/);
138
+ return {
139
+ user: parts[0],
140
+ pid: Number(parts[1]),
141
+ name: parts.slice(-1)[0],
142
+ };
143
+ });
144
+ } catch {
145
+ return null;
146
+ }
147
+ }
148
+
149
+ static getNetworkInfo(serial: string): Record<string, string> | null {
150
+ try {
151
+ const adb = this.getAdbPath();
152
+ const cmd = `"${adb}" -s ${serial} shell ip addr show wlan0`;
153
+ const output = execSync(cmd, { encoding: "utf8" });
154
+ const info: Record<string, string> = {};
155
+
156
+ const ipMatch = output.match(/inet\s+(\d+\.\d+\.\d+\.\d+)/);
157
+ if (ipMatch) info["ip_address"] = ipMatch[1];
158
+
159
+ const macMatch = output.match(/link\/ether\s+([0-9a-f:]+)/i);
160
+ if (macMatch) info["mac_address"] = macMatch[1];
161
+
162
+ info["interface"] = "wlan0";
163
+ return info;
164
+ } catch {
165
+ return null;
166
+ }
167
+ }
168
+
169
+ static getStorageInfo(serial: string): StorageInfo[] | null {
170
+ try {
171
+ const adb = this.getAdbPath();
172
+ const cmd = `"${adb}" -s ${serial} shell df -h`;
173
+ const stdout = execSync(cmd, { encoding: "utf8" });
174
+
175
+ const lines = stdout.trim().split("\n");
176
+
177
+ if (lines.length < 2) return null;
178
+
179
+ const data: StorageInfo[] = lines.slice(1).map((line) => {
180
+ const parts = line.split(/\s+/);
181
+ return {
182
+ device: parts[0] || "",
183
+ size: parts[1] || "",
184
+ used: parts[2] || "",
185
+ available: parts[3] || "",
186
+ use: parts[4] || "",
187
+ mount: parts[5] || "",
188
+ };
189
+ });
190
+
191
+ return data.length ? data : null;
192
+ } catch {
193
+ return null;
194
+ }
195
+ }
196
+
197
+ static getMemoryInfo(serial: string): Record<string, string> | null {
198
+ try {
199
+ const adb = this.getAdbPath();
200
+ const cmd = `"${adb}" -s ${serial} shell cat /proc/meminfo`;
201
+ const stdout = execSync(cmd, { encoding: "utf8" });
202
+
203
+ const memInfo: Record<string, string> = {};
204
+ stdout.split("\n").forEach((line) => {
205
+ const parts = line.split(":");
206
+ if (parts.length === 2) {
207
+ memInfo[parts[0].trim()] = parts[1].trim();
208
+ }
209
+ });
210
+
211
+ return Object.keys(memInfo).length ? memInfo : null;
212
+ } catch {
213
+ return null;
214
+ }
215
+ }
216
+
217
+ public static exec(
218
+ serial: string,
219
+ command: string
220
+ ): { success: boolean; command: string; output?: string; error?: string } {
221
+ try {
222
+ const __filename = fileURLToPath(import.meta.url);
223
+ const __dirname = path.dirname(__filename);
224
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
225
+
226
+ const cmd = `"${adbPath}" -s ${serial} ${command}`;
227
+ const output = execSync(cmd, { encoding: "utf8" }).toString();
228
+
229
+ return { success: true, command: cmd, output: output.trim() };
230
+ } catch (error: any) {
231
+ return { success: false, command: command, error: error.message };
232
+ }
233
+ }
234
+
235
+ static setScreenBrightness(serial: string, level: number) {
236
+ try {
237
+ const adb = this.getAdbPath();
238
+ const cmd = `"${adb}" -s ${serial} shell settings put system screen_brightness ${level}`;
239
+ execSync(cmd);
240
+ return { success: true, command: cmd };
241
+ } catch (error: any) {
242
+ return {
243
+ success: false,
244
+ command: "setScreenBrightness",
245
+ error: error.message,
246
+ };
247
+ }
248
+ }
249
+
250
+ static getScreenBrightness(serial: string) {
251
+ try {
252
+ const adb = this.getAdbPath();
253
+ const output = execSync(
254
+ `"${adb}" -s ${serial} shell settings get system screen_brightness`,
255
+ { encoding: "utf8" }
256
+ );
257
+ return Number(output.trim());
258
+ } catch {
259
+ return null;
260
+ }
261
+ }
262
+
263
+ static getScreenResolution(
264
+ serial: string
265
+ ): { width: number; height: number } | null {
266
+ try {
267
+ const adb = this.getAdbPath();
268
+ const output = execSync(`"${adb}" -s ${serial} shell wm size`, {
269
+ encoding: "utf8",
270
+ })
271
+ .replace("Physical size: ", "")
272
+ .trim();
273
+
274
+ const match = output.match(/^(\d+)x(\d+)$/);
275
+ if (!match) return null;
276
+
277
+ return { width: Number(match[1]), height: Number(match[2]) };
278
+ } catch {
279
+ return null;
280
+ }
281
+ }
282
+
283
+ static screenshot(
284
+ serial: string,
285
+ remotePath: string
286
+ ): { success: boolean; command: string; error?: string } {
287
+ try {
288
+ const __filename = fileURLToPath(import.meta.url);
289
+ const __dirname = path.dirname(__filename);
290
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
291
+
292
+ const cmd = `"${adbPath}" -s ${serial} shell screencap -p "${remotePath}"`;
293
+
294
+ execSync(cmd, { stdio: "ignore" });
295
+
296
+ return { success: true, command: cmd };
297
+ } catch (error: any) {
298
+ return { success: false, command: "screenshot", error: error.message };
299
+ }
300
+ }
301
+
302
+ static uninstallPackage(
303
+ serial: string,
304
+ packageName: string
305
+ ): { success: boolean; command: string; error?: string } {
306
+ try {
307
+ const __filename = fileURLToPath(import.meta.url);
308
+ const __dirname = path.dirname(__filename);
309
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
310
+
311
+ const cmd = `"${adbPath}" -s ${serial} shell pm uninstall "${packageName}"`;
312
+
313
+ const output = execSync(cmd, {
314
+ encoding: "utf8",
315
+ stdio: "pipe",
316
+ }).toString();
317
+
318
+ const success = /Success/i.test(output);
319
+
320
+ return {
321
+ success,
322
+ command: cmd,
323
+ error: success ? undefined : output.trim(),
324
+ };
325
+ } catch (error: any) {
326
+ return {
327
+ success: false,
328
+ command: "uninstall",
329
+ error: error.message,
330
+ };
331
+ }
332
+ }
333
+
334
+ static getBatteryInfo(serial: string): Record<string, string> | null {
335
+ try {
336
+ const adb = this.getAdbPath();
337
+ const output = execSync(`"${adb}" -s ${serial} shell dumpsys battery`, {
338
+ encoding: "utf8",
339
+ });
340
+ const info: Record<string, string> = {};
341
+
342
+ output.split("\n").forEach((line) => {
343
+ const match = line.trim().match(/^(\S+):\s*(.+)$/);
344
+ if (match) info[match[1]] = match[2];
345
+ });
346
+
347
+ return info;
348
+ } catch {
349
+ return null;
350
+ }
351
+ }
352
+
353
+ static getAdbPath(): string {
354
+ const __filename = fileURLToPath(import.meta.url);
355
+ const __dirname = path.dirname(__filename);
356
+ return path.join(__dirname, "dependencies", "adb.exe");
357
+ }
358
+
359
+ static getPackages(serial: string, systemOnly = false): string[] {
360
+ try {
361
+ const adb = this.getAdbPath();
362
+ const flag = systemOnly ? "-s" : "";
363
+ const output = execSync(
364
+ `"${adb}" -s ${serial} shell pm list packages ${flag}`,
365
+ {
366
+ encoding: "utf8",
367
+ }
368
+ );
369
+ return output
370
+ .split("\n")
371
+ .map((l) => l.replace("package:", "").trim())
372
+ .filter(Boolean);
373
+ } catch {
374
+ return [];
375
+ }
376
+ }
377
+
378
+ static pushFile(serial: string, localPath: string, remotePath: string) {
379
+ try {
380
+ const adb = this.getAdbPath();
381
+ const cmd = `"${adb}" -s ${serial} push "${localPath}" "${remotePath}"`;
382
+ execSync(cmd, { stdio: "pipe" });
383
+ return { success: true, command: cmd };
384
+ } catch (error: any) {
385
+ return { success: false, command: "push", error: error.message };
386
+ }
387
+ }
388
+
389
+ static pullFile(serial: string, remotePath: string, localPath: string) {
390
+ try {
391
+ const adb = this.getAdbPath();
392
+ const cmd = `"${adb}" -s ${serial} pull "${remotePath}" "${localPath}"`;
393
+ execSync(cmd, { stdio: "pipe" });
394
+ return { success: true, command: cmd };
395
+ } catch (error: any) {
396
+ return { success: false, command: "pull", error: error.message };
397
+ }
398
+ }
399
+
400
+ static installApk(
401
+ serial: string,
402
+ apkPath: string,
403
+ ...args: string[]
404
+ ): { success: boolean; command: string; error?: string } {
405
+ try {
406
+ const __filename = fileURLToPath(import.meta.url);
407
+ const __dirname = path.dirname(__filename);
408
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
409
+
410
+ // Construir el comando con argumentos extra
411
+ const params = args.length ? args.join(" ") : "";
412
+ const cmd = `"${adbPath}" -s ${serial} install ${params} "${apkPath}"`;
413
+
414
+ const output = execSync(cmd, { encoding: "utf8", stdio: "pipe" });
415
+ const success = /Success/i.test(output);
416
+
417
+ return {
418
+ success,
419
+ command: cmd,
420
+ error: success ? undefined : output.trim(),
421
+ };
422
+ } catch (error: any) {
423
+ return {
424
+ success: false,
425
+ command: "install",
426
+ error: error.message,
427
+ };
428
+ }
429
+ }
430
+
431
+ static getModel(serial: string): string | null {
432
+ const props = this.getDeviceProperties(serial);
433
+ return (props?.["ro.product.model"] as string) || null;
434
+ }
435
+
436
+ static getBrand(serial: string): string | null {
437
+ const props = this.getDeviceProperties(serial);
438
+ return (props?.["ro.product.brand"] as string) || null;
439
+ }
440
+
441
+ static getAndroidVersion(serial: string): string | null {
442
+ const props = this.getDeviceProperties(serial);
443
+ return (props?.["ro.build.version.release"] as string) || null;
444
+ }
445
+
446
+ static getSdkVersion(serial: string): string | null {
447
+ const props = this.getDeviceProperties(serial);
448
+ return (props?.["ro.build.version.sdk"] as string) || null;
449
+ }
450
+
451
+ static getDeviceProperties(
452
+ serial: string
453
+ ): Record<string, boolean | number | string | null> | null {
454
+ try {
455
+ const __filename = fileURLToPath(import.meta.url);
456
+ const __dirname = path.dirname(__filename);
457
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
458
+
459
+ const stdout = execSync(`"${adbPath}" -s ${serial} shell getprop`, {
460
+ encoding: "utf8",
461
+ });
462
+
463
+ const props: Record<string, boolean | number | string | null> = {};
464
+
465
+ stdout.split("\n").forEach((line) => {
466
+ line = line.trim();
467
+ if (!line) return;
468
+
469
+ const match = line.match(/^\[([^\]]+)\]: \[(.*)\]$/);
470
+ if (match) {
471
+ const key = match[1].trim();
472
+ let value: string | boolean | number | null = match[2].trim();
473
+
474
+ const lower = value.toLowerCase();
475
+
476
+ // Booleanos
477
+ if (["true", "yes", "1"].includes(lower)) {
478
+ value = true;
479
+ } else if (["false", "no", "0"].includes(lower)) {
480
+ value = false;
481
+ }
482
+ // Números enteros o flotantes
483
+ else if (!isNaN(Number(value)) && value !== "") {
484
+ value = Number(value);
485
+ }
486
+ // String vacío → null
487
+ else if (value === "") {
488
+ value = null;
489
+ }
490
+
491
+ props[key] = value;
492
+ }
493
+ });
494
+
495
+ return Object.keys(props).length ? props : null;
496
+ } catch {
497
+ return null;
498
+ }
499
+ }
500
+
501
+ static power(
502
+ serial: string,
503
+ command: PowerCommand,
504
+ customCommand?: string
505
+ ): PowerResult {
506
+ try {
507
+ const __filename = fileURLToPath(import.meta.url);
508
+ const __dirname = path.dirname(__filename);
509
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
510
+
511
+ let cmd = `"${adbPath}" -s ${serial} `;
512
+
513
+ const defaultCommands: Record<string, string> = {
514
+ shutdown: "shell reboot -p",
515
+ reboot: "reboot",
516
+ bootloader: "reboot bootloader",
517
+ fastbootd: "reboot fastboot",
518
+ };
519
+
520
+ cmd += customCommand ?? defaultCommands[command] ?? command;
521
+
522
+ execSync(cmd, { stdio: "ignore" });
523
+ return { success: true, command: cmd };
524
+ } catch (error: any) {
525
+ return { success: false, command: String(command), error: error.message };
526
+ }
527
+ }
528
+
529
+ static listDevices(): DeviceInfo[] {
530
+ try {
531
+ const __filename = fileURLToPath(import.meta.url);
532
+ const __dirname = path.dirname(__filename);
533
+
534
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
535
+
536
+ const output = execSync(`"${adbPath}" devices`, { encoding: "utf8" });
537
+
538
+ const lines = output
539
+ .split("\n")
540
+ .map((line) => line.trim())
541
+ .filter((line) => line && !line.startsWith("*"));
542
+
543
+ const devices: DeviceInfo[] = [];
544
+
545
+ for (const line of lines.slice(1)) {
546
+ const [serial, stateRaw] = line.split("\t");
547
+ if (!serial || !stateRaw) continue;
548
+
549
+ const state = ["device", "offline", "unauthorized"].includes(stateRaw)
550
+ ? (stateRaw as DeviceState)
551
+ : "unknown";
552
+
553
+ devices.push({ serial, state });
554
+ }
555
+
556
+ return devices;
557
+ } catch {
558
+ return [];
559
+ }
560
+ }
561
+
562
+ static enableDeveloperMode(serial: string) {
563
+ try {
564
+ const adb = this.getAdbPath();
565
+ execSync(
566
+ `"${adb}" -s ${serial} shell settings put global development_settings_enabled 1`
567
+ );
568
+ execSync(`"${adb}" -s ${serial} shell settings put global adb_enabled 1`);
569
+ return { success: true };
570
+ } catch (error: any) {
571
+ return { success: false, error: error.message };
572
+ }
573
+ }
574
+ }
575
+
576
+ class Async {
577
+ static async enableDeveloperMode(serial: string) {
578
+ try {
579
+ const adb = Sync.getAdbPath();
580
+
581
+ await execAsync(
582
+ `"${adb}" -s ${serial} shell settings put global development_settings_enabled 1`
583
+ );
584
+
585
+ await execAsync(
586
+ `"${adb}" -s ${serial} shell settings put global adb_enabled 1`
587
+ );
588
+
589
+ return { success: true };
590
+ } catch (error: any) {
591
+ return { success: false, error: error.message };
592
+ }
593
+ }
594
+
595
+ static async getLocale(
596
+ serial: string
597
+ ): Promise<{ language: string; country: string } | null> {
598
+ return new Promise((resolve) => {
599
+ try {
600
+ const adb = Sync.getAdbPath();
601
+ const cmd = `"${adb}" -s ${serial} shell getprop persist.sys.locale`;
602
+
603
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
604
+ if (error || !stdout) return resolve(null);
605
+
606
+ const lang = stdout.trim();
607
+ if (!lang.includes("-")) return resolve(null);
608
+
609
+ const [language, country] = lang.split("-");
610
+ resolve({ language, country });
611
+ });
612
+ } catch {
613
+ resolve(null);
614
+ }
615
+ });
616
+ }
617
+
618
+ static async clearAppData(
619
+ serial: string,
620
+ packageName: string
621
+ ): Promise<{
622
+ success: boolean;
623
+ command: string;
624
+ output?: string;
625
+ error?: string;
626
+ }> {
627
+ return new Promise((resolve) => {
628
+ try {
629
+ const adb = Sync.getAdbPath();
630
+ const cmd = `"${adb}" -s ${serial} shell pm clear ${packageName}`;
631
+
632
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
633
+ const output = (stdout + stderr).trim();
634
+ const success = /Success/i.test(output);
635
+
636
+ if (error) {
637
+ resolve({ success: false, command: cmd, error: error.message });
638
+ } else {
639
+ resolve({ success, command: cmd, output });
640
+ }
641
+ });
642
+ } catch (error: any) {
643
+ resolve({
644
+ success: false,
645
+ command: "clearAppData",
646
+ error: error.message,
647
+ });
648
+ }
649
+ });
650
+ }
651
+
652
+ static async getUptime(serial: string): Promise<string | null> {
653
+ return new Promise((resolve) => {
654
+ try {
655
+ const adb = Sync.getAdbPath();
656
+ const cmd = `"${adb}" -s ${serial} shell uptime`;
657
+
658
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
659
+ if (error || !stdout) return resolve(null);
660
+ resolve(stdout.trim());
661
+ });
662
+ } catch {
663
+ resolve(null);
664
+ }
665
+ });
666
+ }
667
+
668
+ static async isRooted(serial: string): Promise<boolean> {
669
+ return new Promise((resolve) => {
670
+ try {
671
+ const adb = Sync.getAdbPath();
672
+ const cmd = `"${adb}" -s ${serial} shell which su`;
673
+
674
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
675
+ if (error || !stdout) return resolve(false);
676
+ resolve(stdout.trim().length > 0);
677
+ });
678
+ } catch {
679
+ resolve(false);
680
+ }
681
+ });
682
+ }
683
+
684
+ static async getCpuUsage(serial: string): Promise<string | null> {
685
+ return new Promise((resolve) => {
686
+ try {
687
+ const adb = Sync.getAdbPath();
688
+ const cmd = `"${adb}" -s ${serial} shell top -n 1 -b`;
689
+
690
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
691
+ if (error || !stdout) return resolve(null);
692
+
693
+ const match = stdout.match(/CPU usage:\s+(.*)%/i);
694
+ resolve(match ? match[1].trim() + "%" : null);
695
+ });
696
+ } catch {
697
+ resolve(null);
698
+ }
699
+ });
700
+ }
701
+
702
+ static async getTopApp(
703
+ serial: string
704
+ ): Promise<{ package: string; activity: string } | null> {
705
+ return new Promise((resolve) => {
706
+ try {
707
+ const adb = Sync.getAdbPath();
708
+ const cmd = `"${adb}" -s ${serial} shell dumpsys window windows | grep -E 'mCurrentFocus'`;
709
+
710
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
711
+ if (error || !stdout) return resolve(null);
712
+
713
+ const match = stdout.match(/Window\{.*\s([^\s\/]+)\/([^\s}]+)\}/);
714
+ resolve(match ? { package: match[1], activity: match[2] } : null);
715
+ });
716
+ } catch {
717
+ resolve(null);
718
+ }
719
+ });
720
+ }
721
+
722
+ static async killProcess(
723
+ serial: string,
724
+ pid: number
725
+ ): Promise<{ success: boolean; command: string; error?: string }> {
726
+ return new Promise((resolve) => {
727
+ try {
728
+ const adb = Sync.getAdbPath();
729
+ const cmd = `"${adb}" -s ${serial} shell kill ${pid}`;
730
+
731
+ exec(cmd, { encoding: "utf8" }, (error) => {
732
+ resolve({ success: !error, command: cmd, error: error?.message });
733
+ });
734
+ } catch (error: any) {
735
+ resolve({ success: false, command: "kill", error: error.message });
736
+ }
737
+ });
738
+ }
739
+
740
+ static async getProcesses(
741
+ serial: string
742
+ ): Promise<Array<{ pid: number; user: string; name: string }> | null> {
743
+ return new Promise((resolve) => {
744
+ try {
745
+ const adb = Sync.getAdbPath();
746
+ const cmd = `"${adb}" -s ${serial} shell ps -A`;
747
+
748
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
749
+ if (error || !stdout) return resolve(null);
750
+
751
+ const lines = stdout.trim().split("\n").slice(1);
752
+ const processes = lines.map((line) => {
753
+ const parts = line.trim().split(/\s+/);
754
+ return {
755
+ user: parts[0],
756
+ pid: Number(parts[1]),
757
+ name: parts.slice(-1)[0],
758
+ };
759
+ });
760
+
761
+ resolve(processes.length ? processes : null);
762
+ });
763
+ } catch {
764
+ resolve(null);
765
+ }
766
+ });
767
+ }
768
+
769
+ static async getNetworkInfo(
770
+ serial: string
771
+ ): Promise<Record<string, string> | null> {
772
+ return new Promise((resolve) => {
773
+ try {
774
+ const adb = Sync.getAdbPath();
775
+ const cmd = `"${adb}" -s ${serial} shell ip addr show wlan0`;
776
+
777
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
778
+ if (error || !stdout) return resolve(null);
779
+
780
+ const info: Record<string, string> = {};
781
+ const ipMatch = stdout.match(/inet\s+(\d+\.\d+\.\d+\.\d+)/);
782
+ const macMatch = stdout.match(/link\/ether\s+([0-9a-f:]+)/i);
783
+
784
+ if (ipMatch) info["ip_address"] = ipMatch[1];
785
+ if (macMatch) info["mac_address"] = macMatch[1];
786
+ info["interface"] = "wlan0";
787
+
788
+ resolve(info);
789
+ });
790
+ } catch {
791
+ resolve(null);
792
+ }
793
+ });
794
+ }
795
+
796
+ static async getMemoryInfo(serial: string) {
797
+ return new Promise((resolve) => {
798
+ try {
799
+ const adb = Sync.getAdbPath();
800
+ const cmd = `"${adb}" -s ${serial} shell cat /proc/meminfo`;
801
+
802
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
803
+ if (error || (!stdout && !stderr)) return resolve(null);
804
+
805
+ const output = (stdout + stderr).trim();
806
+ if (!output) return resolve(null);
807
+
808
+ const memInfo: Record<string, string> = {};
809
+ output.split(/\r?\n/).forEach((line) => {
810
+ const parts = line.split(":");
811
+ if (parts.length === 2)
812
+ memInfo[parts[0].trim()] = parts[1].trim().replace(/\s+/g, " ");
813
+ });
814
+
815
+ resolve(Object.keys(memInfo).length ? memInfo : null);
816
+ });
817
+ } catch (err) {
818
+ resolve(null);
819
+ }
820
+ });
821
+ }
822
+
823
+ static async getStorageInfo(serial: string): Promise<StorageInfo[] | null> {
824
+ return new Promise((resolve) => {
825
+ try {
826
+ const adb = ADB.Sync.getAdbPath(); // uso correcto del path
827
+ const cmd = `"${adb}" -s ${serial} shell df -h`;
828
+
829
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
830
+ if (error && !stdout && !stderr) return resolve(null);
831
+
832
+ const output = (stdout + stderr).trim();
833
+
834
+ const lines = output.split("\n");
835
+ if (lines.length < 2) return resolve(null);
836
+
837
+ const data: StorageInfo[] = lines.slice(1).map((line) => {
838
+ const parts = line.trim().split(/\s+/);
839
+ return {
840
+ device: parts[0] || "",
841
+ size: parts[1] || "",
842
+ used: parts[2] || "",
843
+ available: parts[3] || "",
844
+ use: parts[4] || "",
845
+ mount: parts[5] || "",
846
+ };
847
+ });
848
+
849
+ resolve(data.length ? data : null);
850
+ });
851
+ } catch {
852
+ resolve(null);
853
+ }
854
+ });
855
+ }
856
+
857
+ public static exec(
858
+ serial: string,
859
+ command: string
860
+ ): Promise<{
861
+ success: boolean;
862
+ command: string;
863
+ output?: string;
864
+ error?: string;
865
+ }> {
866
+ return new Promise((resolve) => {
867
+ try {
868
+ const __filename = fileURLToPath(import.meta.url);
869
+ const __dirname = path.dirname(__filename);
870
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
871
+
872
+ const cmd = `"${adbPath}" -s ${serial} ${command}`;
873
+
874
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
875
+ resolve({
876
+ success: !error,
877
+ command: cmd,
878
+ output: stdout?.trim(),
879
+ error: error ? stderr?.trim() || error.message : undefined,
880
+ });
881
+ });
882
+ } catch (error: any) {
883
+ resolve({
884
+ success: false,
885
+ command: command,
886
+ error: error.message,
887
+ });
888
+ }
889
+ });
890
+ }
891
+
892
+ static async setScreenBrightness(
893
+ serial: string,
894
+ level: number
895
+ ): Promise<{ success: boolean; command: string; error?: string }> {
896
+ return new Promise((resolve) => {
897
+ try {
898
+ const adb = Sync.getAdbPath();
899
+ const cmd = `"${adb}" -s ${serial} shell settings put system screen_brightness ${level}`;
900
+
901
+ exec(cmd, { encoding: "utf8" }, (error) => {
902
+ if (error) {
903
+ resolve({
904
+ success: false,
905
+ command: "setScreenBrightness",
906
+ error: error.message,
907
+ });
908
+ return;
909
+ }
910
+ resolve({ success: true, command: cmd });
911
+ });
912
+ } catch (error: any) {
913
+ resolve({
914
+ success: false,
915
+ command: "setScreenBrightness",
916
+ error: error.message,
917
+ });
918
+ }
919
+ });
920
+ }
921
+
922
+ static async getScreenBrightness(serial: string): Promise<number | null> {
923
+ return new Promise((resolve) => {
924
+ try {
925
+ const adb = Sync.getAdbPath();
926
+ const cmd = `"${adb}" -s ${serial} shell settings get system screen_brightness`;
927
+
928
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
929
+ if (error || !stdout) {
930
+ resolve(null);
931
+ return;
932
+ }
933
+ resolve(Number(stdout.trim()));
934
+ });
935
+ } catch {
936
+ resolve(null);
937
+ }
938
+ });
939
+ }
940
+
941
+ static async getScreenResolution(
942
+ serial: string
943
+ ): Promise<{ width: number; height: number } | null> {
944
+ return new Promise((resolve) => {
945
+ try {
946
+ const adb = Sync.getAdbPath();
947
+ const cmd = `"${adb}" -s ${serial} shell wm size`;
948
+
949
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
950
+ if (error || !stdout) {
951
+ resolve(null);
952
+ return;
953
+ }
954
+
955
+ const output = stdout.replace("Physical size: ", "").trim();
956
+ const match = output.match(/^(\d+)x(\d+)$/);
957
+
958
+ if (!match) {
959
+ resolve(null);
960
+ return;
961
+ }
962
+
963
+ resolve({ width: Number(match[1]), height: Number(match[2]) });
964
+ });
965
+ } catch {
966
+ resolve(null);
967
+ }
968
+ });
969
+ }
970
+
971
+ static async screenshot(serial: string, remotePath: string) {
972
+ return new Promise<PowerResult>((resolve) => {
973
+ try {
974
+ const adb = Sync.getAdbPath();
975
+ const cmd = `"${adb}" -s ${serial} shell screencap -p "${remotePath}"`;
976
+
977
+ exec(cmd, { encoding: "utf8" }, (error) => {
978
+ resolve({ success: !error, command: cmd, error: error?.message });
979
+ });
980
+ } catch (error: any) {
981
+ resolve({
982
+ success: false,
983
+ command: "screenshot",
984
+ error: error.message,
985
+ });
986
+ }
987
+ });
988
+ }
989
+
990
+ static async uninstallPackage(
991
+ serial: string,
992
+ packageName: string
993
+ ): Promise<{ success: boolean; command: string; error?: string }> {
994
+ return new Promise((resolve) => {
995
+ try {
996
+ const __filename = fileURLToPath(import.meta.url);
997
+ const __dirname = path.dirname(__filename);
998
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
999
+
1000
+ const cmd = `"${adbPath}" -s ${serial} shell pm uninstall "${packageName}"`;
1001
+
1002
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
1003
+ if (error) {
1004
+ resolve({
1005
+ success: false,
1006
+ command: cmd,
1007
+ error: stderr.trim() || error.message,
1008
+ });
1009
+ return;
1010
+ }
1011
+
1012
+ const output = (stdout + stderr).trim();
1013
+ const success = /Success/i.test(output);
1014
+
1015
+ resolve({
1016
+ success,
1017
+ command: cmd,
1018
+ error: success ? undefined : output,
1019
+ });
1020
+ });
1021
+ } catch (error: any) {
1022
+ resolve({
1023
+ success: false,
1024
+ command: "uninstall",
1025
+ error: error.message,
1026
+ });
1027
+ }
1028
+ });
1029
+ }
1030
+
1031
+ static async getBatteryInfo(
1032
+ serial: string
1033
+ ): Promise<Record<string, string | number | boolean> | null> {
1034
+ return new Promise((resolve) => {
1035
+ try {
1036
+ const __filename = fileURLToPath(import.meta.url);
1037
+ const __dirname = path.dirname(__filename);
1038
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1039
+
1040
+ const cmd = `"${adbPath}" -s ${serial} shell dumpsys battery`;
1041
+
1042
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
1043
+ if (error || !stdout) {
1044
+ resolve(null);
1045
+ return;
1046
+ }
1047
+
1048
+ const info: Record<string, string | number | boolean> = {};
1049
+
1050
+ stdout.split("\n").forEach((line) => {
1051
+ const parts = line.trim().split(": ");
1052
+ if (parts.length === 2) {
1053
+ const key = parts[0].trim();
1054
+ let value: string | number | boolean = parts[1].trim();
1055
+
1056
+ const lower = value.toLowerCase();
1057
+ if (["true", "yes", "1"].includes(lower)) value = true;
1058
+ else if (["false", "no", "0"].includes(lower)) value = false;
1059
+ else if (!isNaN(Number(value))) value = Number(value);
1060
+
1061
+ info[key] = value;
1062
+ }
1063
+ });
1064
+
1065
+ resolve(Object.keys(info).length ? info : null);
1066
+ });
1067
+ } catch {
1068
+ resolve(null);
1069
+ }
1070
+ });
1071
+ }
1072
+
1073
+ static async getPackages(
1074
+ serial: string,
1075
+ systemOnly = false
1076
+ ): Promise<string[]> {
1077
+ return new Promise((resolve) => {
1078
+ try {
1079
+ const __filename = fileURLToPath(import.meta.url);
1080
+ const __dirname = path.dirname(__filename);
1081
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1082
+
1083
+ const flag = systemOnly ? "-s" : "";
1084
+ const cmd = `"${adbPath}" -s ${serial} shell pm list packages ${flag}`;
1085
+
1086
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
1087
+ if (error || !stdout) {
1088
+ resolve([]);
1089
+ return;
1090
+ }
1091
+
1092
+ const packages = stdout
1093
+ .split("\n")
1094
+ .map((l) => l.replace("package:", "").trim())
1095
+ .filter(Boolean);
1096
+
1097
+ resolve(packages);
1098
+ });
1099
+ } catch {
1100
+ resolve([]);
1101
+ }
1102
+ });
1103
+ }
1104
+
1105
+ static async pushFile(
1106
+ serial: string,
1107
+ localPath: string,
1108
+ remotePath: string,
1109
+ ...args: string[]
1110
+ ): Promise<{ success: boolean; command: string; error?: string }> {
1111
+ return new Promise((resolve) => {
1112
+ try {
1113
+ const __filename = fileURLToPath(import.meta.url);
1114
+ const __dirname = path.dirname(__filename);
1115
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1116
+
1117
+ const params = args.length ? args.join(" ") : "";
1118
+ const cmd = `"${adbPath}" -s ${serial} push ${params} "${localPath}" "${remotePath}"`;
1119
+
1120
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
1121
+ if (error) {
1122
+ resolve({
1123
+ success: false,
1124
+ command: cmd,
1125
+ error: stderr.trim() || error.message,
1126
+ });
1127
+ return;
1128
+ }
1129
+
1130
+ const output = (stdout + stderr).trim();
1131
+ const success =
1132
+ /[\d\s]+files? pushed/i.test(output) || /100%/i.test(output);
1133
+
1134
+ resolve({
1135
+ success,
1136
+ command: cmd,
1137
+ error: success ? undefined : output,
1138
+ });
1139
+ });
1140
+ } catch (error: any) {
1141
+ resolve({
1142
+ success: false,
1143
+ command: "push",
1144
+ error: error.message,
1145
+ });
1146
+ }
1147
+ });
1148
+ }
1149
+
1150
+ static async pullFile(
1151
+ serial: string,
1152
+ remotePath: string,
1153
+ localPath: string,
1154
+ ...args: string[]
1155
+ ): Promise<{ success: boolean; command: string; error?: string }> {
1156
+ return new Promise((resolve) => {
1157
+ try {
1158
+ const __filename = fileURLToPath(import.meta.url);
1159
+ const __dirname = path.dirname(__filename);
1160
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1161
+
1162
+ const params = args.length ? args.join(" ") : "";
1163
+ const cmd = `"${adbPath}" -s ${serial} pull ${params} "${remotePath}" "${localPath}"`;
1164
+
1165
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
1166
+ if (error) {
1167
+ resolve({
1168
+ success: false,
1169
+ command: cmd,
1170
+ error: stderr.trim() || error.message,
1171
+ });
1172
+ return;
1173
+ }
1174
+
1175
+ const output = (stdout + stderr).trim();
1176
+ const success =
1177
+ /[\d\s]+files? pulled/i.test(output) || /100%/i.test(output);
1178
+
1179
+ resolve({
1180
+ success,
1181
+ command: cmd,
1182
+ error: success ? undefined : output,
1183
+ });
1184
+ });
1185
+ } catch (error: any) {
1186
+ resolve({
1187
+ success: false,
1188
+ command: "pull",
1189
+ error: error.message,
1190
+ });
1191
+ }
1192
+ });
1193
+ }
1194
+
1195
+ static async installApk(
1196
+ serial: string,
1197
+ apkPath: string,
1198
+ ...args: string[]
1199
+ ): Promise<{ success: boolean; command: string; error?: string }> {
1200
+ return new Promise((resolve) => {
1201
+ try {
1202
+ const __filename = fileURLToPath(import.meta.url);
1203
+ const __dirname = path.dirname(__filename);
1204
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1205
+
1206
+ const params = args.length ? args.join(" ") : "";
1207
+ const cmd = `"${adbPath}" -s ${serial} install ${params} "${apkPath}"`;
1208
+
1209
+ exec(cmd, { encoding: "utf8" }, (error, stdout, stderr) => {
1210
+ if (error) {
1211
+ resolve({
1212
+ success: false,
1213
+ command: cmd,
1214
+ error: stderr.trim() || error.message,
1215
+ });
1216
+ return;
1217
+ }
1218
+
1219
+ const output = (stdout + stderr).trim();
1220
+ const success = /Success/i.test(output);
1221
+
1222
+ resolve({
1223
+ success,
1224
+ command: cmd,
1225
+ error: success ? undefined : output,
1226
+ });
1227
+ });
1228
+ } catch (error: any) {
1229
+ resolve({
1230
+ success: false,
1231
+ command: "install",
1232
+ error: error.message,
1233
+ });
1234
+ }
1235
+ });
1236
+ }
1237
+
1238
+ static async getModel(serial: string): Promise<string | null> {
1239
+ const props = await this.getDeviceProperties(serial);
1240
+ return (props?.["ro.product.model"] as string) || null;
1241
+ }
1242
+
1243
+ static async getBrand(serial: string): Promise<string | null> {
1244
+ const props = await this.getDeviceProperties(serial);
1245
+ return (props?.["ro.product.brand"] as string) || null;
1246
+ }
1247
+
1248
+ static async getAndroidVersion(serial: string): Promise<string | null> {
1249
+ const props = await this.getDeviceProperties(serial);
1250
+ return (props?.["ro.build.version.release"] as string) || null;
1251
+ }
1252
+
1253
+ static async getSdkVersion(serial: string): Promise<string | null> {
1254
+ const props = await this.getDeviceProperties(serial);
1255
+ return (props?.["ro.build.version.sdk"] as string) || null;
1256
+ }
1257
+
1258
+ static async getDeviceProperties(
1259
+ serial: string
1260
+ ): Promise<Record<string, boolean | number | string | null> | null> {
1261
+ return new Promise((resolve) => {
1262
+ try {
1263
+ const __filename = fileURLToPath(import.meta.url);
1264
+ const __dirname = path.dirname(__filename);
1265
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1266
+
1267
+ exec(
1268
+ `"${adbPath}" -s ${serial} shell getprop`,
1269
+ { encoding: "utf8" },
1270
+ (error, stdout) => {
1271
+ if (error) {
1272
+ resolve(null);
1273
+ return;
1274
+ }
1275
+
1276
+ const props: Record<string, boolean | number | string | null> = {};
1277
+
1278
+ stdout.split("\n").forEach((line) => {
1279
+ line = line.trim();
1280
+ if (!line) return;
1281
+
1282
+ const match = line.match(/^\[([^\]]+)\]: \[(.*)\]$/);
1283
+ if (match) {
1284
+ const key = match[1].trim();
1285
+ let value: string | boolean | number | null = match[2].trim();
1286
+
1287
+ const lower = value.toLowerCase();
1288
+
1289
+ if (["true", "yes", "1"].includes(lower)) {
1290
+ value = true;
1291
+ } else if (["false", "no", "0"].includes(lower)) {
1292
+ value = false;
1293
+ } else if (!isNaN(Number(value)) && value !== "") {
1294
+ value = Number(value);
1295
+ } else if (value === "") {
1296
+ value = null;
1297
+ }
1298
+
1299
+ props[key] = value;
1300
+ }
1301
+ });
1302
+
1303
+ resolve(Object.keys(props).length ? props : null);
1304
+ }
1305
+ );
1306
+ } catch {
1307
+ resolve(null);
1308
+ }
1309
+ });
1310
+ }
1311
+
1312
+ static async power(
1313
+ serial: string,
1314
+ command: PowerCommand,
1315
+ customCommand?: string
1316
+ ): Promise<PowerResult> {
1317
+ return new Promise((resolve) => {
1318
+ try {
1319
+ const __filename = fileURLToPath(import.meta.url);
1320
+ const __dirname = path.dirname(__filename);
1321
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1322
+
1323
+ let cmd = `"${adbPath}" -s ${serial} `;
1324
+
1325
+ const defaultCommands: Record<string, string> = {
1326
+ shutdown: "shell reboot -p",
1327
+ reboot: "reboot",
1328
+ bootloader: "reboot bootloader",
1329
+ fastbootd: "reboot fastboot",
1330
+ };
1331
+
1332
+ cmd += customCommand ?? defaultCommands[command] ?? command;
1333
+
1334
+ exec(cmd, { encoding: "utf8" }, (error) => {
1335
+ if (error) {
1336
+ resolve({ success: false, command: cmd, error: error.message });
1337
+ return;
1338
+ }
1339
+
1340
+ resolve({ success: true, command: cmd });
1341
+ });
1342
+ } catch (error: any) {
1343
+ resolve({
1344
+ success: false,
1345
+ command: String(command),
1346
+ error: error.message,
1347
+ });
1348
+ }
1349
+ });
1350
+ }
1351
+
1352
+ static async listDevices(): Promise<DeviceInfo[]> {
1353
+ return new Promise((resolve) => {
1354
+ try {
1355
+ const __filename = fileURLToPath(import.meta.url);
1356
+ const __dirname = path.dirname(__filename);
1357
+
1358
+ const adbPath = path.join(__dirname, "dependencies", "adb.exe");
1359
+
1360
+ exec(`"${adbPath}" devices`, { encoding: "utf8" }, (error, stdout) => {
1361
+ if (error) {
1362
+ resolve([]);
1363
+ return;
1364
+ }
1365
+
1366
+ const lines = stdout
1367
+ .split("\n")
1368
+ .map((line) => line.trim())
1369
+ .filter((line) => line && !line.startsWith("*"));
1370
+
1371
+ const devices: DeviceInfo[] = [];
1372
+
1373
+ for (const line of lines.slice(1)) {
1374
+ const [serial, stateRaw] = line.split("\t");
1375
+ if (!serial || !stateRaw) continue;
1376
+
1377
+ const state = ["device", "offline", "unauthorized"].includes(
1378
+ stateRaw
1379
+ )
1380
+ ? (stateRaw as DeviceState)
1381
+ : "unknown";
1382
+
1383
+ devices.push({ serial, state });
1384
+ }
1385
+
1386
+ resolve(devices);
1387
+ });
1388
+ } catch {
1389
+ resolve([]);
1390
+ }
1391
+ });
1392
+ }
1393
+ }
1394
+
1395
+ export default class ADB {
1396
+ public static readonly Sync = Sync;
1397
+ public static readonly Async = Async;
1398
+ }