Giter Club home page Giter Club logo

fetchurls's Introduction

Fetch Urls

Bash script to spider a site, follow links, and fetch urls -- with some filtering. A list of URLs will be generated and saved to a text file.

GitHub release GitHub commits GitHub issues license

How To Use

  1. Download the script and save to the desired location on your machine.
  2. You'll need wget installed on your machine in order to continue. To check if it's already installed (if you're on Linux or a Mac, chances are you already have it) open Git Bash, Terminal, etc. and run the command: $ wget. If you receive an error message or command not found, you're probably on Windows. Here's the Windows installation instructions:
    1. Download the lastest wget binary for windows from https://eternallybored.org/misc/wget/ (they are available as a zip with documentation, or just an exe. I'd recommend just the exe.)
    2. If you downloaded the zip, extract all (if windows built in zip utility gives an error, use 7-zip). If you downloaded the 64-bit version, rename the wget64.exe file to wget.exe
    3. Move wget.exe to C:\Windows\System32\
  3. Open Git Bash, Terminal, etc. and run the fetchurls.sh script:
    $ bash /path/to/script/fetchurls.sh
  4. You will be prompted to enter the full URL (including HTTPS/HTTP protocol) of the site you would like to crawl:
    #
    #    Fetch a list of unique URLs for a domain.
    #
    #    Enter the full URL ( http://example.com )
    #    URL:
  5. You will be prompted to enter the location (directory) of where you would like the generated results to be saved (defaults to Desktop on Windows):
    #
    #    Save file to location
    #    Directory: /c/Users/username/Desktop
  6. You will then be prompted to change/accept the name of the outputted file (simply press enter to accept the default filename):
    #
    #    Save file as
    #    Filename (no extension): example-com
  7. When complete, the script will show a message and the location of your outputted file:
    #
    #    Fetching URLs for example.com
    #
    #
    #    Finished with 1 result!
    #
    #    File Location:
    #    /c/Users/username/Desktop/example-com.txt
    #

The script will crawl the site and compile a list of valid URLs into a text file that will be placed on your Desktop.

Extra Info

  • To change the default file output location, edit line #7 (or simply use the interactive prompt). Default: ~/Desktop

  • Ensure that you enter the correct protocol and subdomain for the URL or the outputted file may be empty or incomplete, however the script will attempt to follow the first HTTP redirect, if found. For example, entering the incorrect HTTP, protocol for https://adamdehaven.com will automatically fetch the URLs for the HTTPS version.

  • The script will successfully run as long as the target URL returns status HTTP 200 OK

  • The script, by default, filters out the following file extensions:

    • .css
    • .js
    • .map
    • .xml
    • .png
    • .gif
    • .jpg
    • .JPG
    • .bmp
    • .txt
    • .pdf
  • The script filters out several common WordPress files and directories such as:

    • /wp-content/uploads/
    • /feed/
    • /category/
    • /tag/
    • /page/
    • /widgets.php/
    • /wp-json/
    • xmlrpc
  • To change or edit the regular expressions that filter out some pages, directories, and file types, you may edit lines #54 through #63. Caution: If you're not familiar with grep and regular expressions, you can easily break the script.

fetchurls's People

Contributors

adamdehaven avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.