Skip to content

Instantly share code, notes, and snippets.

@deftoner
Created December 21, 2021 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deftoner/9035fc18e7c729e6e2fd3a6538519501 to your computer and use it in GitHub Desktop.
Save deftoner/9035fc18e7c729e6e2fd3a6538519501 to your computer and use it in GitHub Desktop.
@Echo off
:: EventSentry Validation Script to search LOG4J Vulnerable libraries in all local hard drives.
ECHO Vulnerable Log4J Libraries Found (if any):
for /F "skip=1" %%C in ('%SystemRoot%\System32\wbem\wmic logicaldisk where drivetype^=3 get caption') do for /F %%D in ("%%C") do PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "gci %%D\ -rec -force -include log4j*.jar -ea 0 | foreach {select-string "JndiLookup.class" $_} | select -exp Path" | %SystemRoot%\System32\findstr.exe /V "2.16 2.17 2.18"
IF %ERRORLEVEL% == 0 EXIT /B 1
IF %ERRORLEVEL% == 1 EXIT /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment