gucci-on-fleek / lockdown-browser

Run the ”Respondus Lockdown Browser“ in the ”Windows Sandbox“
Other
131 stars 25 forks source link

Does Not Work For Lockdown Browser OEM #64

Open geckonood opened 7 months ago

geckonood commented 7 months ago

I've followed all suggestions made in previous tickets, none worked.

Here is my sandbox_run.ps1 :

# Lockdown Browser in Windows Sandbox
# https://github.com/gucci-on-fleek/lockdown-browser
# SPDX-License-Identifier: MPL-2.0+
# SPDX-FileCopyrightText: 2020-2024 gucci-on-fleek

# DON'T RUN THIS ON YOUR REGULAR SYSTEM! IT WILL CAUSE **IRREVERSIBLE** DAMAGE

$ErrorActionPreference = "Stop"
Set-StrictMode -Version 3

cd $PSScriptRoot

$lockdown_extract_dir = "C:\Windows\Temp\Lockdown"
$lockdown_runtime = "C:\Program Files (x86)\Respondus\LockDown Browser OEM\LockDownBrowserOEM.exe"
$lockdown_installer = (ls Lockdown*)[0]

Get-ChildItem -Path "HKLM:\HARDWARE\DESCRIPTION" | Remove-ItemProperty -Name SystemBiosVersion -ErrorAction Ignore
rm HKLM:\HARDWARE\DESCRIPTION\System\BIOS -ErrorAction Ignore

# We're in a short-lived VM, so we can safely delete any necessary files
$vmcompute_path = "C:\Windows\System32\VmComputeAgent.exe"
takeown /f $vmcompute_path
icacls $vmcompute_path /grant "Everyone:(D)"
rm $vmcompute_path

& $lockdown_installer /x "`"$lockdown_extract_dir`"" # Dumb installer needs a quoted path, even with no spaces. Also, we have to extract the program before we can even run a silent install.
while (!(Test-Path $lockdown_extract_dir\id.txt)) {
    # This is the easiest way to detect if the installer is finished extracting
    sleep 0.2
}
sleep 1
kill -Name *Lockdown*

& "$lockdown_extract_dir\setup.exe" /s "/f1$PSScriptRoot\setup.iss" "/f2$PSScriptRoot\..\setup.log" # If we don't give a log file path, this doesn't work
Wait-Process -Name "setup"

# Support use of the `rldb://` URL protocol
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\rldb\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\anst\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\cllb\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\ielb\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\ldb\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')
Set-ItemProperty -ErrorAction Ignore -Path "HKCR:\ldb1\shell\open\command" -Name "(Default)" -Value ('"' + $PSScriptRoot + '\withdll.exe" "/d:' + $PSScriptRoot + '\GetSystemMetrics-Hook.dll" ' + $lockdown_runtime + ' "%1"')

./withdll /d:GetSystemMetrics-Hook.dll $lockdown_runtime`

Then I build, run the Sandbox, Install the Lockdown Browser OEM, and run the: .\withdll.exe /d:GetSystemMetrics-Hook.dll "C:\Program Files (x86)\Respondus\LockDown Browser OEM\LockDownBrowserOEM.exe" "%1"

When I Open Lockdown Browser with the exam link, i get the following error:
image

gucci-on-fleek commented 6 months ago

So the trick here is to figure out what URL protocol your school's site is using to launch the Lockdown Browser. I've put most of the common ones in the script, but there seems to be a near-infinite number.

One way to figure out which protocol is used is to hover over or copy the ”Launch” link and see what comes before the ://; another way is to search through HKEY_CLASSES_ROOT (using regedit.exe) for the path to the Browser (C:\Program Files (x86)\Respondus\LockDown Browser OEM\LockDownBrowserOEM.exe in this case).

But I'd check #65 and https://github.com/gucci-on-fleek/lockdown-browser/discussions/53#discussioncomment-8909229 before trying this since many people have been having issues lately.