Created
February 4, 2020 14:40
-
-
Save bitkill/87cf9d114610de1433d54bfd658bd198 to your computer and use it in GitHub Desktop.
Jar class collision finder
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 | |
if [ $# == 0 ]; then | |
dir='.' | |
elif [ $# == 1 ]; then | |
dir=$1 | |
else | |
echo "Usage: $0 [dir]"; | |
exit 1; | |
fi | |
for lib in `find $dir -name '*.jar'`; do | |
for class in `unzip -l $lib | egrep -o '[^ ]*.class$'`; do | |
class=`echo $class | sed s/\\\\.class// | sed s/[-.\\/$]/_/g` | |
existing=$( eval "echo \$CLS_${class}" ) | |
if [ -n "$existing" ]; then echo "$lib $existing"; fi | |
eval CLS_${class}="\"${lib} ${existing}\"" | |
done | |
done | sort | uniq -c | sort -nr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment