The Wayback Machine - https://web.archive.org/web/20240824093227/https://www.geeksforgeeks.org/linkfinder-script-to-search-endpoints-in-javascript-files/
Open In App

LinkFinder – Script to search Endpoints in JavaScript Files

Last Updated : 23 Sep, 2021
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Hidden endpoints of the website can be used to perform Penetration Testing on the domain. Detection of these endpoints is difficult if we are using a manual way. So we need to have an automated script that can detect the endpoints of JavaScript links. LinkFinder is an automated tool developed in the Python language which detects the endpoints and their parameters on the target domain. The results are displayed in the .html format in the web browser, along with this we can also display the results in the terminal itself. LinkFinder tool is available on the GitHub platform, it’s free and open-source to use. LinkFinder tool also supports deep analysis on the target for more endpoint discovery.

Note: Make Sure You have Python Installed on your System, as this is a python-based tool. Click to check the Installation process – Python Installation Steps on Linux

Installation of LinkFinder Tool on Kali Linux OS

Step 1: Use the following command to install the tool in your Kali Linux operating system.

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

Step 2: Now use the following command to move into the directory of the tool. You have to move in the directory in order to run the tool.

cd LinkFinder

Step 3: You are in the directory of the LinkFinder. Now you have to install a dependency of the LinkFinder using the following command.

sudo pip3 install -r requirements.txt

Step 4: Run the setup.py file to complete the installation.

sudo python3 setup.py install

Step 5: All the dependencies have been installed in your Kali Linux operating system. Now use the following command to run the tool and check the help section.

python3 linkfinder.py -h

Working with LinkFinder Tool on Kali Linux OS

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

python3 linkfinder.py -i https://geeksforgeeks.org -o results.html

We are displaying the results which were saved in the .html format file.

All the highlighted URLs are the endpoints of JavaScript files.

Example 2: CLI/STDOUT output (doesn’t use jsbeautifier, which makes it very fast)

python3 linkfinder.py -i https://geeksforgeeks.org -o cli

In this example, we are displaying the results or endpoints in the terminal itself.

Example 3: Analyzing an entire domain and its JS files

python3 linkfinder.py -i https://geeksforgeeks.org -d

In this example, we will be performing a deep scan on https://geeksforgeeks.org

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

python3 linkfinder.py -i burp.txt -b

In this example, we are passing input to the tool from the burp.txt file.

We have got the results and the endpoints of the JS files.

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

