@letitbexai_root/lexxit-automation-framework 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -250,10 +250,37 @@ Invoke-WebRequest -Uri $TightVncMsiUrl -OutFile $tvncMsi -UseBasicParsing
|
|
|
250
250
|
# following /i is always a genuine fresh install, which does apply every
|
|
251
251
|
# property correctly. /x against the same MSI package is a no-op (not an
|
|
252
252
|
# error) when TightVNC isn't installed yet, so this is safe on every run.
|
|
253
|
-
|
|
253
|
+
#
|
|
254
|
+
# Both steps below check msiexec's exit code and wait for the service to
|
|
255
|
+
# actually disappear/reappear rather than just firing /x then /i back to
|
|
256
|
+
# back and trusting it. Found the hard way on a real VM: a `msiexec /i`
|
|
257
|
+
# that reports exit code 0 does not guarantee the tvnserver service
|
|
258
|
+
# actually got registered - after enough uninstall/reinstall churn, Windows
|
|
259
|
+
# Installer's own service-management custom actions (InstallServices/
|
|
260
|
+
# RegService/StartService) can silently no-op while the outer process still
|
|
261
|
+
# exits 0, leaving TightVNC uninstalled and NOTHING listening on 5900 (worse
|
|
262
|
+
# than the wrong-password bug this was meant to fix, and invisible under
|
|
263
|
+
# /quiet with no exit-code or service check). A reboot reliably clears
|
|
264
|
+
# whatever Windows-side state causes this; the exit-code and service-wait
|
|
265
|
+
# checks here exist so a silent failure throws loudly instead of leaving a
|
|
266
|
+
# half-broken agent that looks like it installed fine. /l*v below logs the
|
|
267
|
+
# full MSI trace to %TEMP%\tvnc_install.log for exactly this class of
|
|
268
|
+
# "exit 0 but nothing happened" failure, next time it needs debugging.
|
|
269
|
+
$uninstallResult = Start-Process msiexec.exe -ArgumentList @("/x", "`"$tvncMsi`"", "/quiet", "/norestart") -Wait -NoNewWindow -PassThru
|
|
270
|
+
# 1605 = ERROR_UNKNOWN_PRODUCT - not installed yet, not a failure.
|
|
271
|
+
if ($uninstallResult.ExitCode -ne 0 -and $uninstallResult.ExitCode -ne 1605) {
|
|
272
|
+
Write-Warning "[lexxit] TightVNC uninstall returned exit code $($uninstallResult.ExitCode) - continuing, but the reinstall below may fail too."
|
|
273
|
+
}
|
|
274
|
+
$waited = 0
|
|
275
|
+
while ((Get-Service tvnserver -ErrorAction SilentlyContinue) -and $waited -lt 30) {
|
|
276
|
+
Start-Sleep -Seconds 1
|
|
277
|
+
$waited++
|
|
278
|
+
}
|
|
254
279
|
|
|
280
|
+
$tvncLogPath = Join-Path $env:TEMP "tvnc_install.log"
|
|
255
281
|
$msiArgs = @(
|
|
256
282
|
"/i", "`"$tvncMsi`"", "/quiet", "/norestart",
|
|
283
|
+
"/l*v", "`"$tvncLogPath`"",
|
|
257
284
|
"ADDLOCAL=Server",
|
|
258
285
|
"SERVER_REGISTER_AS_SERVICE=1",
|
|
259
286
|
"SERVER_ADD_FIREWALL_EXCEPTION=1",
|
|
@@ -272,24 +299,31 @@ $msiArgs = @(
|
|
|
272
299
|
# hand-rolling that obfuscation wrong fails silently into the exact same
|
|
273
300
|
# "VNC authentication failed" this script already had to debug once.
|
|
274
301
|
"SET_PASSWORD=1", "VALUE_OF_PASSWORD=$VncPassword",
|
|
275
|
-
"SET_ALLOWLOOPBACK=1", "VALUE_OF_ALLOWLOOPBACK=1"
|
|
276
|
-
#
|
|
277
|
-
#
|
|
278
|
-
#
|
|
279
|
-
#
|
|
280
|
-
#
|
|
281
|
-
#
|
|
282
|
-
#
|
|
283
|
-
#
|
|
284
|
-
#
|
|
285
|
-
#
|
|
286
|
-
#
|
|
287
|
-
# every other property above) is guaranteed to re-apply every single
|
|
288
|
-
# time this script runs, install or reinstall alike. Confirmed the hard
|
|
289
|
-
# way: a real VM's live view broke from exactly this gap.
|
|
290
|
-
"REINSTALL=ALL", "REINSTALLMODE=vomus"
|
|
302
|
+
"SET_ALLOWLOOPBACK=1", "VALUE_OF_ALLOWLOOPBACK=1"
|
|
303
|
+
# Deliberately NO REINSTALL=ALL / REINSTALLMODE here. Both were tried
|
|
304
|
+
# (see git history) and are actively harmful alongside the uninstall
|
|
305
|
+
# above: REINSTALL=ALL means "reinstall the features that are already
|
|
306
|
+
# installed", and since the /x just removed them all, that resolves to
|
|
307
|
+
# "install nothing" - which SILENTLY OVERRIDES the ADDLOCAL=Server
|
|
308
|
+
# above. Proven from an MSI verbose log on a real VM: every component
|
|
309
|
+
# came out "Request: Null; Action: Null", with "Skipping action:
|
|
310
|
+
# RegService (condition is false)" / "Skipping action: StartService
|
|
311
|
+
# (condition is false)", and msiexec still exited 0 having installed
|
|
312
|
+
# nothing at all. The uninstall above is what guarantees a genuinely
|
|
313
|
+
# fresh install, so these flags bought nothing and broke everything.
|
|
291
314
|
)
|
|
292
|
-
Start-Process msiexec.exe -ArgumentList $msiArgs -Wait -NoNewWindow
|
|
315
|
+
$installResult = Start-Process msiexec.exe -ArgumentList $msiArgs -Wait -NoNewWindow -PassThru
|
|
316
|
+
if ($installResult.ExitCode -ne 0) {
|
|
317
|
+
throw "[lexxit] TightVNC install failed with exit code $($installResult.ExitCode) - msiexec /i did not succeed, nothing is listening on 5900. Check $tvncLogPath for details."
|
|
318
|
+
}
|
|
319
|
+
$waited = 0
|
|
320
|
+
while (-not (Get-Service tvnserver -ErrorAction SilentlyContinue) -and $waited -lt 30) {
|
|
321
|
+
Start-Sleep -Seconds 1
|
|
322
|
+
$waited++
|
|
323
|
+
}
|
|
324
|
+
if (-not (Get-Service tvnserver -ErrorAction SilentlyContinue)) {
|
|
325
|
+
throw "[lexxit] TightVNC install reported success but the tvnserver service never appeared after ${waited}s. Check $tvncLogPath for details - a reboot of this VM has resolved this before."
|
|
326
|
+
}
|
|
293
327
|
# TightVNC's "service mode" specifically captures the active CONSOLE
|
|
294
328
|
# session regardless of which account is logged on there - that is the
|
|
295
329
|
# whole point of running it as a service, and it is NOT the generic
|