Skip to content

Check out this JavaScript code that extracts URLs from a web page and linked scripts! Perfect for web scraping and penetration testing

License

Notifications You must be signed in to change notification settings

SujalMeghwal/URL-Hunter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

URL Hunter

Check out this JavaScript code that extracts URLs from a web page and linked scripts! Perfect for web scraping and penetration testing

How to use:

  1. Open a web page you want to extract URLs from.
  2. Open the developer console by pressing Ctrl + Shift + J on Windows or Cmd + Option + J on Mac.
  3. Paste the following code into the console and press enter:
javascript:(function(){var scripts=document.getElementsByTagName("script"),regex=/(?<=(\"|\'|\`))\/[a-zA-Z0-9_?&=\/\-\#\.]*(?=(\"|\'|\`))/g;const results=new Set;for(var i=0;i<scripts.length;i++){var t=scripts[i].src;""!=t&&fetch(t).then(function(t){return t.text()}).then(function(t){var e=t.matchAll(regex);for(let r of e)results.add(r[0])}).catch(function(t){console.log("An error occurred: ",t)})}var pageContent=document.documentElement.outerHTML,matches=pageContent.matchAll(regex);for(const match of matches)results.add(match[0]);function writeResults(){results.forEach(function(t){document.write(t+"<br>")})}setTimeout(writeResults,3e3);})();
  1. Wait for the script to finish running. The extracted URLs will be displayed in the console.

Support

Thanks for visiting my repository! If you find my work useful, please consider buying me a coffee to support my future projects.

Buy Me A Coffee

About

Check out this JavaScript code that extracts URLs from a web page and linked scripts! Perfect for web scraping and penetration testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published