-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Add a param block similar to the following:
[CmdletBinding()]
param (
[Parameter(Mandatory=$false)][int]$usrScanscope = $env:usrScanscope,
[Parameter(Mandatory=$false)][bool]$usrUpdateDefs = $env:usrUpdateDefs,
[Parameter(Mandatory=$false)][char]$usrMitigate = $env:usrMitigate
)
Use this to get the location of the script itself, not the current directory:
$scriptObject = Get-Item -Path $script:PSCommandPath
$script:workingPath = $($scriptObject.DirectoryName)
So that this:
foreach ($iteration in ('yara32.exe','yara64.exe')) {
if (!(test-path $iteration)) {
write-host "! ERROR: $iteration not found. It needs to be in the same directory as the script."
write-host " Download Yara from https://github.com/virustotal/yara/releases/latest and place them here."
exit 1
} else {
write-host "- Verified presence of $iteration."
}
becomes this
foreach ($iteration in ('yara32.exe','yara64.exe')) {
if (!(test-path "$script:workingPath\$iteration")) {
write-host "! ERROR: $iteration not found. It needs to be in the same directory as the script."
write-host " Download Yara from https://github.com/virustotal/yara/releases/latest and place them here."
exit 1
} else {
write-host "- Verified presence of $iteration."
}
Hope this helps 😊
Edit: Link to the fork which implements these changes: https://github.com/ProVal-Tech/log4shell-tool
Metadata
Metadata
Assignees
Labels
No labels