04/08/2024
Advanced One-Liner for extracting filtered URLs for Injection-Based Attacks.
This one-liner is a powerful example of how Bug Bounty Hunters and Pentesters can automate the extraction of URLs for any given website using various tools and Linux tricks. It employs active fuzzing techniques (not passive), with optimized blacklists to avoid fetching URLs with extensions that are not useful for injection attacks (such as images, etc.). The one-liner then cleans the URLs to include only those with parameters using the 'gf' tool and removes duplicates, reducing the overall results and maintaining only the scope you want accurately. Your final list will then be ready for injection-based attacks, depending on the types you choose, such as SQL, XSS, LFI, and RCEs.
Breakdown of this one-liner:
➡️STEP 1: Crawling the Website with speed and accuracy actively.
gospider -s 'URL TARGET' -c 10 -d 5 --blacklist ".(jpg|jpeg|gif|css|tif|tiff|png|ttf|woff|woff2|ico|pdf|svg|txt)"
We run the 'GoSpider' tool to crawl the website 'URL TARGET' with 10 concurrent threads (-c 10) and a maximum depth of 5 (-d 5). The --blacklist option excludes files with specified extensions to optimize speed and accuracy.
➡️STEP 2: Filtering Parameters and looking only for those that are important.
gf allparam
We use the 'gf' tool to filter the output and show all parameters from the URLs using a predefined regex pattern.
➡️STEP 3: Cleaning URLs for Fuzzing
sed 's/=./=/'
We use 'sed' to remove everything after the equal sign in the URLs, preparing them for fuzzing by ensuring the URLs are clean after the parameters.
➡️STEP 4: Extracting URLs
grep -Eo '(http|https)://[^&]+'
We employ 'grep' with the '-Eo' option to extract and output only the URLs (starting with http or https) from the input.
➡️STEP 5: Removing Duplicated URLs
awk '!seen[$0]++'
We use 'awk' to remove duplicate URLs for optimization. The '!seen[$0]++' pattern checks if the current line is already in the 'seen' array and only adds it if it is unique.
➡️STEP 6: Filtering by Domain.
grep '^URL TARGET'
We apply one more time 'grep' to filter out only the URLs that match the main domain 'URL TARGET', ensuring the results stay within the defined scope.
Follow me on facebook
https://www.facebook.com/intellicon02?mibextid=LQQJ4d
Follow me on LinkedIn
https://www.linkedin.com/in/bright-ezeabia-b7911819a
Follow me on X
BrightAyo14