scan Google Chrome installed Extensions dir and show each extension's info
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 | |
# scan Google Chrome installed Extensions dir and show each extension's info | |
# refs: https://www.jamf.com/jamf-nation/discussions/11307/chrome-extension-reporting | |
loggedInUser=$( ls -l /dev/console | awk '{print $3}' ) | |
path="/Users/${loggedInUser}/Library/Application Support/Google/Chrome/Default/Extensions" | |
if [[ $1 != "" ]]; then | |
path=$1 | |
echo "Read extensions from \"$path\"" | |
echo | |
fi | |
JSONS=$( find "$path" -maxdepth 4 -name "manifest.json" ) | |
while read JSON; do | |
NAME=$( awk -F'"' '/name/{print $4}' "$JSON" ) | |
VERSION=$( awk -F'"' '/"version"/{print $4}' "$JSON" ) | |
DESCRIPTION=$( awk -F'"' '/"description"/{print $4}' "$JSON" ) | |
ID=$( echo "$JSON" | awk -F'/' '{print $(NF-2)}' ) | |
URL="https://chrome.google.com/webstore/detail/$ID" | |
EXT_PATH="$path/$ID" | |
if [[ ! -z "$NAME" ]] && [[ ! "$NAME" =~ "_MSG_" ]]; then | |
EXTS+=( "${NAME}\n" ) | |
echo "id: $ID" | |
echo "name: $NAME" | |
echo "version: $VERSION" | |
echo "description: $DESCRIPTION" | |
echo "path: $EXT_PATH" | |
echo "url: $URL" | |
echo | |
fi | |
done < <(echo "$JSONS") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment