@@ -404,6 +404,7 @@ Write-Log -Text "Scanning $($arrFiles.Length) total files for potential vulnerab
404
404
# scan i: JARs containing vulnerable Log4j code
405
405
Write-Log - Text " Scanning for JAR files containing potentially insecure Log4j code."
406
406
$arrFiles | Where-Object {$_ -match ' \.jar$' } | ForEach-Object {
407
+ Write-Verbose - Message " Running insecure code scan on file '$_ '"
407
408
if (Select-String - Quiet - Path $_ " JndiLookup.class" ) {
408
409
Write-Log - Text " ! ALERT: Potentially vulnerable file at $ ( $_ ) !" - Type WARN
409
410
$script :varDetection = 1
@@ -414,6 +415,7 @@ if(-not $skipYARA) {
414
415
# scan ii: YARA for logfiles & JARs
415
416
Write-Log - Text " Scanning LOGs, TXTs and JARs for common attack strings via YARA scan."
416
417
foreach ($file in $arrFiles ) {
418
+ Write-Verbose - Message " Running YARA scan on file '$file '"
417
419
if ($file -notmatch " Find-L4JVulnerabilities|yara-log|luna-log|L4Jdetections|L4JConsoleLog|luna\.log" ) {
418
420
$yaResult = $null
419
421
$yaResult = cmd / c " "" $workingPath \yara$varch .exe"" "" $workingPath \yara.yar"" "" $file "" -s"
@@ -432,15 +434,18 @@ if(-not $skipYARA) {
432
434
}
433
435
}
434
436
435
- Write-Log - Text " - Scanning for known vulnerable libraries via Luna scan. "
437
+ Write-Log - Text " Scanning for known vulnerable libraries via Luna scan"
436
438
Write-Log - Text " Ref: https://github.com/lunasec-io/lunasec/tree/master/tools/log4shell"
437
439
$lunaUrl = " https://github.com/lunasec-io/lunasec/releases/download/v1.6.1-log4shell/log4shell_1.6.1-log4shell_Windows_x86_64.exe"
438
440
$lunaPath = " $workingPath \log4shell.exe"
441
+ Write-Log - Text " Downloading Luna scanner (log4shell)"
439
442
Remove-Item - Path $lunaPath - Force - ErrorAction SilentlyContinue
440
443
[Net.ServicePointManager ]::SecurityProtocol = [Enum ]::ToObject([Net.SecurityProtocolType ], 3072 )
441
444
(New-Object System.Net.WebClient).DownloadFile($lunaUrl , $lunaPath )
442
445
foreach ($drive in $script :varDrives ) {
443
- $lunaResults = @ (cmd / c " "" $lunaPath "" s --json $drive \ 2>&1" )
446
+ Write-Log - Text " Starting Luna scan for drive '$drive '"
447
+ $lunaResults = @ (cmd / c " "" $lunaPath "" scan --ignore-warnings --no-follow-symlinks --json $drive \ 2>&1" )
448
+ Write-Log - Text " Completed Luna scan for drive '$drive '"
444
449
Add-Content - Value $lunaResults - Path $lunaLog
445
450
foreach ($entry in $lunaResults ) {
446
451
if ($entry -match " "" severity"" :" ) {
0 commit comments