subtocheck

package module
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: GPL-3.0 Imports: 37 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

subtocheck: Subdomain Takeover Checker

test

subtocheck checks a list of domain names for ones that someone else could take over, and reports:

  • dangling CNAMEs: records pointing at a provider's resource that no longer exists, or at a domain that is unregistered or expiring;
  • dangling DNS delegations: names delegated to DNS hosts that no longer serve their zone, entirely or in part, or to nameservers on an unregistered domain;
  • unclaimed services: names whose provider answers with its "no such site" page, matched against fingerprints for over 40 providers, most confirmed against the live provider every week.

It only detects; it never attempts to claim anything.

What is a subdomain takeover?

If you host a service with a provider such as AWS S3 or Heroku, point a DNS record at it, then delete the service but leave the DNS record, someone else may be able to create a service with the provider that answers for your domain. Many providers do not ask you to prove you own a domain before serving content for it, so if you move out, someone else can move in. It is up to the domain's owner to make sure DNS only points at a provider while the service is live.

Install

On macOS and Linux, using Homebrew:

brew install jonhadfield/tap/subtocheck

On macOS you can also use the signed, notarized installer, which puts subtocheck in /usr/local/bin:

curl -fsSL https://github.com/jonhadfield/subtocheck/releases/latest/download/subtocheck_macos.pkg -o /tmp/subtocheck.pkg && sudo installer -pkg /tmp/subtocheck.pkg -target /

On Linux, install the latest release for your architecture:

curl -fsSL "https://github.com/jonhadfield/subtocheck/releases/latest/download/subtocheck_linux_$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/').tar.gz" | sudo tar -xz -C /usr/local/bin subtocheck

Otherwise, download the latest release for your platform from the releases page and install it with install <subtocheck binary> /usr/local/bin/subtocheck (sudo install on Linux). On macOS, a binary downloaded through a browser is quarantined and Gatekeeper will refuse to run it; Homebrew and the installer handle this, but for a downloaded tarball, clear the flag with xattr -d com.apple.quarantine /usr/local/bin/subtocheck.

Quick start

List the names to check, one per line, in domains.txt:

login.example.com
shop.example.com
static.example.com

Then run:

subtocheck

On a terminal, a progress bar shows while it scans, and each potential takeover is printed as soon as it is found:

  • TAKEOVER (red): the DNS or response matches a provider that lets anyone claim the name;
  • VERIFY (yellow): an edge case, where takeover depends on the provider's conditions, so check it manually.

A summary follows, and the details of every issue are written to a log file.

The list can also be piped in from another tool:

cat subdomains.txt | subtocheck --domains - --json

Options

Option
--domains <path> domain list file (default domains.txt), or - to read the list from stdin
--log <path> log file path (default subtocheck-<timestamp>.log)
--json write the result to stdout as JSON instead of console output
--config <path> email a report after each scan
--quiet no console output; the log file is still written
--debug also write debug messages to the log file
--workers <n> domains checked at once (default 10); more are faster, but busy hosts time out more often, and a timed-out request is a check not made

Exit status

Status Meaning
0 no potential takeovers found
1 an error, such as a missing domains file or a failure to send the email report
2 at least one potential takeover found, including those to verify manually

Documentation

  • How it works: each check, and what makes a finding a takeover or one to verify
  • Providers: the providers, DNS hosts and fingerprints checked, and those confirmed live every week
  • Output: the console, the log file, JSON, and email reports with their configuration
  • Contributing: adding fingerprints, the live checks, and tests

Documentation

Index

Constants

View Source
const DefaultWorkers = 10

DefaultWorkers is the number of domains checked at once unless Options says otherwise. More are faster, but busier hosts time out more often, and a request that times out is a check that was not made.

Variables

This section is empty.

Functions

func CheckDomains

func CheckDomains(path string, opts Options) (int, error)

CheckDomains is called from cmd/subtocheck/main.go to scan the domains listed in the file at path. Findings are shown as they are found and every issue is written to the log. It returns the number of potential takeovers found, including those to verify manually, and an error if the domains could not be read or the report could not be emailed.

func PtrToStr

func PtrToStr(s string) *string

PtrToStr returns a pointer to an existing string

Types

type Options added in v0.0.11

type Options struct {
	ConfigPath string // email configuration, if any
	LogPath    string // log file; a timestamped file in the working directory if empty
	Debug      bool   // write debug messages to the log
	Quiet      bool   // no console output
	JSON       bool   // write the result to stdout as JSON instead of console output
	Workers    int    // domains checked at once; DefaultWorkers if not positive
}

Options configures a scan.

Directories

Path Synopsis
cmd
subtocheck command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址