Skip to content

Instantly share code, notes, and snippets.

@MohamedTarekq
Forked from aufzayed/haklist.sh
Created November 12, 2021 18:52
Show Gist options
  • Save MohamedTarekq/9d9ccb2da95c42ac2e61b80bba2f8302 to your computer and use it in GitHub Desktop.
Save MohamedTarekq/9d9ccb2da95c42ac2e61b80bba2f8302 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