Created
December 10, 2021 18:38
-
-
Save atomicturtle/130081b387562b753edd9adb0bc1d19f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Skip Grube | |
# Contributors: | |
# - Scott Shinn | |
# - Rob Felsburg | |
VERSION=0.2 | |
# Search for jar files named "log4j", and jar files that contain a file named "log4j" | |
# Display the results with a "@FOUND" tag for grep'ing later: | |
echo | |
echo "log4j search utility (Log4Shell: RCE 0-day) by Skip Grube" | |
echo "Version ${VERSION}" | |
echo -n "Updating mlocate database:" | |
updatedb | |
if [ $? -eq 0 ]; then | |
echo COMPLETE | |
else | |
echo FAILED | |
fi | |
( | |
echo "log4j filenames: ############################################" | |
jarFiles=`locate -i *.jar` | |
echo "${jarFiles}" | grep -i "log4j" | xargs -n 1 -I {} echo '@FOUND :: {}' | |
echo "########################################################### | |
" | |
echo "inspect jar files for log4j: #######################################" | |
IFS=' | |
' | |
for i in `echo "${jarFiles}"`; do | |
for j in `unzip -l "${i}" | grep -i "log4j"`; do | |
echo "@FOUND_FILE :: ${i} :: ${j}" | |
done | |
done | |
) &> $HOME/`hostname`_log4j_find.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment