• Animesh Gupta

LinkFinder - A Python Script That Finds Endpoints In JavaScript Files

Updated: Aug 1, 2018


LinkFinder is a python script written to discover endpoints and their parameters in JavaScript files. This way penetration testers and bug hunters are able to gather new, hidden endpoints on the websites they are testing. Resulting in new testing ground, possibility containing new vulnerabilities. It does so by using jsbeautifier for python in combination with a fairly large regular expression. The regular expressions consists of four small regular expressions. These are responsible for finding:


Full URLs (https://cybertechops.com/*)

Absolute URLs or dotted URLs (/* or ../*)

Relative URLs with atleast one slash (text/test.php)

Relative URLs without a slash (test.php)


The output is given in HTML.


Installation

$ git clone https://github.com/GerbenJavado/LinkFinder.git

$ cd LinkFinder

$ python setup.py install


Dependencies

LinkFinder depends on the requests, argparse, jsbeautifier and requests-file python modules. These dependencies can all be installed using pip.


Usage

Examples

1. Most basic usage to find endpoints in an online JavaScript file and output the results to results.html:


linkfinder -i https://cybertechops.com/1.js -o results.html


2. CLI ouput (doesn't use jsbeautifier, which makes it very fast):


linkfinder -i https://cybertechops.com/1.js -o cli


3. Burp input (select in target the files you want to save, right click, Save selected items, feed that file as input):


linkfinder -i -i burpfile -b


4. Enumerating an entire folder for JavaScript files, while looking for endpoints starting with /api/ and finally saving the results to results.html:


linkfinder -i 'Desktop/*.js' -r ^/api/ -o results.html


Download LinkFinder

©2019 Security Unleashed | New Delhi