python3 linkfinder.py -i ‘Desktop/*.js’ -r ^/api/ -o results.html

In this example, we are searching for .js files from the Desktop directory and looking for the endpoint /api/.

Example 6: Ignore certain js files (like external libs) provided by -g –ignore

python3 SecretFinder.py -i https://geeksforgeeks.org/ -e -g ‘jquery;bootstrap;api.google.com’

In this example, we are ignoring certain JS files which are not very important.

Example 7: Process only certain js files provided by -n –only

python3 SecretFinder.py -i https://geeksforgeeks.org/ -e -n ‘d3i4yxtzktqr9n.cloudfront.net;www.myexternaljs.com’

In this example, we are including important js files for searching.

Example 8: Use your regex

python3 SecretFinder.py -i https://example.com/1.js -o cli -r ‘apikey=my.api.key[a-zA-Z]+’

In this example, we are specifying our own custom Regex for searching.

Example 9: Other options: add headers, proxy, and cookies

python3 SecretFinder.py -i https://example.com/ -e -o cli -c ‘mysessionid=111234’ -H ‘x-header:value1\nx-header2:value2’ -p 127.0.0.1:8080 -r ‘apikey=my.api.key[a-zA-Z]+’

In this example, we are adding headers, proxy, and cookies for hiding the identity.

Example 10: Open SecretFinder.py and add your regex

In this example, we are directly inserting the Regex onto the main Python file.



Similar Reads

Bash Script - Difference between Bash Script and Shell Script
In computer programming, a script is defined as a sequence of instructions that is executed by another program. A shell is a command-line interpreter of Linux which provides an interface between the user and the kernel system and executes a sequence of instructions called commands. A shell is capable of running a script. A script that is passed to
3 min read
NTLMRecon - Tool To Enumerate Information From NTLM Authentication Enabled Web Endpoints
NTLMRecon is a free and open-source tool available on GitHub. This tool is used for the NTLM reconnaissance tool without the installation of dependencies. This tool is very useful for security researchers while reconnaissance about NTLM endpoints. The tool needs potential IP addresses and domains. The tool can be used to run on a single URL, an IP
2 min read
Graphw00F - GraphQL fingerprinting tool for GQL endpoints
Graphw00F is a free and open-source tool available on GitHub. Graphw00F is a tool that is used for finding fingerprints of the GraphQL server engines. Graphw00F can find the technology running behind the GraphQL endpoint. Graphw00F is written in python language. You must have python language installed in your kali Linux operating system in order to
2 min read
Shellfinder - Simple Tool to Find Shells and Endpoints in Websites
A shell is a malicious PHP file executed by accessing it via a web browser. It is a PHP script allowing the attacker to control the server - essentially a backdoor program, similar in functionality to a Trojan for personal computers. Shellfinder tool finds the route through which this malicious file can be uploaded to the target server and how the
2 min read
Batch Script - How to check if a process is running via a Batch Script
Given a process or application (.exe) file, the task is to create a batch script that checks whether the process is running or not and output the same. Example: In this example, we have created a batch script by the name process.bat. We can easily check whether a process is currently running or not using the tasklist toolkit. Tasklist allows us to
2 min read
How to write a shell script that starts tmux session, and then runs a ruby script
Scripts are important for streamlining workflows and automating tasks. One such way to streamline workflow is by using Tmux [Terminal Multiplexer]. When used along with shell scripts we will be able to automatically commence a Tmux session and perform certain tasks. In this article, we shall see how to use a shell script that will automatically sta
4 min read
Shell Script to List all Hidden Files in Current Directory
Here we are going to see how to write a script to list all hidden files in the current directory, But before starting we will see how to hide the file in the current directory. Hide Files in Linux: In Linux, the files which start with a period (.) sign are the hidden files. We will write a small script to hide the file by providing the name of the
2 min read
Shell Script to Download Files From a Source Directory on a Remote FTP Server
In this article, we are going to write a shell script to download files from a certain directory in a server to a local computer using FTP. It is recommended to have some knowledge of FTP before going through this article, but it is not necessary. Before writing a shell script, we will see how to download a file directly using commands, then we wil
3 min read
Shell Script to List Files that have Read, Write and Execute Permissions
In this article, We will learn how to list all files in the current directory that have Red, Write and Execute permission. Suppose, we have the following files in our current directory : Here, We have a total of 8 files in our current directory. Out of 8, we have Read, Write and Execute permission on 6 files and 2 have only Read and Write permissio
3 min read
Shell Script to Remove Temporary Files
Temporary files in a linux environment are world-writable and world-readable which means that any user in the system can read and write to the temporary directory. In most of the Linux systems "/tmp" directory is used as a temporary directory and any user or process in the system can use this directory to store any temporary data. But any program/u
2 min read
Shell Script to Delete Zero Sized Files From a Directory
A zero-sized file is a file that contains no data and has a length of 0. It is also called a zero-byte file. Incomplete transfers can be responsible for the zero-sized file. You can create a zero-sized file intentionally by running the following command in the terminal : touch zero_sized_file_name Output: Approaches: Input directory name and check
3 min read
Linux Shell Script to Backup Files and Directory
Backing up our important files and directories is crucial to safeguarding our data. In this article, we’ll create a simple shell script that uses the tar utility to create an archive file for backup purposes that we can use whenever we require. The shell script we’ll build allows us to specify which directories to back up and where to store the bac
5 min read
Dome – Python Script To Obtain Subdomains And Search For Open Ports
Dome is an automated cyber-security tool developed in the Python language that is used in the process of subdomain enumerations. This subdomain can be tested for getting the bugs out of it. The Dome tool has an active and passive mode for the enumeration process. Dome tool is available on the GitHub platform for free and is open source to use. This
3 min read
Pymeta - Search The Web For Files On A Domain To Download And Extract Metadata
PyMeta tool is an automated cyber-security tool which is developed in the Python language that has the potential to search for queries, identify and get the following file types (pdf, xls, xlsx, csv, doc, docx, ppt, pptx) from a given target domain using Google and Bing scraping engines. PyMeta tool is a scraping tool that downloads important files
2 min read
Bash shell script to find sum of digits
Given a number Num, find the sum of digits of the number.Examples: Input : 444 Output : sum of digits of 444 is : 12 Input : 34 Output : sum of digits of 34 is : 7 Approach: 1. Divide the number into single digits 2. Find the sum of digits . C/C++ Code # !/bin/bash # Program to find sum # of digits # Static input of the # number Num=123 g=$Num # st
1 min read
Conditional Statements | Shell Script
Conditional Statements: There are total 5 conditional statements which can be used in bash programming if statement if-else statement if..elif..else..fi statement (Else If ladder) if..then..else..if..then..fi..fi..(Nested if) switch statement Their description with syntax is as follows: if statement This block will process if specified condition is
3 min read
String Operators | Shell Script
Pre-Requisite: Conditional Statement in Shell Script There are many operators in Shell Script some of them are discussed based on string. Equal operator (=): This operator is used to check whether two strings are equal. Syntax:Operands1 = Operand2Example: PHP Code #!/bin/sh str1="GeeksforGeeks"; str2="geeks"; if
2 min read
Implementing Directory Management using Shell Script
Directory management constitutes the functions dealing with organization and maintenance of various directories. Directories usually contain files of any type, but this may vary between file systems. The content of a directory does not affect the directory object itself. Some of the directory functions are: Navigation Absolute/ Relative Pathnames L
3 min read
Batch Script - Return code
Return codes are the codes returned by programs when they are executed. If the command line is successful, it should return zero; if it is not successful, it should return non-zero. If the test fails, a non-zero value indicates the error number, and the user can attempt to resolve it by navigating to the error message. The test may also return an e
3 min read
How to Install Lazy Script in Kali Linux?
Kali Linux is one of the most advanced hacking OS systems from Linux family. Kali Linux is filled with many hacking tools and supporting learners and hackers worldwide. There are many versions of Kali Linux which provides a good user interface and desired environment. The Lazy Script is designed to help many users to save time and work. The script
2 min read
Bash Script to get Low Battery Alert in Linux
We are going to write a bash script that will speak "Battery Low" when the battery's charging percentage will go below some specified threshold value. Before starting this, first, we need to understand some basic commands and terminology which are described below:Some Bash Commands: acpi: This command returns the percentage of battery charged, whet
3 min read
Bash shell script to find out the largest value from given command line arguments
Write a shell script to find out the largest value from the given number of command-line arguments. Example: Special variables in bash: $@- All arguments. $#- Number of arguments. $0- Filename. $1, $2, $3, $4 ... - Specific arguments. Approach If the number of arguments is 0, end the program. If not zero, then Initialize a variable maxEle with firs
1 min read
Automated Recursive Encryption in a Directory Using Shell Script
This script would encrypt file provided as an argument or a directory and its constituent files and sub-directories recursively. It would be very useful for automating the encryption of multiple files in a directory all together. How it works? If no arguments are given, throw an error and exit the program. Read the password to use for encrypting th
3 min read
Deleting a User in Linux using Python Script
Deleting a user from your system or server via a python script is a very easy task. You just need to pass the username of the user and the script will remove the details and all the files of that user.This python script uses userdel Linux command to delete the user.You can directly use userdel command if you remember the command but if you don't th
2 min read
ProtOSINT - Python Script to Investigate Protonmail Accounts And ProtonVPN IP Addresses
ProtOSINT is a free and open-source tool available on GitHub. This tool is based upon the technology of the open-source intelligence tools which works on the open-source information available on the web or on the internet. ProtOSINT can be used in the investigation of Proton service on an email address. The Protonmail is an encrypted email service
2 min read
Multi-Line Comment in Shell Script
Comments are quite a crucial part of a program or a code-base. It helps in understanding the code, improves code-readability, and also helps in enhancing the structure of the program. We often write single-line comments in our programs as they are quite self-explanatory and require few words to describe the flow of the program or any message about
2 min read
Shell Script To Show All the Internal and External Links From a URL
To make hierarchy among the webpages or the information web developers use to connect them all is called webpage linking. There are two types of webpage linking: one is internal linking, and the other is external linking. Internal links are those which link a page available on the same website to produce a cycle on the site. At the same time, exter
4 min read
Difference Between Single and Double Quotes in Shell Script and Linux
Single quotes and double quotes are both functional in Linux while working with shell scripts or executing commands directly in the terminal but there is a difference between the way the bash shell interprets them. Single quotes: Enclosing characters in single quotation marks (') holds onto the literal value of each character within the quotes. In
3 min read
How to Code Your Own Port Scanner Using BASH Script and netcat Tool in Linux?
The first step of penetration testing is reconnaissance (information gathering) which involves scanning for open ports in the machine. There are various tools available on the internet to perform port scanning but, the ability to make your own port scanner is just felt amazing. So here are the steps to follow in order to achieve the same. To make t
3 min read
Batch Script - Echo Command
Batch script is a type of scripting language used in Windows operating systems to automate repetitive tasks, perform system administration functions, and execute a series of commands. The echo command is one of the most commonly used commands in batch scripting, used to display text or messages on the console or in a text file. In batch scripting,
8 min read
three90RightbarBannerImg