Update samy.ps1
This commit is contained in:
17
samy.ps1
17
samy.ps1
@@ -1826,29 +1826,12 @@ function Invoke-GetPrinters {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read JSON body: { "password": "..." }
|
|
||||||
$rawBody = (New-Object IO.StreamReader $Context.Request.InputStream).ReadToEnd()
|
|
||||||
if (-not $rawBody) {
|
|
||||||
$Context.Response.StatusCode = 400
|
|
||||||
Send-Text $Context 'Missing request body.'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$body = $rawBody | ConvertFrom-Json
|
|
||||||
} catch {
|
|
||||||
$Context.Response.StatusCode = 400
|
|
||||||
Send-Text $Context 'Invalid JSON body.'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# Allow blank password (IP allowlist handled server-side)
|
# Allow blank password (IP allowlist handled server-side)
|
||||||
$password = [string]$body.password # $null -> ''
|
$password = [string]$body.password # $null -> ''
|
||||||
if ($password -eq '') {
|
if ($password -eq '') {
|
||||||
Write-LogHybrid "Printer password is blank; relying on allowlisted IP (server-side)." Info Printers -LogToEvent
|
Write-LogHybrid "Printer password is blank; relying on allowlisted IP (server-side)." Info Printers -LogToEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$uri = 'https://bananas.svstools.ca/getprinters'
|
$uri = 'https://bananas.svstools.ca/getprinters'
|
||||||
Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent
|
Write-LogHybrid "Fetching printers from $uri" Info Printers -LogToEvent
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user