A Ruby Gem to sniff information about a domain's technology and capabilities.
Site Inspector involves three primary concepts:
-
Domain - A domain has a host defined by it's TLD + SLD. A domain might be
example.com. Domain's have certain domain-wide properties like whether it supports non-www requests, or if it enforces HTTPS. -
Endpoint - Each domain has four endpoints based on whether you make your request with HTTPS or not, and whether you prefix the host with
www.or not. So the domainexample.commay have endpoints athttps://example.com,https://www.example.com,http://example.com, andhttps://www.example.com. There may theoretically be a different server responding to each endpoint, so endpoints have certain endpoint-specific properties, like whether it responds or not, or whether it redirects. Each domain has one canonical (primary) endpoint. -
Checks - A check is a set of tests performed on an endpoint. A check might look at what headers are returned, what CMS is used, or whether there is a valid HTTPS certificate. There are some built in checks, listed below, or you can define your own. While they're endpoint specific, checks often filter up and inform some of the domain-wide logic (such as if the domain supports HTTPS).
domain = SiteInspector.inspect "whitehouse.gov"
domain.https?
# => true
domain.www?
# => true
domain.canonical_endpoint.to_s
# => "https://www.whitehouse.gov"
domain.canonical_endpoint.wappalyzer.to_h
# => { :cms => ["Drupal"], ... }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)
--accessibility return results for the accessibility 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)
--cookies return results for the cookies 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)
--headers return results for the headers 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)
--https return results for the https check (defaults to all checks unless one or more checks are specified)
--wappalyzer return results for the wappalyzer check (defaults to all checks unless one or more checks are specified)
--wellknown return results for the wellknown check (defaults to all checks unless one or more checks are specified)
--whois return results for the whois 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
There's one --<check> flag per enabled check. --accessibility and --wappalyzer only appear when the pa11y and wappalyzer CLIs are installed (see below).
canonical_endpoint- The domain's primary endpointgovernment- whether the domain is a government domainup- whether any endpoint respondswww- whether eitherwwwendpoint respondsroot- whether you can access the domain withwww.https- whether HTTPS is supportedenforces_https- whether non-htttps endpoints are either down or redirects to httpsdowngrades_https- whether the canonical endpoint redirects to an http endpointcanonically_www- whether non-www requests are redirected to www (or all non-www endpoints are down)canonically_https- whether non-https request are redirected to https (or all http endpoints are down)redirect- whether the domain redirects to an external domainhsts- does the canonical endpoint have HSTS enabledhsts_subdomains- are subdomains included in the HSTS list?hsts_preload_ready- can this domain be added to the HSTS preload list?
up- whether the endpoint responds or nottimed_out- whether the endpoint times outredirect- whether the endpoint redirectsexternal_redirect- whether the endpoint redirects to another domain
Each endpoint also returns the following checks:
Uses the pa11y CLI to run automated accessibility tests. Requires node. To install pally: [sudo] npm install -g pa11y.
valid- whether the endpoint passes the WCAG2A standardresults- the issuespa11yreported
To test against another standard, call section508, wcag2a, wcag2aa or wcag2aaa on the check, such as endpoint.accessibility.wcag2aa.
doctype- The HTML doctype returnedgenerator- the content of thegeneratormeta tag, if anyproper_404s- whether the endpoint returns a 404 for pages that don't exist. The path checks below only run when it does.robots_txt- whether the endpoint has arobots.txtfilesitemap_xml- Whether the endpoint has a sitemaphumans_txt- whether the endpoint has ahumans.txtfilevulnerability_disclosure_policy- whether the endpoint has a/vulnerability-disclosure-policypagesecurity_txt- whether the endpoint has asecurity.txtfile, at the root or in.well-known/data_json- whether the endpoint has adata.jsonfile
cookie?- does the endpoint set cookiessecure?- whether at least one cookie sets both theSecureandHttpOnlyflags
dnssec- is DNSSEC supportedipv6- is IPV6 supportedcdn- the endpoint's CDN, if anycloud_provider- the endpoint's cloud provider, if anygoogle_apps- whether the domain is using google appshostname- the server hostnameip- the server IP
The value of each of these headers, or false if it isn't sent:
strict-transport-security- the HSTS headercontent-security-policy- the endpoint's CSPx-frame-options- click-jacking protectionserver- the server headerx-xss-protection- XSS protection
Any other x- headers the endpoint sends are included too.
valid- whether the HSTS header is validmax_age- the HSTS max ageinclude_subdomains- whether subdomains are includedpreload- whether its preloadedenabled- whether HSTS is enabledpreload_ready- whether HSTS could be preloadedpreload_list_status- the domain's status on the HSTS preload list, such aspreloaded,pendingorunknown
valid- if the HTTPS response is validreturn_code- the HTTPS error, if any
Detects the endpoint's CMS and other technologies (analytics, JavaScript libraries, advertising, web servers, and so on) with the wappalyzer CLI. Requires node. The check is only enabled when a wappalyzer binary is found on your PATH, in ./bin, or in ./node_modules/.bin (npm install in this repository installs it).
Returns a hash of technology names keyed by category, such as cms, analytics, or javascript_libraries.
Whether the endpoint serves each well-known URI in the IANA registry, except deprecated ones. Each key is the URI's name with . and - replaced by _, such as openid_configuration, mta_sts_txt or host_meta_json.
domain- the fields of the domain's WHOIS recordip- the fields of the WHOIS record for the endpoint's IP address
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
endThis 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.
- Clone down the repo
script/bootstrap
script/cibuild
script/console
- Fork the project
- Create a new, descriptively named feature branch
- Make your changes
- Submit a pull request