Skip to main content

This small script tries to detect subdomain takeovers from a list of domains. Fingerprints are taken from https://github.com/EdOverflow/can-i-take-over-xyz.

Project description

This small script tries to detect subdomain takeovers from a list of domains. Fingerprints are taken from https://github.com/EdOverflow/can-i-take-over-xyz.

Twitter

Installation

pip install takeover.py

Usage

takeover blog.example.com

Using with other tools:

subfinder -d "example.com" -silent | takeover

Automation:

Creating a automated scan server:

import json, asyncio, pickle, os
from pathlib import Path
from takeover.takeover import takeover

home = str(Path.home())

# config is an dictionary. See ~/.config/takeover/config.json for structure
config = json.load(open(home + "/.config/takeover/config.json"))

# Do not forget to replace pointer to fingerprints with the valid data. See ~/.config/takeover/fingerprints.json for structure
config['fingerprints'] = json.load(open(home + "/.config/takeover/fingerprints.json"))

async def loop():
    print("Starting infinite loop:")
    while True:
            takeoverObject = takeover(config)
            try:
                takeoverObject.found = pickle.load(open("found.pickle", 'rb'))
            except FileNotFoundError:
                print("No old data found.", end="\r")

            try:
                with open("subdomains.txt") as subdomainFile:
                    subdomains = enumerate(subdomainFile)
                    await takeoverObject.checkHosts(subdomains)
            except FileNotFoundError:
                continue

            with open("found.pickle", 'wb') as foundFile:
                pickle.dump(takeoverObject.found, foundFile)

            os.remove("subdomains.txt")
            print("Enumerated all targets in subdomains.txt for takeover")

asyncio.run(loop())

The above automation script can be used along with any subdomain enumeration tool:

subfinder -d example.com -o subdomains.txt

and the running infinite loop will automatically detect subdomains.txt file and start looking for takeovers. After completion, it also deletes the subdomains.txt so that you can add new targets. Obviously, you can tweak it however you want.

How it Works

  • Matches CNAME against takeover-able services

  • If CNAME found, matches fingerprints in the body.

Note

  • The output is a lot verbose so it is recommended to use a discord webhook to get notified. I am planning to change it in a major update.

  • If you need some extra features, feel free to submit a new issue on GitHub.

License

LICENSE.md

Disclaimer

I make guns, I sell guns, I give away guns but I take no responsibility of who dies with the guns.

Legally speaking, What you do with this has nothing to do with me. I am not responsible for your actions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

takeover.py-0.0.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

takeover.py-0.0.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file takeover.py-0.0.5.tar.gz.

File metadata

  • Download URL: takeover.py-0.0.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for takeover.py-0.0.5.tar.gz
Algorithm Hash digest
SHA256 db98934b6795dd759615279c350cfa559af332cc1e289c1fe1be62dd9a0b630e
MD5 372d4a11f5ca2bf9dd8cbf5564c6c22a
BLAKE2b-256 aa32929bc8b9a57ad4c282ab04c43d634b3113b870e5b8342625d07ce3204b09

See more details on using hashes here.

File details

Details for the file takeover.py-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: takeover.py-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

File hashes

Hashes for takeover.py-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 83e58722b2a6d3d00d705b265fd28241210bad47598c0a4a8ceec05b930d1a9e
MD5 1033c50c6077f205d23245ebd54aa06e
BLAKE2b-256 2ff2b4780b241c8546d7a0a7b9b0c14dd83c77462a55235bb99043add3e99a9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page