Skip to content

Instantly share code, notes, and snippets.

@0xcrypto
Created May 11, 2021 11:35
Show Gist options
  • Save 0xcrypto/26dbf4499ad7f9df0eb628ecfedd654e to your computer and use it in GitHub Desktop.
Save 0xcrypto/26dbf4499ad7f9df0eb628ecfedd654e to your computer and use it in GitHub Desktop.
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")
await asyncio.sleep(1)
print("\r ", end="\r")
print("No old data found..", end="\r")
await asyncio.sleep(1)
print("\r ", end="\r")
print("No old data found...", end="\r")
await asyncio.sleep(1)
print("\r ", 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())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment