Skip to content

Instantly share code, notes, and snippets.

@seqrity
Last active March 5, 2023 06:35
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save seqrity/d67608eb6372cd6f455bfeeefa77b9c2 to your computer and use it in GitHub Desktop.
Save seqrity/d67608eb6372cd6f455bfeeefa77b9c2 to your computer and use it in GitHub Desktop.
Make wordlist from js files
#! /bin/bash
## This script fetch js files from a domain name and make a wordlist by words in js files
## Credit: https://gist.github.com/aufzayed/6cabed910c081cc2f2186cd27b80f687
##### Install requirements #####
##### Before running this script you should install Go #####
## Install subjs (https://github.com/lc/subjs)
GO111MODULE=on go get -u -v github.com/lc/subjs
## Install js-beautify (https://github.com/beautify-web/js-beautify)
apt install npm -y && npm install js-beautify
## Install haklistgen (https://github.com/hakluke/haklistgen)
go install github.com/hakluke/haklistgen@latest
## Usage: ./wordlist_from_js.sh example.com
##Get address (https://www.example.com) and fetch js files by subjs then save in jslinks.tmp file
echo "https://"$1 | subjs > jslinks.tmp
## Make jsfiles directory for storing js files
mkdir jsfiles && wget --compression=gzip -i jslinks.tmp -P jsfiles
## Read all js files and create wordlist by haklistgen
cat jsfiles/*.js | js-beautify -i | haklistgen | sort -u > $1"_js_wordlist.txt"
rm -rf jslinks.tmp jsfiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment