systeminformation 5.33.5 → 6.0.0-beta.1

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 (498) hide show
  1. package/README.md +873 -958
  2. package/dist/audio.d.ts +1 -0
  3. package/dist/audio.js +18 -0
  4. package/dist/baseboard.d.ts +1 -0
  5. package/dist/baseboard.js +17 -0
  6. package/dist/battery.d.ts +1 -0
  7. package/dist/battery.js +19 -0
  8. package/dist/bios.d.ts +1 -0
  9. package/dist/bios.js +17 -0
  10. package/dist/block-devices.d.ts +1 -0
  11. package/dist/block-devices.js +17 -0
  12. package/dist/bluetooth.d.ts +1 -0
  13. package/dist/bluetooth.js +17 -0
  14. package/dist/bsd/battery.d.ts +2 -0
  15. package/dist/bsd/battery.js +27 -0
  16. package/dist/bsd/cpu-cache.d.ts +1 -0
  17. package/dist/bsd/cpu-cache.js +37 -0
  18. package/dist/bsd/cpu-flags.d.ts +1 -0
  19. package/dist/bsd/cpu-flags.js +28 -0
  20. package/dist/bsd/cpu-temperature.d.ts +1 -0
  21. package/dist/bsd/cpu-temperature.js +29 -0
  22. package/dist/bsd/cpu.d.ts +1 -0
  23. package/dist/bsd/cpu.js +98 -0
  24. package/dist/bsd/index.d.ts +38 -0
  25. package/dist/bsd/index.js +85 -0
  26. package/dist/bsd/mem.d.ts +1 -0
  27. package/dist/bsd/mem.js +37 -0
  28. package/dist/bsd/network-stats.d.ts +2 -0
  29. package/dist/bsd/network-stats.js +92 -0
  30. package/dist/bsd/os-info.d.ts +24 -0
  31. package/dist/bsd/os-info.js +47 -0
  32. package/dist/bsd/uuid.d.ts +2 -0
  33. package/dist/bsd/uuid.js +30 -0
  34. package/dist/camera.d.ts +1 -0
  35. package/dist/camera.js +17 -0
  36. package/dist/chassis.d.ts +1 -0
  37. package/dist/chassis.js +17 -0
  38. package/dist/cli.d.ts +2 -0
  39. package/dist/cli.js +107 -0
  40. package/dist/common/acceleration.d.ts +8 -0
  41. package/dist/common/acceleration.js +86 -0
  42. package/dist/common/codepage.d.ts +1 -0
  43. package/dist/common/codepage.js +43 -0
  44. package/dist/common/const.d.ts +25 -0
  45. package/dist/common/const.js +26 -0
  46. package/dist/common/cpu.d.ts +2 -0
  47. package/dist/common/cpu.js +12 -0
  48. package/dist/common/darwin.d.ts +6 -0
  49. package/dist/common/darwin.js +266 -0
  50. package/dist/common/datetime.d.ts +9 -0
  51. package/dist/common/datetime.js +161 -0
  52. package/dist/common/defaults.d.ts +25 -0
  53. package/dist/common/defaults.js +304 -0
  54. package/dist/common/exec.d.ts +10 -0
  55. package/dist/common/exec.js +69 -0
  56. package/dist/common/files.d.ts +2 -0
  57. package/dist/common/files.js +39 -0
  58. package/dist/common/filesys.d.ts +11 -0
  59. package/dist/common/filesys.js +282 -0
  60. package/dist/common/host.d.ts +2 -0
  61. package/dist/common/host.js +67 -0
  62. package/dist/common/index.d.ts +12 -0
  63. package/dist/common/index.js +146 -0
  64. package/dist/common/internet.d.ts +6 -0
  65. package/dist/common/internet.js +92 -0
  66. package/dist/common/mappings.d.ts +55 -0
  67. package/dist/common/mappings.js +4133 -0
  68. package/dist/common/network.d.ts +8 -0
  69. package/dist/common/network.js +162 -0
  70. package/dist/common/nvidia.d.ts +22 -0
  71. package/dist/common/nvidia.js +159 -0
  72. package/dist/common/parse.d.ts +13 -0
  73. package/dist/common/parse.js +157 -0
  74. package/dist/common/raspberry.d.ts +5 -0
  75. package/dist/common/raspberry.js +277 -0
  76. package/dist/common/security.d.ts +31 -0
  77. package/dist/common/security.js +241 -0
  78. package/dist/common/types.d.ts +1024 -0
  79. package/dist/common/types.js +2 -0
  80. package/dist/common/windows.d.ts +58 -0
  81. package/dist/common/windows.js +292 -0
  82. package/dist/cpu-cache.d.ts +1 -0
  83. package/dist/cpu-cache.js +19 -0
  84. package/dist/cpu-current-load.d.ts +2 -0
  85. package/dist/cpu-current-load.js +249 -0
  86. package/dist/cpu-current-speed.d.ts +3 -0
  87. package/dist/cpu-current-speed.js +84 -0
  88. package/dist/cpu-flags.d.ts +1 -0
  89. package/dist/cpu-flags.js +19 -0
  90. package/dist/cpu-full-load.d.ts +1 -0
  91. package/dist/cpu-full-load.js +30 -0
  92. package/dist/cpu-temperature.d.ts +1 -0
  93. package/dist/cpu-temperature.js +19 -0
  94. package/dist/cpu.d.ts +1 -0
  95. package/dist/cpu.js +19 -0
  96. package/dist/darwin/audio.d.ts +2 -0
  97. package/dist/darwin/audio.js +46 -0
  98. package/dist/darwin/baseboard.d.ts +1 -0
  99. package/dist/darwin/baseboard.js +48 -0
  100. package/dist/darwin/battery.d.ts +2 -0
  101. package/dist/darwin/battery.js +65 -0
  102. package/dist/darwin/bios.d.ts +1 -0
  103. package/dist/darwin/bios.js +45 -0
  104. package/dist/darwin/block-devices.d.ts +2 -0
  105. package/dist/darwin/block-devices.js +101 -0
  106. package/dist/darwin/bluetooth.d.ts +3 -0
  107. package/dist/darwin/bluetooth.js +84 -0
  108. package/dist/darwin/camera.d.ts +2 -0
  109. package/dist/darwin/camera.js +55 -0
  110. package/dist/darwin/chassis.d.ts +2 -0
  111. package/dist/darwin/chassis.js +32 -0
  112. package/dist/darwin/cpu-cache.d.ts +2 -0
  113. package/dist/darwin/cpu-cache.js +29 -0
  114. package/dist/darwin/cpu-flags.d.ts +1 -0
  115. package/dist/darwin/cpu-flags.js +16 -0
  116. package/dist/darwin/cpu-temperature.d.ts +1 -0
  117. package/dist/darwin/cpu-temperature.js +44 -0
  118. package/dist/darwin/cpu.d.ts +1 -0
  119. package/dist/darwin/cpu.js +69 -0
  120. package/dist/darwin/disk-layout.d.ts +2 -0
  121. package/dist/darwin/disk-layout.js +231 -0
  122. package/dist/darwin/disks-io.d.ts +2 -0
  123. package/dist/darwin/disks-io.js +56 -0
  124. package/dist/darwin/displays.d.ts +2 -0
  125. package/dist/darwin/displays.js +98 -0
  126. package/dist/darwin/fs-open-files.d.ts +2 -0
  127. package/dist/darwin/fs-open-files.js +27 -0
  128. package/dist/darwin/fs-stats.d.ts +2 -0
  129. package/dist/darwin/fs-stats.js +47 -0
  130. package/dist/darwin/gpu.d.ts +2 -0
  131. package/dist/darwin/gpu.js +55 -0
  132. package/dist/darwin/index.d.ts +56 -0
  133. package/dist/darwin/index.js +122 -0
  134. package/dist/darwin/keyboard.d.ts +2 -0
  135. package/dist/darwin/keyboard.js +73 -0
  136. package/dist/darwin/mem-layout.d.ts +2 -0
  137. package/dist/darwin/mem-layout.js +60 -0
  138. package/dist/darwin/mem.d.ts +2 -0
  139. package/dist/darwin/mem.js +50 -0
  140. package/dist/darwin/mouse.d.ts +2 -0
  141. package/dist/darwin/mouse.js +78 -0
  142. package/dist/darwin/network-connections.d.ts +2 -0
  143. package/dist/darwin/network-connections.js +98 -0
  144. package/dist/darwin/network-gateway-default.d.ts +1 -0
  145. package/dist/darwin/network-gateway-default.js +26 -0
  146. package/dist/darwin/network-interface-default.d.ts +2 -0
  147. package/dist/darwin/network-interface-default.js +41 -0
  148. package/dist/darwin/network-interfaces.d.ts +2 -0
  149. package/dist/darwin/network-interfaces.js +205 -0
  150. package/dist/darwin/network-stats.d.ts +2 -0
  151. package/dist/darwin/network-stats.js +86 -0
  152. package/dist/darwin/npm.d.ts +1 -0
  153. package/dist/darwin/npm.js +5 -0
  154. package/dist/darwin/npu.d.ts +2 -0
  155. package/dist/darwin/npu.js +41 -0
  156. package/dist/darwin/os-info.d.ts +2 -0
  157. package/dist/darwin/os-info.js +140 -0
  158. package/dist/darwin/pci.d.ts +2 -0
  159. package/dist/darwin/pci.js +37 -0
  160. package/dist/darwin/printer.d.ts +2 -0
  161. package/dist/darwin/printer.js +45 -0
  162. package/dist/darwin/software.d.ts +2 -0
  163. package/dist/darwin/software.js +39 -0
  164. package/dist/darwin/system.d.ts +1 -0
  165. package/dist/darwin/system.js +29 -0
  166. package/dist/darwin/thunderbolt.d.ts +1 -0
  167. package/dist/darwin/thunderbolt.js +53 -0
  168. package/dist/darwin/usb.d.ts +3 -0
  169. package/dist/darwin/usb.js +69 -0
  170. package/dist/darwin/users.d.ts +2 -0
  171. package/dist/darwin/users.js +13 -0
  172. package/dist/darwin/uuid.d.ts +2 -0
  173. package/dist/darwin/uuid.js +39 -0
  174. package/dist/darwin/wifi-connections.d.ts +2 -0
  175. package/dist/darwin/wifi-connections.js +60 -0
  176. package/dist/darwin/wifi-interfaces.d.ts +2 -0
  177. package/dist/darwin/wifi-interfaces.js +27 -0
  178. package/dist/darwin/wifi-networks.d.ts +2 -0
  179. package/dist/darwin/wifi-networks.js +61 -0
  180. package/dist/disk-layout.d.ts +1 -0
  181. package/dist/disk-layout.js +17 -0
  182. package/dist/disks-io.d.ts +1 -0
  183. package/dist/disks-io.js +17 -0
  184. package/dist/displays.d.ts +1 -0
  185. package/dist/displays.js +17 -0
  186. package/dist/docker-socket.d.ts +11 -0
  187. package/dist/docker-socket.js +113 -0
  188. package/dist/docker.d.ts +102 -0
  189. package/dist/docker.js +532 -0
  190. package/dist/fs-open-files.d.ts +1 -0
  191. package/dist/fs-open-files.js +17 -0
  192. package/dist/fs-size.d.ts +1 -0
  193. package/dist/fs-size.js +23 -0
  194. package/dist/fs-stats.d.ts +1 -0
  195. package/dist/fs-stats.js +17 -0
  196. package/dist/get-data.d.ts +110 -0
  197. package/dist/get-data.js +151 -0
  198. package/dist/get.d.ts +5 -0
  199. package/dist/get.js +117 -0
  200. package/dist/gpu.d.ts +1 -0
  201. package/dist/gpu.js +17 -0
  202. package/dist/index.d.ts +60 -0
  203. package/dist/index.js +132 -0
  204. package/dist/inet-checksite.d.ts +1 -0
  205. package/dist/inet-checksite.js +11 -0
  206. package/dist/inet-latency.d.ts +1 -0
  207. package/dist/inet-latency.js +17 -0
  208. package/dist/inet-public-ip.d.ts +2 -0
  209. package/dist/inet-public-ip.js +10 -0
  210. package/dist/keyboard.d.ts +1 -0
  211. package/dist/keyboard.js +17 -0
  212. package/dist/linux/audio.d.ts +2 -0
  213. package/dist/linux/audio.js +67 -0
  214. package/dist/linux/baseboard.d.ts +1 -0
  215. package/dist/linux/baseboard.js +81 -0
  216. package/dist/linux/battery.d.ts +2 -0
  217. package/dist/linux/battery.js +88 -0
  218. package/dist/linux/bios.d.ts +2 -0
  219. package/dist/linux/bios.js +55 -0
  220. package/dist/linux/block-devices.d.ts +2 -0
  221. package/dist/linux/block-devices.js +30 -0
  222. package/dist/linux/bluetooth.d.ts +2 -0
  223. package/dist/linux/bluetooth.js +86 -0
  224. package/dist/linux/camera.d.ts +2 -0
  225. package/dist/linux/camera.js +63 -0
  226. package/dist/linux/chassis.d.ts +1 -0
  227. package/dist/linux/chassis.js +41 -0
  228. package/dist/linux/cpu-cache.d.ts +1 -0
  229. package/dist/linux/cpu-cache.js +35 -0
  230. package/dist/linux/cpu-flags.d.ts +1 -0
  231. package/dist/linux/cpu-flags.js +33 -0
  232. package/dist/linux/cpu-temperature.d.ts +1 -0
  233. package/dist/linux/cpu-temperature.js +179 -0
  234. package/dist/linux/cpu.d.ts +1 -0
  235. package/dist/linux/cpu.js +135 -0
  236. package/dist/linux/disk-layout.d.ts +2 -0
  237. package/dist/linux/disk-layout.js +151 -0
  238. package/dist/linux/disks-io.d.ts +2 -0
  239. package/dist/linux/disks-io.js +58 -0
  240. package/dist/linux/displays.d.ts +2 -0
  241. package/dist/linux/displays.js +193 -0
  242. package/dist/linux/fs-open-files.d.ts +2 -0
  243. package/dist/linux/fs-open-files.js +44 -0
  244. package/dist/linux/fs-size.d.ts +2 -0
  245. package/dist/linux/fs-size.js +157 -0
  246. package/dist/linux/fs-stats.d.ts +2 -0
  247. package/dist/linux/fs-stats.js +65 -0
  248. package/dist/linux/gpu.d.ts +15 -0
  249. package/dist/linux/gpu.js +383 -0
  250. package/dist/linux/index.d.ts +56 -0
  251. package/dist/linux/index.js +122 -0
  252. package/dist/linux/inet-latency.d.ts +1 -0
  253. package/dist/linux/inet-latency.js +39 -0
  254. package/dist/linux/keyboard.d.ts +2 -0
  255. package/dist/linux/keyboard.js +61 -0
  256. package/dist/linux/mem-layout.d.ts +2 -0
  257. package/dist/linux/mem-layout.js +112 -0
  258. package/dist/linux/mem.d.ts +2 -0
  259. package/dist/linux/mem.js +61 -0
  260. package/dist/linux/mouse.d.ts +2 -0
  261. package/dist/linux/mouse.js +73 -0
  262. package/dist/linux/network-connections.d.ts +2 -0
  263. package/dist/linux/network-connections.js +114 -0
  264. package/dist/linux/network-gateway-default.d.ts +1 -0
  265. package/dist/linux/network-gateway-default.js +22 -0
  266. package/dist/linux/network-interface-default.d.ts +2 -0
  267. package/dist/linux/network-interface-default.js +46 -0
  268. package/dist/linux/network-interfaces.d.ts +3 -0
  269. package/dist/linux/network-interfaces.js +353 -0
  270. package/dist/linux/network-stats.d.ts +2 -0
  271. package/dist/linux/network-stats.js +99 -0
  272. package/dist/linux/npm.d.ts +1 -0
  273. package/dist/linux/npm.js +5 -0
  274. package/dist/linux/npu.d.ts +2 -0
  275. package/dist/linux/npu.js +77 -0
  276. package/dist/linux/os-info.d.ts +1 -0
  277. package/dist/linux/os-info.js +114 -0
  278. package/dist/linux/pci.d.ts +2 -0
  279. package/dist/linux/pci.js +56 -0
  280. package/dist/linux/printer.d.ts +2 -0
  281. package/dist/linux/printer.js +80 -0
  282. package/dist/linux/process-load.d.ts +2 -0
  283. package/dist/linux/process-load.js +164 -0
  284. package/dist/linux/processes.d.ts +2 -0
  285. package/dist/linux/processes.js +358 -0
  286. package/dist/linux/services.d.ts +2 -0
  287. package/dist/linux/services.js +222 -0
  288. package/dist/linux/software.d.ts +2 -0
  289. package/dist/linux/software.js +110 -0
  290. package/dist/linux/system.d.ts +1 -0
  291. package/dist/linux/system.js +186 -0
  292. package/dist/linux/thunderbolt.d.ts +2 -0
  293. package/dist/linux/thunderbolt.js +51 -0
  294. package/dist/linux/time.d.ts +6 -0
  295. package/dist/linux/time.js +28 -0
  296. package/dist/linux/usb.d.ts +2 -0
  297. package/dist/linux/usb.js +62 -0
  298. package/dist/linux/users.d.ts +2 -0
  299. package/dist/linux/users.js +102 -0
  300. package/dist/linux/uuid.d.ts +2 -0
  301. package/dist/linux/uuid.js +44 -0
  302. package/dist/linux/wifi-connections.d.ts +2 -0
  303. package/dist/linux/wifi-connections.js +196 -0
  304. package/dist/linux/wifi-interfaces.d.ts +2 -0
  305. package/dist/linux/wifi-interfaces.js +96 -0
  306. package/dist/linux/wifi-networks.d.ts +2 -0
  307. package/dist/linux/wifi-networks.js +176 -0
  308. package/dist/mem-layout.d.ts +1 -0
  309. package/dist/mem-layout.js +17 -0
  310. package/dist/mem.d.ts +1 -0
  311. package/dist/mem.js +19 -0
  312. package/dist/mouse.d.ts +1 -0
  313. package/dist/mouse.js +17 -0
  314. package/dist/network-connections.d.ts +1 -0
  315. package/dist/network-connections.js +17 -0
  316. package/dist/network-gateway-default.d.ts +1 -0
  317. package/dist/network-gateway-default.js +17 -0
  318. package/dist/network-interface-default.d.ts +1 -0
  319. package/dist/network-interface-default.js +17 -0
  320. package/dist/network-interfaces.d.ts +1 -0
  321. package/dist/network-interfaces.js +18 -0
  322. package/dist/network-stats.d.ts +1 -0
  323. package/dist/network-stats.js +19 -0
  324. package/dist/npm.d.ts +2 -0
  325. package/dist/npm.js +22 -0
  326. package/dist/npu.d.ts +1 -0
  327. package/dist/npu.js +17 -0
  328. package/dist/observe.d.ts +5 -0
  329. package/dist/observe.js +16 -0
  330. package/dist/os-info.d.ts +1 -0
  331. package/dist/os-info.js +21 -0
  332. package/dist/pci.d.ts +1 -0
  333. package/dist/pci.js +17 -0
  334. package/dist/printer.d.ts +1 -0
  335. package/dist/printer.js +17 -0
  336. package/dist/process-load.d.ts +1 -0
  337. package/dist/process-load.js +15 -0
  338. package/dist/processes.d.ts +1 -0
  339. package/dist/processes.js +15 -0
  340. package/dist/services.d.ts +1 -0
  341. package/dist/services.js +15 -0
  342. package/dist/shell.d.ts +1 -0
  343. package/dist/shell.js +16 -0
  344. package/dist/software.d.ts +1 -0
  345. package/dist/software.js +17 -0
  346. package/dist/sun/index.d.ts +17 -0
  347. package/dist/sun/index.js +43 -0
  348. package/dist/sun/inet-latency.d.ts +1 -0
  349. package/dist/sun/inet-latency.js +30 -0
  350. package/dist/sun/os-info.d.ts +1 -0
  351. package/dist/sun/os-info.js +26 -0
  352. package/dist/sun/users.d.ts +2 -0
  353. package/dist/sun/users.js +13 -0
  354. package/dist/system.d.ts +1 -0
  355. package/dist/system.js +17 -0
  356. package/dist/thunderbolt.d.ts +1 -0
  357. package/dist/thunderbolt.js +17 -0
  358. package/dist/time.d.ts +6 -0
  359. package/dist/time.js +28 -0
  360. package/dist/usb.d.ts +1 -0
  361. package/dist/usb.js +17 -0
  362. package/dist/users.d.ts +1 -0
  363. package/dist/users.js +21 -0
  364. package/dist/uuid.d.ts +1 -0
  365. package/dist/uuid.js +19 -0
  366. package/dist/version.d.ts +1 -0
  367. package/dist/version.js +16 -0
  368. package/dist/versions.d.ts +2 -0
  369. package/dist/versions.js +1150 -0
  370. package/dist/virtualbox.d.ts +2 -0
  371. package/dist/virtualbox.js +89 -0
  372. package/dist/wifi-connections.d.ts +1 -0
  373. package/dist/wifi-connections.js +17 -0
  374. package/dist/wifi-interfaces.d.ts +1 -0
  375. package/dist/wifi-interfaces.js +17 -0
  376. package/dist/wifi-networks.d.ts +1 -0
  377. package/dist/wifi-networks.js +17 -0
  378. package/dist/windows/audio.d.ts +2 -0
  379. package/dist/windows/audio.js +23 -0
  380. package/dist/windows/baseboard.d.ts +1 -0
  381. package/dist/windows/baseboard.js +35 -0
  382. package/dist/windows/battery.d.ts +1 -0
  383. package/dist/windows/battery.js +81 -0
  384. package/dist/windows/bios.d.ts +1 -0
  385. package/dist/windows/bios.js +37 -0
  386. package/dist/windows/block-devices.d.ts +3 -0
  387. package/dist/windows/block-devices.js +58 -0
  388. package/dist/windows/bluetooth.d.ts +2 -0
  389. package/dist/windows/bluetooth.js +31 -0
  390. package/dist/windows/camera.d.ts +2 -0
  391. package/dist/windows/camera.js +47 -0
  392. package/dist/windows/chassis.d.ts +1 -0
  393. package/dist/windows/chassis.js +29 -0
  394. package/dist/windows/cpu-cache.d.ts +2 -0
  395. package/dist/windows/cpu-cache.js +59 -0
  396. package/dist/windows/cpu-flags.d.ts +1 -0
  397. package/dist/windows/cpu-flags.js +61 -0
  398. package/dist/windows/cpu-temperature.d.ts +1 -0
  399. package/dist/windows/cpu-temperature.js +32 -0
  400. package/dist/windows/cpu.d.ts +1 -0
  401. package/dist/windows/cpu.js +96 -0
  402. package/dist/windows/disk-layout.d.ts +2 -0
  403. package/dist/windows/disk-layout.js +129 -0
  404. package/dist/windows/disks-io.d.ts +2 -0
  405. package/dist/windows/disks-io.js +46 -0
  406. package/dist/windows/displays.d.ts +2 -0
  407. package/dist/windows/displays.js +213 -0
  408. package/dist/windows/fs-open-files.d.ts +2 -0
  409. package/dist/windows/fs-open-files.js +22 -0
  410. package/dist/windows/fs-size.d.ts +2 -0
  411. package/dist/windows/fs-size.js +47 -0
  412. package/dist/windows/fs-stats.d.ts +2 -0
  413. package/dist/windows/fs-stats.js +37 -0
  414. package/dist/windows/gpu.d.ts +2 -0
  415. package/dist/windows/gpu.js +128 -0
  416. package/dist/windows/index.d.ts +56 -0
  417. package/dist/windows/index.js +122 -0
  418. package/dist/windows/inet-latency.d.ts +1 -0
  419. package/dist/windows/inet-latency.js +34 -0
  420. package/dist/windows/keyboard.d.ts +2 -0
  421. package/dist/windows/keyboard.js +47 -0
  422. package/dist/windows/mem-layout.d.ts +2 -0
  423. package/dist/windows/mem-layout.js +39 -0
  424. package/dist/windows/mem.d.ts +2 -0
  425. package/dist/windows/mem.js +33 -0
  426. package/dist/windows/mouse.d.ts +2 -0
  427. package/dist/windows/mouse.js +64 -0
  428. package/dist/windows/network-connections.d.ts +2 -0
  429. package/dist/windows/network-connections.js +93 -0
  430. package/dist/windows/network-gateway-default.d.ts +1 -0
  431. package/dist/windows/network-gateway-default.js +36 -0
  432. package/dist/windows/network-interface-default.d.ts +2 -0
  433. package/dist/windows/network-interface-default.js +56 -0
  434. package/dist/windows/network-interfaces.d.ts +2 -0
  435. package/dist/windows/network-interfaces.js +346 -0
  436. package/dist/windows/network-stats.d.ts +2 -0
  437. package/dist/windows/network-stats.js +135 -0
  438. package/dist/windows/npm.d.ts +1 -0
  439. package/dist/windows/npm.js +5 -0
  440. package/dist/windows/npu.d.ts +2 -0
  441. package/dist/windows/npu.js +29 -0
  442. package/dist/windows/os-info.d.ts +1 -0
  443. package/dist/windows/os-info.js +70 -0
  444. package/dist/windows/pci.d.ts +2 -0
  445. package/dist/windows/pci.js +33 -0
  446. package/dist/windows/printer.d.ts +2 -0
  447. package/dist/windows/printer.js +36 -0
  448. package/dist/windows/process-load.d.ts +2 -0
  449. package/dist/windows/process-load.js +121 -0
  450. package/dist/windows/processes.d.ts +9 -0
  451. package/dist/windows/processes.js +139 -0
  452. package/dist/windows/services.d.ts +2 -0
  453. package/dist/windows/services.js +83 -0
  454. package/dist/windows/shell.d.ts +1 -0
  455. package/dist/windows/shell.js +19 -0
  456. package/dist/windows/software.d.ts +2 -0
  457. package/dist/windows/software.js +53 -0
  458. package/dist/windows/system.d.ts +1 -0
  459. package/dist/windows/system.js +98 -0
  460. package/dist/windows/thunderbolt.d.ts +2 -0
  461. package/dist/windows/thunderbolt.js +34 -0
  462. package/dist/windows/usb.d.ts +2 -0
  463. package/dist/windows/usb.js +37 -0
  464. package/dist/windows/users.d.ts +2 -0
  465. package/dist/windows/users.js +151 -0
  466. package/dist/windows/uuid.d.ts +2 -0
  467. package/dist/windows/uuid.js +28 -0
  468. package/dist/windows/wifi-connections.d.ts +2 -0
  469. package/dist/windows/wifi-connections.js +56 -0
  470. package/dist/windows/wifi-interfaces.d.ts +2 -0
  471. package/dist/windows/wifi-interfaces.js +45 -0
  472. package/dist/windows/wifi-networks.d.ts +2 -0
  473. package/dist/windows/wifi-networks.js +50 -0
  474. package/package.json +78 -12
  475. package/lib/audio.js +0 -277
  476. package/lib/battery.js +0 -334
  477. package/lib/bluetooth.js +0 -315
  478. package/lib/bluetoothVendors.js +0 -1138
  479. package/lib/cli.js +0 -100
  480. package/lib/cpu.js +0 -2285
  481. package/lib/docker.js +0 -791
  482. package/lib/dockerSocket.js +0 -117
  483. package/lib/filesystem.js +0 -1849
  484. package/lib/graphics.js +0 -1321
  485. package/lib/index.d.ts +0 -1051
  486. package/lib/index.js +0 -520
  487. package/lib/internet.js +0 -259
  488. package/lib/memory.js +0 -622
  489. package/lib/network.js +0 -2008
  490. package/lib/osinfo.js +0 -1322
  491. package/lib/printer.js +0 -209
  492. package/lib/processes.js +0 -1459
  493. package/lib/system.js +0 -855
  494. package/lib/usb.js +0 -309
  495. package/lib/users.js +0 -412
  496. package/lib/util.js +0 -2833
  497. package/lib/virtualbox.js +0 -116
  498. package/lib/wifi.js +0 -839
