Home

Awesome

Site Inspector

A Ruby Gem to sniff information about a domain's technology and capabilities.

Gem Version Build Status

Demo

site-inspector.herokuapp.com (source)

Concepts

Site Inspector involves three primary concepts:

Usage

Ruby

domain = SiteInspector.inspect "whitehouse.gov"
domain.https?
#  =>  true
domain.www?
#  =>  true
domain.canonical_endpoint.to_s
#  => "https://www.whitehouse.gov"
domain.canonical_endpoint.sniffer.cms
#  =>  { :drupal  =>  {}}

Command line usage

site-inspector inspect -- inspects a domain

Usage:

  site-inspector inspect <domain> [options]

Options:
        -j, --json         JSON encode the output
        -a, --all          return results for all endpoints (defaults to only the canonical endpoint)
            --sniffer      return results for the sniffer check (defaults to all checks unless one or more checks are specified)
            --https        return results for the https check (defaults to all checks unless one or more checks are specified)
            --hsts         return results for the hsts check (defaults to all checks unless one or more checks are specified)
            --headers      return results for the headers check (defaults to all checks unless one or more checks are specified)
            --dns          return results for the dns check (defaults to all checks unless one or more checks are specified)
            --content      return results for the content check (defaults to all checks unless one or more checks are specified)
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

What's checked

Domain

Endpoint

Checks

Each endpoint also returns the following checks:

Accessibility

Uses the pa11y CLI to run automated accessibility tests. Requires node. To install pally: [sudo] npm install -g pa11y.

Content

DNS

Headers

HSTS

HTTPS

Sniffer

Adding your own check

Checks are special classes that are children of SiteInspector::Endpoint::Check. You can implement your own check like this:

class SiteInspector
  class Endpoint
    class Mention < Check
      def mentions_ben?
        endpoint.content.body =~ /ben/i
      end
    end
  end
end

This check can then be used as follows:

domain.canonical_endpoint.mention.mentions_ben?

Checks can call the endpoint object, which, contains the request, response, and other checks. Custom checks are automatically exposed as endpoint methods.

Contributing

Bootstrapping locally

  1. Clone down the repo
  2. script/bootstrap

Running tests

script/cibuild

Development console

script/console

How to contribute

  1. Fork the project
  2. Create a new, descriptively named feature branch
  3. Make your changes
  4. Submit a pull request