AquatoneDiscoverV2

aquatone-discover will find the targets nameservers and shuffle DNS lookups between them. Should a lookup fail on the target domains nameservers, aquatone-discover will fall back to using Google public DNS servers to maximize discovery.

python · Common Scripts

Source

from subprocess import PIPE, Popen

import demistomock as demisto
from CommonServerPython import *

from CommonServerUserPython import *


def main():
    domain = demisto.args().get("domain")

    cmd = ["aquatone-discover", "--domain", domain]

    p = Popen(cmd, stdout=PIPE, stderr=PIPE, encoding="utf-8")

    stdout, stderr = p.communicate()

    if p.returncode > 0:
        demisto.results({"Type": entryTypes["error"], "ContentsFormat": formats["text"], "Contents": stdout + stderr})
    else:
        res = stdout
        cmd = ["cat", "/root/aquatone/" + domain + "/hosts.json"]
        p = Popen(cmd, stdout=PIPE, stderr=PIPE, encoding="utf-8")
        stdout, stderr = p.communicate()
        if p.returncode > 0:
            demisto.results({"Type": entryTypes["error"], "ContentsFormat": formats["text"], "Contents": stdout + stderr})
        else:
            hosts = stdout
            hosts_json = json.loads(hosts)

            ec = {"Aquatone.discover": hosts_json}
            entry_result = {
                "Type": entryTypes["note"],
                "ContentsFormat": formats["json"],
                "Contents": hosts_json,
                "HumanReadable": res,
                "ReadableContentsFormat": formats["markdown"],
                "EntryContext": ec,
            }
            demisto.results(entry_result)


if __name__ in ("__builtin__", "builtins", "__main__"):
    main()

README

Finds the targets nameservers and shuffle DNS lookups between them. If a lookup fails on the target domains nameservers, Aquatone Discover will use the Google public DNS servers to maximize discovery.

Script Data


Name Description
Script Type python
Tags  

Inputs


Argument Name Description
domain The domain to discover.

Outputs


Path Description Type
Aquatone.discover Finds the targets nameservers and shuffle DNS lookups between them. Unknown