package/lib/osinfo.js DELETED
@@ -1,1322 +0,0 @@
1
- 'use strict';
2
- // @ts-check
3
- // ==================================================================================
4
- // osinfo.js
5
- // ----------------------------------------------------------------------------------
6
- // Description: System Information - library
7
- // for Node.js
8
- // Copyright: (c) 2014 - 2026
9
- // Author: Sebastian Hildebrandt
10
- // ----------------------------------------------------------------------------------
11
- // License: MIT
12
- // ==================================================================================
13
- // 3. Operating System
14
- // ----------------------------------------------------------------------------------
15
-
16
- const os = require('os');
17
- const fs = require('fs');
18
- const util = require('./util');
19
- const exec = require('child_process').exec;
20
- const execSync = require('child_process').execSync;
21
- const execFile = require('child_process').execFile;
22
-
23
- const _platform = process.platform;
24
-
25
- const _linux = _platform === 'linux' || _platform === 'android';
26
- const _darwin = _platform === 'darwin';
27
- const _windows = _platform === 'win32';
28
- const _freebsd = _platform === 'freebsd';
29
- const _openbsd = _platform === 'openbsd';
30
- const _netbsd = _platform === 'netbsd';
31
- const _sunos = _platform === 'sunos';
32
-
33
- // --------------------------
34
- // Get current time and OS uptime
35
-
36
- function time() {
37
- const t = new Date().toString().split(' ');
38
- let timezoneName = '';
39
- try {
40
- timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
41
- } catch {
42
- timezoneName = t.length >= 7 ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '';
43
- }
44
- const result = {
45
- current: Date.now(),
46
- uptime: os.uptime(),
47
- timezone: t.length >= 7 ? t[5] : '',
48
- timezoneName
49
- };
50
- if (_darwin || _linux) {
51
- try {
52
- const stdout = execSync('date +%Z && date +%z && ls -l /etc/localtime 2>/dev/null', util.execOptsLinux);
53
- const lines = stdout.toString().split(os.EOL);
54
- if (lines.length > 3 && !lines[0]) {
55
- lines.shift();
56
- }
57
- let timezone = lines[0] || '';
58
- if (timezone.startsWith('+') || timezone.startsWith('-')) {
59
- timezone = 'GMT';
60
- }
61
- return {
62
- current: Date.now(),
63
- uptime: os.uptime(),
64
- timezone: lines[1] ? timezone + lines[1] : timezone,
65
- timezoneName: lines[2] && lines[2].indexOf('/zoneinfo/') > 0 ? lines[2].split('/zoneinfo/')[1] || '' : ''
66
- };
67
- } catch {
68
- util.noop();
69
- }
70
- }
71
- return result;
72
- }
73
-
74
- exports.time = time;
75
-
76
- // --------------------------
77
- // Get logo filename of OS distribution
78
-
79
- function getLogoFile(distro) {
80
- distro = distro || '';
81
- distro = distro.toLowerCase();
82
- let result = _platform;
83
- if (_windows) {
84
- result = 'windows';
85
- } else if (distro.indexOf('mac os') !== -1 || distro.indexOf('macos') !== -1) {
86
- result = 'apple';
87
- } else if (distro.indexOf('arch') !== -1) {
88
- result = 'arch';
89
- } else if (distro.indexOf('cachy') !== -1) {
90
- result = 'cachy';
91
- } else if (distro.indexOf('centos') !== -1) {
92
- result = 'centos';
93
- } else if (distro.indexOf('coreos') !== -1) {
94
- result = 'coreos';
95
- } else if (distro.indexOf('debian') !== -1) {
96
- result = 'debian';
97
- } else if (distro.indexOf('deepin') !== -1) {
98
- result = 'deepin';
99
- } else if (distro.indexOf('elementary') !== -1) {
100
- result = 'elementary';
101
- } else if (distro.indexOf('endeavour') !== -1) {
102
- result = 'endeavour';
103
- } else if (distro.indexOf('fedora') !== -1) {
104
- result = 'fedora';
105
- } else if (distro.indexOf('gentoo') !== -1) {
106
- result = 'gentoo';
107
- } else if (distro.indexOf('mageia') !== -1) {
108
- result = 'mageia';
109
- } else if (distro.indexOf('mandriva') !== -1) {
110
- result = 'mandriva';
111
- } else if (distro.indexOf('manjaro') !== -1) {
112
- result = 'manjaro';
113
- } else if (distro.indexOf('mint') !== -1) {
114
- result = 'mint';
115
- } else if (distro.indexOf('mx') !== -1) {
116
- result = 'mx';
117
- } else if (distro.indexOf('openbsd') !== -1) {
118
- result = 'openbsd';
119
- } else if (distro.indexOf('freebsd') !== -1) {
120
- result = 'freebsd';
121
- } else if (distro.indexOf('opensuse') !== -1) {
122
- result = 'opensuse';
123
- } else if (distro.indexOf('pclinuxos') !== -1) {
124
- result = 'pclinuxos';
125
- } else if (distro.indexOf('puppy') !== -1) {
126
- result = 'puppy';
127
- } else if (distro.indexOf('popos') !== -1) {
128
- result = 'popos';
129
- } else if (distro.indexOf('raspbian') !== -1) {
130
- result = 'raspbian';
131
- } else if (distro.indexOf('reactos') !== -1) {
132
- result = 'reactos';
133
- } else if (distro.indexOf('redhat') !== -1) {
134
- result = 'redhat';
135
- } else if (distro.indexOf('slackware') !== -1) {
136
- result = 'slackware';
137
- } else if (distro.indexOf('sugar') !== -1) {
138
- result = 'sugar';
139
- } else if (distro.indexOf('steam') !== -1) {
140
- result = 'steam';
141
- } else if (distro.indexOf('suse') !== -1) {
142
- result = 'suse';
143
- } else if (distro.indexOf('mate') !== -1) {
144
- result = 'ubuntu-mate';
145
- } else if (distro.indexOf('lubuntu') !== -1) {
146
- result = 'lubuntu';
147
- } else if (distro.indexOf('xubuntu') !== -1) {
148
- result = 'xubuntu';
149
- } else if (distro.indexOf('ubuntu') !== -1) {
150
- result = 'ubuntu';
151
- } else if (distro.indexOf('solaris') !== -1) {
152
- result = 'solaris';
153
- } else if (distro.indexOf('tails') !== -1) {
154
- result = 'tails';
155
- } else if (distro.indexOf('feren') !== -1) {
156
- result = 'ferenos';
157
- } else if (distro.indexOf('robolinux') !== -1) {
158
- result = 'robolinux';
159
- } else if (_linux && distro) {
160
- result = distro.toLowerCase().trim().replace(/\s+/g, '-');
161
- }
162
- return result;
163
- }
164
-
165
- const WINDOWS_RELEASES = [
166
- [26200, '25H2'],
167
- [26100, '24H2'],
168
- [22631, '23H2'],
169
- [22621, '22H2'],
170
- [19045, '22H2'],
171
- [22000, '21H2'],
172
- [19044, '21H2'],
173
- [19043, '21H1'],
174
- [19042, '20H2'],
175
- [19041, '2004'],
176
- [18363, '1909'],
177
- [18362, '1903'],
178
- [17763, '1809'],
179
- [17134, '1803']
180
- ];
181
-
182
- function getWindowsRelease(build) {
183
- for (const [minBuild, label] of WINDOWS_RELEASES) {
184
- if (build >= minBuild) return label;
185
- }
186
- return '';
187
- }
188
-
189
- // --------------------------
190
- // FQDN
191
-
192
- function getFQDN() {
193
- let fqdn = os.hostname();
194
- if (_linux || _darwin) {
195
- try {
196
- const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux);
197
- fqdn = stdout.toString().split(os.EOL)[0];
198
- } catch {
199
- util.noop();
200
- }
201
- }
202
- if (_freebsd || _openbsd || _netbsd) {
203
- try {
204
- const stdout = execSync('hostname 2>/dev/null');
205
- fqdn = stdout.toString().split(os.EOL)[0];
206
- } catch {
207
- util.noop();
208
- }
209
- }
210
- if (_windows) {
211
- try {
212
- const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
213
- fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0];
214
- } catch {
215
- util.noop();
216
- }
217
- }
218
- return fqdn;
219
- }
220
-
221
- // --------------------------
222
- // OS Information
223
-
224
- function osInfo(callback) {
225
- return new Promise((resolve) => {
226
- process.nextTick(() => {
227
- let result = {
228
- platform: _platform === 'win32' ? 'Windows' : _platform,
229
- distro: 'unknown',
230
- release: 'unknown',
231
- codename: '',
232
- kernel: os.release(),
233
- arch: os.arch(),
234
- hostname: os.hostname(),
235
- fqdn: getFQDN(),
236
- codepage: '',
237
- logofile: '',
238
- serial: '',
239
- build: '',
240
- servicepack: '',
241
- uefi: false
242
- };
243
-
244
- if (_linux) {
245
- exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', (error, stdout) => {
246
- /**
247
- * @namespace
248
- * @property {string} DISTRIB_ID
249
- * @property {string} NAME
250
- * @property {string} DISTRIB_RELEASE
251
- * @property {string} VERSION_ID
252
- * @property {string} DISTRIB_CODENAME
253
- */
254
- let release = {};
255
- let lines = stdout.toString().split('\n');
256
- lines.forEach((line) => {
257
- if (line.indexOf('=') !== -1) {
258
- release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim();
259
- }
260
- });
261
- result.distro = (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, '');
262
- result.logofile = getLogoFile(result.distro);
263
- let releaseVersion = (release.VERSION || '').replace(/"/g, '');
264
- let codename = (release.DISTRIB_CODENAME || release.VERSION_CODENAME || '').replace(/"/g, '');
265
- const prettyName = (release.PRETTY_NAME || '').replace(/"/g, '');
266
- if (prettyName.indexOf(result.distro + ' ') === 0) {
267
- releaseVersion = prettyName.replace(result.distro + ' ', '').trim();
268
- }
269
- if (releaseVersion.indexOf('(') >= 0) {
270
- codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim();
271
- releaseVersion = releaseVersion.split('(')[0].trim();
272
- }
273
- result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, '');
274
- result.codename = codename;
275
- result.codepage = util.getCodepage();
276
- result.build = (release.BUILD_ID || '').replace(/"/g, '').trim();
277
- isUefiLinux().then((uefi) => {
278
- result.uefi = uefi;
279
- uuid().then((data) => {
280
- result.serial = data.os;
281
- if (callback) {
282
- callback(result);
283
- }
284
- resolve(result);
285
- });
286
- });
287
- });
288
- }
289
- if (_freebsd || _openbsd || _netbsd) {
290
- exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', (error, stdout) => {
291
- let lines = stdout.toString().split('\n');
292
- const distro = util.getValue(lines, 'kern.ostype');
293
- const logofile = getLogoFile(distro);
294
- const release = util.getValue(lines, 'kern.osrelease').split('-')[0];
295
- const serial = util.getValue(lines, 'kern.hostuuid');
296
- const bootmethod = util.getValue(lines, 'machdep.bootmethod');
297
- const uefiConf = stdout.toString().indexOf('<type>efi</type>') >= 0;
298
- const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : uefiConf ? uefiConf : null;
299
- result.distro = distro || result.distro;
300
- result.logofile = logofile || result.logofile;
301
- result.release = release || result.release;
302
- result.serial = serial || result.serial;
303
- result.codename = '';
304
- result.codepage = util.getCodepage();
305
- result.uefi = uefi || null;
306
- if (callback) {
307
- callback(result);
308
- }
309
- resolve(result);
310
- });
311
- }
312
- if (_darwin) {
313
- exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', (error, stdout) => {
314
- let lines = stdout.toString().split('\n');
315
- result.serial = util.getValue(lines, 'kern.uuid');
316
- result.distro = util.getValue(lines, 'ProductName');
317
- result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim();
318
- result.build = util.getValue(lines, 'BuildVersion');
319
- result.logofile = getLogoFile(result.distro);
320
- result.codename = 'macOS';
321
- result.codename = result.release.indexOf('10.4') > -1 ? 'OS X Tiger' : result.codename;
322
- result.codename = result.release.indexOf('10.5') > -1 ? 'OS X Leopard' : result.codename;
323
- result.codename = result.release.indexOf('10.6') > -1 ? 'OS X Snow Leopard' : result.codename;
324
- result.codename = result.release.indexOf('10.7') > -1 ? 'OS X Lion' : result.codename;
325
- result.codename = result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename;
326
- result.codename = result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename;
327
- result.codename = result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename;
328
- result.codename = result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename;
329
- result.codename = result.release.indexOf('10.12') > -1 ? 'Sierra' : result.codename;
330
- result.codename = result.release.indexOf('10.13') > -1 ? 'High Sierra' : result.codename;
331
- result.codename = result.release.indexOf('10.14') > -1 ? 'Mojave' : result.codename;
332
- result.codename = result.release.indexOf('10.15') > -1 ? 'Catalina' : result.codename;
333
- result.codename = result.release.startsWith('11.') ? 'Big Sur' : result.codename;
334
- result.codename = result.release.startsWith('12.') ? 'Monterey' : result.codename;
335
- result.codename = result.release.startsWith('13.') ? 'Ventura' : result.codename;
336
- result.codename = result.release.startsWith('14.') ? 'Sonoma' : result.codename;
337
- result.codename = result.release.startsWith('15.') ? 'Sequoia' : result.codename;
338
- result.codename = result.release.startsWith('26.') ? 'Tahoe' : result.codename;
339
- result.codename = result.release.startsWith('27.') ? 'Golden Gate' : result.codename;
340
- result.uefi = true;
341
- result.codepage = util.getCodepage();
342
- if (callback) {
343
- callback(result);
344
- }
345
- resolve(result);
346
- });
347
- }
348
- if (_sunos) {
349
- result.release = result.kernel;
350
- exec('uname -o', (error, stdout) => {
351
- const lines = stdout.toString().split('\n');
352
- result.distro = lines[0];
353
- result.logofile = getLogoFile(result.distro);
354
- if (callback) {
355
- callback(result);
356
- }
357
- resolve(result);
358
- });
359
- }
360
- if (_windows) {
361
- result.logofile = getLogoFile();
362
- result.release = result.kernel;
363
- try {
364
- const workload = [];
365
- workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
366
- workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
367
- workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
368
- workload.push(util.powerShell('reg query "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" /v DisplayVersion'));
369
- util.promiseAll(workload).then((data) => {
370
- const lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
371
- result.distro = util.getValue(lines, 'Caption', ':').trim();
372
- result.serial = util.getValue(lines, 'SerialNumber', ':').trim();
373
- result.build = util.getValue(lines, 'BuildNumber', ':').trim();
374
- result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim();
375
- result.codepage = util.getCodepage();
376
- const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
377
- result.hypervisor = hyperv.indexOf('true') !== -1;
378
- const term = data.results[2] ? data.results[2].toString() : '';
379
- if (data.results[3]) {
380
- const codenameParts = data.results[3].split('REG_SZ');
381
- result.codename = codenameParts.length > 1 ? codenameParts[1].trim() : '';
382
- }
383
- if (!result.codename) {
384
- const buildNum = parseInt(result.build, 10);
385
- result.codename = getWindowsRelease(buildNum);
386
- }
387
- result.remoteSession = term.toString().toLowerCase().indexOf('true') >= 0;
388
- isUefiWindows().then((uefi) => {
389
- result.uefi = uefi;
390
- if (callback) {
391
- callback(result);
392
- }
393
- resolve(result);
394
- });
395
- });
396
- } catch {
397
- if (callback) {
398
- callback(result);
399
- }
400
- resolve(result);
401
- }
402
- }
403
- });
404
- });
405
- }
406
-
407
- exports.osInfo = osInfo;
408
-
409
- function isUefiLinux() {
410
- return new Promise((resolve) => {
411
- process.nextTick(() => {
412
- fs.stat('/sys/firmware/efi', (err) => {
413
- if (!err) {
414
- return resolve(true);
415
- } else {
416
- exec('dmesg | grep -E "EFI v"', (error, stdout) => {
417
- if (!error) {
418
- const lines = stdout.toString().split('\n');
419
- return resolve(lines.length > 0);
420
- }
421
- return resolve(false);
422
- });
423
- }
424
- });
425
- });
426
- });
427
- }
428
-
429
- function isUefiWindows() {
430
- return new Promise((resolve) => {
431
- process.nextTick(() => {
432
- try {
433
- exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, (error, stdout) => {
434
- if (!error) {
435
- const line = stdout.toString().split('\n\r')[0];
436
- return resolve(line.toLowerCase().indexOf('efi') >= 0);
437
- } else {
438
- exec('echo %firmware_type%', util.execOptsWin, (error, stdout) => {
439
- if (!error) {
440
- const line = stdout.toString() || '';
441
- return resolve(line.toLowerCase().indexOf('efi') >= 0);
442
- } else {
443
- return resolve(false);
444
- }
445
- });
446
- }
447
- });
448
- } catch {
449
- return resolve(false);
450
- }
451
- });
452
- });
453
- }
454
-
455
- function versions(apps, callback) {
456
- let versionObject = {
457
- kernel: os.release(),
458
- apache: '',
459
- bash: '',
460
- bun: '',
461
- deno: '',
462
- docker: '',
463
- dotnet: '',
464
- fish: '',
465
- gcc: '',
466
- git: '',
467
- grunt: '',
468
- gulp: '',
469
- homebrew: '',
470
- java: '',
471
- mongodb: '',
472
- mysql: '',
473
- nginx: '',
474
- node: '', //process.versions.node,
475
- npm: '',
476
- openssl: '',
477
- perl: '',
478
- php: '',
479
- pip3: '',
480
- pip: '',
481
- pm2: '',
482
- postfix: '',
483
- postgresql: '',
484
- powershell: '',
485
- python3: '',
486
- python: '',
487
- redis: '',
488
- systemOpenssl: '',
489
- systemOpensslLib: '',
490
- tsc: '',
491
- v8: process.versions.v8,
492
- virtualbox: '',
493
- yarn: '',
494
- zsh: ''
495
- };
496
-
497
- function checkVersionParam(apps) {
498
- if (apps === '*') {
499
- return {
500
- versions: versionObject,
501
- counter: 34
502
- };
503
- }
504
- if (!Array.isArray(apps)) {
505
- apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
506
- apps = apps.split('|');
507
- const result = {
508
- versions: {},
509
- counter: 0
510
- };
511
- apps.forEach((el) => {
512
- if (el) {
513
- for (let key in versionObject) {
514
- if ({}.hasOwnProperty.call(versionObject, key)) {
515
- if (key.toLowerCase() === el.toLowerCase() && !{}.hasOwnProperty.call(result.versions, key)) {
516
- result.versions[key] = versionObject[key];
517
- if (key === 'openssl') {
518
- result.versions.systemOpenssl = '';
519
- result.versions.systemOpensslLib = '';
520
- }
521
-
522
- if (!result.versions[key]) {
523
- result.counter++;
524
- }
525
- }
526
- }
527
- }
528
- }
529
- });
530
- return result;
531
- }
532
- }
533
-
534
- return new Promise((resolve) => {
535
- process.nextTick(() => {
536
- if (util.isFunction(apps) && !callback) {
537
- callback = apps;
538
- apps = '*';
539
- } else {
540
- apps = apps || '*';
541
- if (typeof apps !== 'string') {
542
- if (callback) {
543
- callback({});
544
- }
545
- return resolve({});
546
- }
547
- }
548
- const appsObj = checkVersionParam(apps);
549
- let totalFunctions = appsObj.counter;
550
-
551
- if (totalFunctions <= 0) {
552
- if (callback) {
553
- callback(appsObj.versions);
554
- }
555
- return resolve(appsObj.versions);
556
- }
557
-
558
- let functionProcessed = (() => {
559
- return () => {
560
- if (--totalFunctions === 0) {
561
- if (callback) {
562
- callback(appsObj.versions);
563
- }
564
- resolve(appsObj.versions);
565
- }
566
- };
567
- })();
568
-
569
- let cmd = '';
570
- try {
571
- if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) {
572
- appsObj.versions.openssl = process.versions.openssl;
573
- exec('openssl version', (error, stdout) => {
574
- if (!error) {
575
- let openssl_string = stdout.toString().split('\n')[0].trim();
576
- let openssl = openssl_string.split(' ');
577
- appsObj.versions.systemOpenssl = openssl.length > 0 ? openssl[1] : openssl[0];
578
- appsObj.versions.systemOpensslLib = openssl.length > 0 ? openssl[0] : 'openssl';
579
- }
580
- functionProcessed();
581
- });
582
- }
583
- if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) {
584
- exec('npm -v', (error, stdout) => {
585
- if (!error) {
586
- appsObj.versions.npm = stdout.toString().split('\n')[0];
587
- }
588
- functionProcessed();
589
- });
590
- }
591
- if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) {
592
- cmd = 'pm2';
593
- if (_windows) {
594
- cmd += '.cmd';
595
- }
596
- exec(`${cmd} -v`, (error, stdout) => {
597
- if (!error) {
598
- let pm2 = stdout.toString().split('\n')[0].trim();
599
- if (!pm2.startsWith('[PM2]')) {
600
- appsObj.versions.pm2 = pm2;
601
- }
602
- }
603
- functionProcessed();
604
- });
605
- }
606
- if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) {
607
- exec('yarn --version', (error, stdout) => {
608
- if (!error) {
609
- appsObj.versions.yarn = stdout.toString().split('\n')[0];
610
- }
611
- functionProcessed();
612
- });
613
- }
614
- if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) {
615
- cmd = 'gulp';
616
- if (_windows) {
617
- cmd += '.cmd';
618
- }
619
- exec(`${cmd} --version`, (error, stdout) => {
620
- if (!error) {
621
- const gulp = stdout.toString().split('\n')[0] || '';
622
- appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim();
623
- }
624
- functionProcessed();
625
- });
626
- }
627
- if ({}.hasOwnProperty.call(appsObj.versions, 'homebrew')) {
628
- cmd = 'brew';
629
- exec(`${cmd} --version`, (error, stdout) => {
630
- if (!error) {
631
- const brew = stdout.toString().split('\n')[0] || '';
632
- appsObj.versions.homebrew = (brew.toLowerCase().split(' ')[1] || '').trim();
633
- }
634
- functionProcessed();
635
- });
636
- }
637
- if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) {
638
- cmd = 'tsc';
639
- if (_windows) {
640
- cmd += '.cmd';
641
- }
642
- exec(`${cmd} --version`, (error, stdout) => {
643
- if (!error) {
644
- const tsc = stdout.toString().split('\n')[0] || '';
645
- appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim();
646
- }
647
- functionProcessed();
648
- });
649
- }
650
- if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) {
651
- cmd = 'grunt';
652
- if (_windows) {
653
- cmd += '.cmd';
654
- }
655
- exec(`${cmd} --version`, (error, stdout) => {
656
- if (!error) {
657
- const grunt = stdout.toString().split('\n')[0] || '';
658
- appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim();
659
- }
660
- functionProcessed();
661
- });
662
- }
663
- if ({}.hasOwnProperty.call(appsObj.versions, 'git')) {
664
- if (_darwin) {
665
- const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git');
666
- if (util.darwinXcodeExists() || gitHomebrewExists) {
667
- exec('git --version', (error, stdout) => {
668
- if (!error) {
669
- let git = stdout.toString().split('\n')[0] || '';
670
- git = (git.toLowerCase().split('version')[1] || '').trim();
671
- appsObj.versions.git = (git.split(' ')[0] || '').trim();
672
- }
673
- functionProcessed();
674
- });
675
- } else {
676
- functionProcessed();
677
- }
678
- } else {
679
- exec('git --version', (error, stdout) => {
680
- if (!error) {
681
- let git = stdout.toString().split('\n')[0] || '';
682
- git = (git.toLowerCase().split('version')[1] || '').trim();
683
- appsObj.versions.git = (git.split(' ')[0] || '').trim();
684
- }
685
- functionProcessed();
686
- });
687
- }
688
- }
689
- if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) {
690
- exec('apachectl -v 2>&1', (error, stdout) => {
691
- if (!error) {
692
- const apache = (stdout.toString().split('\n')[0] || '').split(':');
693
- appsObj.versions.apache = apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : '';
694
- }
695
- functionProcessed();
696
- });
697
- }
698
- if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) {
699
- exec('nginx -v 2>&1', (error, stdout) => {
700
- if (!error) {
701
- const nginx = stdout.toString().split('\n')[0] || '';
702
- appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim();
703
- }
704
- functionProcessed();
705
- });
706
- }
707
- if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) {
708
- exec('mysql -V', (error, stdout) => {
709
- if (!error) {
710
- let mysql = stdout.toString().split('\n')[0] || '';
711
- mysql = mysql.toLowerCase();
712
- if (mysql.indexOf(',') > -1) {
713
- mysql = (mysql.split(',')[0] || '').trim();
714
- const parts = mysql.split(' ');
715
- appsObj.versions.mysql = (parts[parts.length - 1] || '').trim();
716
- } else {
717
- if (mysql.indexOf(' ver ') > -1) {
718
- mysql = mysql.split(' ver ')[1];
719
- appsObj.versions.mysql = mysql.split(' ')[0];
720
- }
721
- }
722
- }
723
- functionProcessed();
724
- });
725
- }
726
- if ({}.hasOwnProperty.call(appsObj.versions, 'php')) {
727
- exec('php -v', (error, stdout) => {
728
- if (!error) {
729
- const php = stdout.toString().split('\n')[0] || '';
730
- let parts = php.split('(');
731
- if (parts[0].indexOf('-')) {
732
- parts = parts[0].split('-');
733
- }
734
- appsObj.versions.php = parts[0].replace(/[^0-9.]/g, '');
735
- }
736
- functionProcessed();
737
- });
738
- }
739
- if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) {
740
- exec('redis-server --version', (error, stdout) => {
741
- if (!error) {
742
- const redis = stdout.toString().split('\n')[0] || '';
743
- const parts = redis.split(' ');
744
- appsObj.versions.redis = util.getValue(parts, 'v', '=', true);
745
- }
746
- functionProcessed();
747
- });
748
- }
749
- if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) {
750
- exec('docker --version', (error, stdout) => {
751
- if (!error) {
752
- const docker = stdout.toString().split('\n')[0] || '';
753
- const parts = docker.split(' ');
754
- appsObj.versions.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : '';
755
- }
756
- functionProcessed();
757
- });
758
- }
759
- if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) {
760
- exec('postconf -d | grep mail_version', (error, stdout) => {
761
- if (!error) {
762
- const postfix = stdout.toString().split('\n') || [];
763
- appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true);
764
- }
765
- functionProcessed();
766
- });
767
- }
768
- if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) {
769
- exec('mongod --version', (error, stdout) => {
770
- if (!error) {
771
- const mongodb = stdout.toString().split('\n')[0] || '';
772
- appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, '');
773
- }
774
- functionProcessed();
775
- });
776
- }
777
- if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) {
778
- if (_linux) {
779
- exec('locate bin/postgres', (error, stdout) => {
780
- if (!error) {
781
- const safePath = /^[a-zA-Z0-9/_.-]+$/;
782
- const postgresqlBin = stdout
783
- .toString()
784
- .split('\n')
785
- .filter((p) => safePath.test(p.trim()))
786
- .sort();
787
- if (postgresqlBin.length) {
788
- execFile(postgresqlBin[postgresqlBin.length - 1], ['-V'], (error, stdout) => {
789
- if (!error) {
790
- const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
791
- appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
792
- }
793
- functionProcessed();
794
- });
795
- } else {
796
- functionProcessed();
797
- }
798
- } else {
799
- exec('psql -V', (error, stdout) => {
800
- if (!error) {
801
- const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
802
- appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
803
- appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0];
804
- }
805
- functionProcessed();
806
- });
807
- }
808
- });
809
- } else {
810
- if (_windows) {
811
- util.powerShell('Get-CimInstance Win32_Service | select caption | fl').then((stdout) => {
812
- let serviceSections = stdout.split(/\n\s*\n/);
813
- serviceSections.forEach((item) => {
814
- if (item.trim() !== '') {
815
- let lines = item.trim().split('\r\n');
816
- let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase();
817
- if (srvCaption.indexOf('postgresql') > -1) {
818
- const parts = srvCaption.split(' server ');
819
- if (parts.length > 1) {
820
- appsObj.versions.postgresql = parts[1];
821
- }
822
- }
823
- }
824
- });
825
- functionProcessed();
826
- });
827
- } else {
828
- exec('postgres -V', (error, stdout) => {
829
- if (!error) {
830
- const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
831
- appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
832
- if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
833
- appsObj.versions.postgresql = postgresql[postgresql.length - 2];
834
- }
835
- functionProcessed();
836
- } else {
837
- exec('pg_config --version', (error, stdout) => {
838
- if (!error) {
839
- const postgresql = stdout.toString().split('\n')[0].split(' ') || [];
840
- appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : '';
841
- if (appsObj.versions.postgresql.includes('(') && postgresql.length >= 2 && !postgresql[postgresql.length - 2].includes('(')) {
842
- appsObj.versions.postgresql = postgresql[postgresql.length - 2];
843
- }
844
- }
845
- functionProcessed();
846
- });
847
- }
848
- });
849
- }
850
- }
851
- }
852
- if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) {
853
- exec('perl -v', (error, stdout) => {
854
- if (!error) {
855
- const perl = stdout.toString().split('\n') || '';
856
- while (perl.length > 0 && perl[0].trim() === '') {
857
- perl.shift();
858
- }
859
- if (perl.length > 0) {
860
- appsObj.versions.perl = perl[0].split('(').pop().split(')')[0].replace('v', '');
861
- }
862
- }
863
- functionProcessed();
864
- });
865
- }
866
- if ({}.hasOwnProperty.call(appsObj.versions, 'python')) {
867
- if (_darwin) {
868
- try {
869
- const stdout = execSync('sw_vers');
870
- const lines = stdout.toString().split('\n');
871
- const osVersion = util.getValue(lines, 'ProductVersion', ':');
872
- const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python');
873
- const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python');
874
- if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) {
875
- const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1';
876
- exec(cmd, (error, stdout) => {
877
- if (!error) {
878
- const python = stdout.toString().split('\n')[0] || '';
879
- appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
880
- }
881
- functionProcessed();
882
- });
883
- } else {
884
- functionProcessed();
885
- }
886
- } catch {
887
- functionProcessed();
888
- }
889
- } else {
890
- exec('python -V 2>&1', (error, stdout) => {
891
- if (!error) {
892
- const python = stdout.toString().split('\n')[0] || '';
893
- appsObj.versions.python = python.toLowerCase().replace('python', '').trim();
894
- }
895
- functionProcessed();
896
- });
897
- }
898
- }
899
- if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) {
900
- if (_darwin) {
901
- const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3');
902
- if (util.darwinXcodeExists() || gitHomebrewExists) {
903
- exec('python3 -V 2>&1', (error, stdout) => {
904
- if (!error) {
905
- const python = stdout.toString().split('\n')[0] || '';
906
- appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
907
- }
908
- functionProcessed();
909
- });
910
- } else {
911
- functionProcessed();
912
- }
913
- } else {
914
- exec('python3 -V 2>&1', (error, stdout) => {
915
- if (!error) {
916
- const python = stdout.toString().split('\n')[0] || '';
917
- appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim();
918
- }
919
- functionProcessed();
920
- });
921
- }
922
- }
923
- if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) {
924
- if (_darwin) {
925
- const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip');
926
- if (util.darwinXcodeExists() || gitHomebrewExists) {
927
- exec('pip -V 2>&1', (error, stdout) => {
928
- if (!error) {
929
- const pip = stdout.toString().split('\n')[0] || '';
930
- const parts = pip.split(' ');
931
- appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
932
- }
933
- functionProcessed();
934
- });
935
- } else {
936
- functionProcessed();
937
- }
938
- } else {
939
- exec('pip -V 2>&1', (error, stdout) => {
940
- if (!error) {
941
- const pip = stdout.toString().split('\n')[0] || '';
942
- const parts = pip.split(' ');
943
- appsObj.versions.pip = parts.length >= 2 ? parts[1] : '';
944
- }
945
- functionProcessed();
946
- });
947
- }
948
- }
949
- if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) {
950
- if (_darwin) {
951
- const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3');
952
- if (util.darwinXcodeExists() || gitHomebrewExists) {
953
- exec('pip3 -V 2>&1', (error, stdout) => {
954
- if (!error) {
955
- const pip = stdout.toString().split('\n')[0] || '';
956
- const parts = pip.split(' ');
957
- appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
958
- }
959
- functionProcessed();
960
- });
961
- } else {
962
- functionProcessed();
963
- }
964
- } else {
965
- exec('pip3 -V 2>&1', (error, stdout) => {
966
- if (!error) {
967
- const pip = stdout.toString().split('\n')[0] || '';
968
- const parts = pip.split(' ');
969
- appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : '';
970
- }
971
- functionProcessed();
972
- });
973
- }
974
- }
975
- if ({}.hasOwnProperty.call(appsObj.versions, 'java')) {
976
- if (_darwin) {
977
- // check if any JVM is installed but avoid dialog box that Java needs to be installed
978
- exec('/usr/libexec/java_home -V 2>&1', (error, stdout) => {
979
- if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) {
980
- // now this can be done savely
981
- exec('java -version 2>&1', (error, stdout) => {
982
- if (!error) {
983
- const java = stdout.toString().split('\n')[0] || '';
984
- const parts = java.split('"');
985
- appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
986
- }
987
- functionProcessed();
988
- });
989
- } else {
990
- functionProcessed();
991
- }
992
- });
993
- } else {
994
- exec('java -version 2>&1', (error, stdout) => {
995
- if (!error) {
996
- const java = stdout.toString().split('\n')[0] || '';
997
- const parts = java.split('"');
998
- appsObj.versions.java = parts.length === 3 ? parts[1].trim() : '';
999
- }
1000
- functionProcessed();
1001
- });
1002
- }
1003
- }
1004
- if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) {
1005
- if ((_darwin && util.darwinXcodeExists()) || !_darwin) {
1006
- exec('gcc -dumpversion', (error, stdout) => {
1007
- if (!error) {
1008
- appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || '';
1009
- }
1010
- if (appsObj.versions.gcc.indexOf('.') > -1) {
1011
- functionProcessed();
1012
- } else {
1013
- exec('gcc --version', (error, stdout) => {
1014
- if (!error) {
1015
- const gcc = stdout.toString().split('\n')[0].trim();
1016
- if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) {
1017
- const parts = gcc.split(')');
1018
- appsObj.versions.gcc = parts[1].trim() || appsObj.versions.gcc;
1019
- }
1020
- }
1021
- functionProcessed();
1022
- });
1023
- }
1024
- });
1025
- } else {
1026
- functionProcessed();
1027
- }
1028
- }
1029
- if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) {
1030
- exec(util.getVboxmanage() + ' -v 2>&1', (error, stdout) => {
1031
- if (!error) {
1032
- const vbox = stdout.toString().split('\n')[0] || '';
1033
- const parts = vbox.split('r');
1034
- appsObj.versions.virtualbox = parts[0];
1035
- }
1036
- functionProcessed();
1037
- });
1038
- }
1039
- if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) {
1040
- exec('bash --version', (error, stdout) => {
1041
- if (!error) {
1042
- const line = stdout.toString().split('\n')[0];
1043
- const parts = line.split(' version ');
1044
- if (parts.length > 1) {
1045
- appsObj.versions.bash = parts[1].split(' ')[0].split('(')[0];
1046
- }
1047
- }
1048
- functionProcessed();
1049
- });
1050
- }
1051
- if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) {
1052
- exec('zsh --version', (error, stdout) => {
1053
- if (!error) {
1054
- const line = stdout.toString().split('\n')[0];
1055
- const parts = line.split('zsh ');
1056
- if (parts.length > 1) {
1057
- appsObj.versions.zsh = parts[1].split(' ')[0];
1058
- }
1059
- }
1060
- functionProcessed();
1061
- });
1062
- }
1063
- if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) {
1064
- exec('fish --version', (error, stdout) => {
1065
- if (!error) {
1066
- const line = stdout.toString().split('\n')[0];
1067
- const parts = line.split(' version ');
1068
- if (parts.length > 1) {
1069
- appsObj.versions.fish = parts[1].split(' ')[0];
1070
- }
1071
- }
1072
- functionProcessed();
1073
- });
1074
- }
1075
- if ({}.hasOwnProperty.call(appsObj.versions, 'bun')) {
1076
- exec('bun -v', (error, stdout) => {
1077
- if (!error) {
1078
- const line = stdout.toString().split('\n')[0].trim();
1079
- appsObj.versions.bun = line;
1080
- }
1081
- functionProcessed();
1082
- });
1083
- }
1084
- if ({}.hasOwnProperty.call(appsObj.versions, 'deno')) {
1085
- exec('deno -v', (error, stdout) => {
1086
- if (!error) {
1087
- const line = stdout.toString().split('\n')[0].trim();
1088
- const parts = line.split(' ');
1089
- if (parts.length > 1) {
1090
- appsObj.versions.deno = parts[1];
1091
- }
1092
- }
1093
- functionProcessed();
1094
- });
1095
- }
1096
- if ({}.hasOwnProperty.call(appsObj.versions, 'node')) {
1097
- exec('node -v', (error, stdout) => {
1098
- if (!error) {
1099
- let line = stdout.toString().split('\n')[0].trim();
1100
- if (line.startsWith('v')) {
1101
- line = line.slice(1);
1102
- }
1103
- appsObj.versions.node = line;
1104
- }
1105
- functionProcessed();
1106
- });
1107
- }
1108
- if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) {
1109
- if (_windows) {
1110
- util.powerShell('$PSVersionTable').then((stdout) => {
1111
- const lines = stdout
1112
- .toString()
1113
- .toLowerCase()
1114
- .split('\n')
1115
- .map((line) => line.replace(/ +/g, ' ').replace(/ +/g, ':'));
1116
- appsObj.versions.powershell = util.getValue(lines, 'psversion');
1117
- functionProcessed();
1118
- });
1119
- } else {
1120
- functionProcessed();
1121
- }
1122
- }
1123
- if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
1124
- if (_windows) {
1125
- util
1126
- .powerShell(
1127
- 'gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release'
1128
- )
1129
- .then((stdout) => {
1130
- const lines = stdout.toString().split('\r\n');
1131
- let dotnet = '';
1132
- lines.forEach((line) => {
1133
- line = line.replace(/ +/g, ' ');
1134
- const parts = line.split(' ');
1135
- dotnet =
1136
- dotnet ||
1137
- (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '');
1138
- });
1139
- appsObj.versions.dotnet = dotnet.trim();
1140
- functionProcessed();
1141
- });
1142
- } else {
1143
- functionProcessed();
1144
- }
1145
- }
1146
- } catch {
1147
- if (callback) {
1148
- callback(appsObj.versions);
1149
- }
1150
- resolve(appsObj.versions);
1151
- }
1152
- });
1153
- });
1154
- }
1155
-
1156
- exports.versions = versions;
1157
-
1158
- function shell(callback) {
1159
- return new Promise((resolve) => {
1160
- process.nextTick(() => {
1161
- if (_windows) {
1162
- try {
1163
- util.powerShell(`Get-CimInstance -className win32_process | where-object {$_.ProcessId -eq ${process.ppid} } | select Name`).then((stdout) => {
1164
- let result = 'CMD';
1165
- if (stdout) {
1166
- if (stdout.toString().toLowerCase().indexOf('powershell') >= 0) {
1167
- result = 'PowerShell';
1168
- }
1169
- }
1170
- if (callback) {
1171
- callback(result);
1172
- }
1173
- resolve(result);
1174
- });
1175
- } catch {
1176
- if (callback) {
1177
- callback('CMD');
1178
- }
1179
- resolve('CMD');
1180
- }
1181
- } else {
1182
- let result = '';
1183
- exec('echo $SHELL', (error, stdout) => {
1184
- if (!error) {
1185
- result = stdout.toString().split('\n')[0];
1186
- }
1187
- if (callback) {
1188
- callback(result);
1189
- }
1190
- resolve(result);
1191
- });
1192
- }
1193
- });
1194
- });
1195
- }
1196
-
1197
- exports.shell = shell;
1198
-
1199
- function getUniqueMacAdresses() {
1200
- let macs = [];
1201
- try {
1202
- const ifaces = os.networkInterfaces();
1203
- for (let dev in ifaces) {
1204
- if ({}.hasOwnProperty.call(ifaces, dev)) {
1205
- ifaces[dev].forEach((details) => {
1206
- if (details && details.mac && details.mac !== '00:00:00:00:00:00') {
1207
- const mac = details.mac.toLowerCase();
1208
- if (macs.indexOf(mac) === -1) {
1209
- macs.push(mac);
1210
- }
1211
- }
1212
- });
1213
- }
1214
- }
1215
- macs = macs.sort((a, b) => {
1216
- if (a < b) {
1217
- return -1;
1218
- }
1219
- if (a > b) {
1220
- return 1;
1221
- }
1222
- return 0;
1223
- });
1224
- } catch {
1225
- macs.push('00:00:00:00:00:00');
1226
- }
1227
- return macs;
1228
- }
1229
-
1230
- function uuid(callback) {
1231
- return new Promise((resolve) => {
1232
- process.nextTick(() => {
1233
- let result = {
1234
- os: '',
1235
- hardware: '',
1236
- macs: getUniqueMacAdresses()
1237
- };
1238
- let parts;
1239
-
1240
- if (_darwin) {
1241
- exec('system_profiler SPHardwareDataType -json', (error, stdout) => {
1242
- if (!error) {
1243
- try {
1244
- const jsonObj = JSON.parse(stdout.toString());
1245
- if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) {
1246
- const spHardware = jsonObj.SPHardwareDataType[0];
1247
- result.os = spHardware.platform_UUID.toLowerCase();
1248
- result.hardware = spHardware.serial_number;
1249
- }
1250
- } catch {
1251
- util.noop();
1252
- }
1253
- }
1254
- if (callback) {
1255
- callback(result);
1256
- }
1257
- resolve(result);
1258
- });
1259
- }
1260
- if (_linux) {
1261
- const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null ||
1262
- cat /etc/machine-id 2> /dev/null; echo;
1263
- echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
1264
- exec(cmd, (error, stdout) => {
1265
- const lines = stdout.toString().split('\n');
1266
- result.os = util.getValue(lines, 'os').toLowerCase();
1267
- result.hardware = util.getValue(lines, 'hardware').toLowerCase();
1268
- if (!result.hardware) {
1269
- try {
1270
- const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n');
1271
- const serial = util.getValue(lines, 'serial');
1272
- result.hardware = serial || '';
1273
- } catch {
1274
- result.hardware = '';
1275
- }
1276
- }
1277
- if (callback) {
1278
- callback(result);
1279
- }
1280
- resolve(result);
1281
- });
1282
- }
1283
- if (_freebsd || _openbsd || _netbsd) {
1284
- exec('sysctl -i kern.hostid kern.hostuuid', (error, stdout) => {
1285
- const lines = stdout.toString().split('\n');
1286
- result.hardware = util.getValue(lines, 'kern.hostid', ':').toLowerCase();
1287
- result.os = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase();
1288
- if (result.os.indexOf('unknown') >= 0) {
1289
- result.os = '';
1290
- }
1291
- if (result.hardware.indexOf('unknown') >= 0) {
1292
- result.hardware = '';
1293
- }
1294
- if (callback) {
1295
- callback(result);
1296
- }
1297
- resolve(result);
1298
- });
1299
- }
1300
- if (_windows) {
1301
- let sysdir = '%windir%\\System32';
1302
- if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
1303
- sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
1304
- }
1305
- util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
1306
- let lines = stdout.split('\r\n');
1307
- result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
1308
- exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, (error, stdout) => {
1309
- parts = stdout.toString().split('\n\r')[0].split('REG_SZ');
1310
- result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/gi, '').toLowerCase() : '';
1311
- if (callback) {
1312
- callback(result);
1313
- }
1314
- resolve(result);
1315
- });
1316
- });
1317
- }
1318
- });
1319
- });
1320
- }
1321
-
1322
- exports.uuid = uuid;