Skip to content

Instantly share code, notes, and snippets.

@aufzayed
Created November 8, 2021 00:21
Show Gist options
  • Save aufzayed/6cabed910c081cc2f2186cd27b80f687 to your computer and use it in GitHub Desktop.
Save aufzayed/6cabed910c081cc2f2186cd27b80f687 to your computer and use it in GitHub Desktop.
# the required tools
# subjs -> https://github.com/lc/subjs
# js-beautify -> https://github.com/beautify-web/js-beautify
# haklistgen -> https://github.com/hakluke/haklistgen
haklist() {
# declare TMPDIR variable
TMPDIR="/tmp/haklist"
# create a temp work dir
mkdir $TMPDIR
# extract javascript files links from the website
echo $1 | subjs > "$TMPDIR/jslinks.txt"
# donload javascript files
cat "$TMPDIR/jslinks.txt" | xargs wget -P $TMPDIR
# list javascript files in the temp directory then pass them to js-beautify then pass them to haklistgen tool
for i in $(ls $TMPDIR | grep '\.js'); do cat "$TMPDIR/$i" | js-beautify | haklistgen | sort -u >> haklist.txt; done
# remove the temp work directory
rm -rf $TMPDIR
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment