Skip to content

Instantly share code, notes, and snippets.

@3XclusiVe
Last active June 22, 2018 21:28
Show Gist options
  • Save 3XclusiVe/b05015ac027cf9c3428cc8f6295bf327 to your computer and use it in GitHub Desktop.
Save 3XclusiVe/b05015ac027cf9c3428cc8f6295bf327 to your computer and use it in GitHub Desktop.
find text pattern in all android manifests and aar files in folder.
#usage: search_text_pattern_android_libs android.permission.WRITE_EXTERNAL_STORAGE
function recursiveSearchInAARs {
for file in *; do
if [ -d "$file" ]; then
(cd -- "$file" && recursiveSearchInAARs)
fi
#foreach file with extension .aar in folder recusevly
if [[ $file == *.aar ]]; then
if ( unzip -c "$file" | grep --color -Ri --include="*.xml" "$pattern"); then
echo $file
fi
fi
done
}
pattern="$1"
startSearchFolder=$(pwd)
grep --color -Ri --include="*.xml" "$pattern" "$startSearchFolder"
recursiveSearchInAARs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment