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.11.tar.gz (5.6 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.11-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: takeover.py-0.0.11.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.14

File hashes

Hashes for takeover.py-0.0.11.tar.gz
Algorithm Hash digest
SHA256 6f74a53a15571fa51df0e19584e2fd4da803cebd7d2d894300845c64fe080be1
MD5 bfdf205be651cd58a3cdd34e78095212
BLAKE2b-256 6bad0ee5e67dd1358c8595287d18a00ce4bb6c08f63b503c62891b0c6d9e9e09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: takeover.py-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.14

File hashes

Hashes for takeover.py-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 97829387c4d3404e58e2edcbac6f7900cb9143b3800ef31739ee71049128b258
MD5 2a9e5a3c1b5b658c33f8fe1cff895644
BLAKE2b-256 c8524e6772c3297459bcf3b0b25b70d2268a95fd0ba59d0bb310d50b0e714de1

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