Created
April 19, 2018 16:11
-
-
Save paulera/b58a948b143a35ad690058877cdd6728 to your computer and use it in GitHub Desktop.
Script to find all <script src="...."> in a URL source code
This file contains hidden or 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 [ -z $1 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then | |
echo "Usage: "$(basename $0)" <url>" | |
echo | |
echo "This script finds all external scripts referred by <script> tags" | |
exit 1 | |
fi | |
curl -L -s "$1" | tr '\r\n\t' ' ' | sed $'s/\(<\/[^>]*>\)/\\1\\\n/g' | sed 's/^ *//;s/ *$//' | grep "^<script" | grep --color=always "src=[\"'][^\"']\+[\"']" | while read i; do echo -e $i"\n"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment