Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified Dockerfile
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Short Form | Long Form | Description
-b | --burp | Toggle to use when inputting a Burp 'Save selected' file containing multiple JS files
-c | --cookies | Add cookies to the request
-h | --help | show the help message and exit
-js | --javascript | Download all javascript files

### Examples

Expand Down
68 changes: 66 additions & 2 deletions linkfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
os.environ["BROWSER"] = "open"

# Import libraries
import re, sys, glob, html, argparse, jsbeautifier, webbrowser, subprocess, base64, ssl, xml.etree.ElementTree
import re, sys, glob, html, argparse, jsbeautifier, webbrowser, subprocess, base64, ssl, xml.etree.ElementTree, requests

from gzip import GzipFile
from string import Template
Expand All @@ -25,6 +25,57 @@
except ImportError:
from urllib2 import Request, urlopen

class javascript:
def __init__(self, url, endpoints):
self.url = url
self.endpoints = endpoints

def clean_parameters(self, file):
if "?" in file:
return file.split("?")[0]
else:
return file

def is_javascript_file(self, file):
try:
ext = file.rsplit('.', 1)[1].lower()
if ext == "js":
return True
else:
return False
except:
return False

def verify_slash(self, file):
if file[0] == "/":
return file
else:
return '/'+file

def save_file(self, file):
if self.is_full_url(file):
r = requests.get(file)
with open("javascript_files/"+self.get_file_path(file), 'w') as f:
f.write(jsbeautifier.beautify(r.text))
else:
r = requests.get(self.url+self.verify_slash(file))
with open("javascript_files/"+self.get_file_path(file), 'w') as f:
f.write(jsbeautifier.beautify(r.text))

def is_full_url(self, file):
if 'http' in file:
return True
else:
return False
def get_file_path(self, url):
return url.split("/")[-1]

def main(self):
for endpoint in self.endpoints:
path = self.clean_parameters(html.escape(endpoint["link"]).encode('ascii', 'ignore').decode('utf8'))
if self.is_javascript_file(path):
self.save_file(path)

# Regex used
regex_str = r"""

Expand Down Expand Up @@ -313,8 +364,17 @@ def check_url(url):
parser.add_argument("-t", "--timeout",
help="How many seconds to wait for the server to send data before giving up (default: " + str(default_timeout) + " seconds)",
default=default_timeout, type=int, metavar="<seconds>")
parser.add_argument("-js", "--javascript",
help="It will download all JavaScript files and unminify them",
action="store_true")
args = parser.parse_args()

if args.javascript:
try:
os.mkdir("javascript_files")
except:
pass

if args.input[-1:] == "/":
args.input = args.input[:-1]

Expand Down Expand Up @@ -374,7 +434,9 @@ def check_url(url):
except Exception as e:
print("Invalid input defined or SSL error for: " + endpoint)
continue

javascript = javascript(args.input, endpoints)
if args.javascript:
javascript.main()
if args.output == 'cli':
cli_output(endpoints)
else:
Expand All @@ -401,3 +463,5 @@ def check_url(url):

if args.output != 'cli':
html_save(output)


Empty file modified requirements.txt
100644 → 100755
Empty file.
Empty file modified setup.py
100644 → 100755
Empty file.
Empty file modified template.html
100644 → 100755
Empty file.
Empty file modified test_parser.py
100644 → 100755
Empty file.