Skip to content

Instantly share code, notes, and snippets.

@iqbmo04
Forked from AndreBaumeier/find-log4j.sh
Created December 10, 2021 23:15
Show Gist options
  • Select an option

  • Save iqbmo04/de870f8023b3a83797aefcefd3b0d44d to your computer and use it in GitHub Desktop.

Select an option

Save iqbmo04/de870f8023b3a83797aefcefd3b0d44d to your computer and use it in GitHub Desktop.
find log4j usages within your java applications. Requires installed JRE and jdeps.
#!/bin/bash
find . -type f -name '*jar' | while read line; do
LOG4JUSAGE=''
#echo "Processing file '$line'"
LOG4JUSAGE=$(jdeps "$line"|grep -i log4)
[ ! -z "$LOG4JUSAGE" ]
if [ ! -z "$LOG4JUSAGE" ]
then
echo "Processing file '$line'"
echo "found log4 references"
echo "$LOG4JUSAGE"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment