コード例 #1
0
ファイル: spoofcheck.py プロジェクト: BishopFox/spoofcheck
def check_dmarc_org_policy(base_record):
    policy_strong = False

    try:
        org_record = base_record.get_org_record()
        if org_record is not None and org_record.record is not None:
            output_info("Found organizational DMARC record:")
            output_info(str(org_record.record))

            if org_record.subdomain_policy is not None:
                if org_record.subdomain_policy == "none":
                    output_good("Organizational subdomain policy set to %(sp)s" % {"sp": org_record.subdomain_policy})
                elif org_record.subdomain_policy == "quarantine" or org_record.subdomain_policy == "reject":
                    output_bad("Organizational subdomain policy explicitly set to %(sp)s" % {"sp": org_record.subdomain_policy})
                    policy_strong = True
            else:
                output_info("No explicit organizational subdomain policy. Defaulting to organizational policy")
                policy_strong = check_dmarc_policy(org_record)
        else:
            output_good("No organizational DMARC record")

    except dmarclib.OrgDomainException:
        output_good("No organizational DMARC record")

    except Exception as e:
        logging.exception(e)

    return policy_strong
コード例 #2
0
ファイル: spoofcheck.py プロジェクト: BishopFox/spoofcheck
def are_spf_include_mechanisms_strong(spf_record):
    output_info("Checking SPF include mechanisms")
    include_strong = spf_record._are_include_mechanisms_strong()
    if include_strong:
        output_bad("Include mechanisms include a strong record")
    else:
        output_indifferent("Include mechanisms are not strong")

    return include_strong
コード例 #3
0
ファイル: spoofcheck.py プロジェクト: BishopFox/spoofcheck
def is_spf_redirect_record_strong(spf_record):
    output_info("Checking SPF redirect domian: %(domain)s" % {"domain": spf_record.get_redirect_domain})
    redirect_strong = spf_record._is_redirect_mechanism_strong()
    if redirect_strong:
        output_bad("Redirect mechanism is strong.")
    else:
        output_indifferent("Redirect mechanism is not strong.")

    return redirect_strong
コード例 #4
0
def is_spf_redirect_record_strong(spf_record):
    output_info("Checking SPF redirect domian: %(domain)s" % {"domain": spf_record.get_redirect_domain})
    redirect_strong = spf_record._is_redirect_mechanism_strong()
    if redirect_strong:
        output_bad("Redirect mechanism is strong.")
    else:
        output_indifferent("Redirect mechanism is not strong.")

    return redirect_strong
コード例 #5
0
def are_spf_include_mechanisms_strong(spf_record):
    output_info("Checking SPF include mechanisms")
    include_strong = spf_record._are_include_mechanisms_strong()

    if include_strong:
        output_bad("Include mechanisms include a strong record")
    else:
        output_indifferent("Include mechanisms are not strong")

    return include_strong
コード例 #6
0
ファイル: spoofcheck.py プロジェクト: wr3nch0x1/panacea
def check_dmarc_policy(dmarc_record):
    policy_strength = False
    if dmarc_record.policy is not None:
        if dmarc_record.policy == "reject" or dmarc_record.policy == "quarantine":
            policy_strength = True
            output_bad("DMARC policy set to " + dmarc_record.policy)
        else:
            output_good("DMARC policy set to " + dmarc_record.policy)
    else:
        output_good("DMARC record has no Policy")

    return policy_strength
コード例 #7
0
ファイル: spoofcheck.py プロジェクト: BishopFox/spoofcheck
def check_dmarc_policy(dmarc_record):
    policy_strength = False
    if dmarc_record.policy is not None:
        if dmarc_record.policy == "reject" or dmarc_record.policy == "quarantine":
            policy_strength = True
            output_bad("DMARC policy set to " + dmarc_record.policy)
        else:
            output_good("DMARC policy set to " + dmarc_record.policy)
    else:
        output_good("DMARC record has no Policy")

    return policy_strength
コード例 #8
0
def single_domain(domain):
    color_init()
    spoofable = False

    spf_record_strength = is_spf_record_strong(domain)

    dmarc_record_strength = is_dmarc_record_strong(domain)
    if dmarc_record_strength is False:
        spoofable = True
    else:
        spoofable = False

    if spoofable:
        output_good("Spoofing possible for " + domain + "!")
    else:
        output_bad("Spoofing not possible for " + domain)
コード例 #9
0
ファイル: spoofcheck.py プロジェクト: wr3nch0x1/panacea
        output_info("No DMARC record found. Looking for organizational record")
        dmarc_record_strong = check_dmarc_org_policy(dmarc)
    else:
        output_good(domain + " has no DMARC record!")

    return dmarc_record_strong


if __name__ == "__main__":
    color_init()
    spoofable = False

    try:
        domain = sys.argv[1]

        spf_record_strength = is_spf_record_strong(domain)

        dmarc_record_strength = is_dmarc_record_strong(domain)
        if dmarc_record_strength is False:
            spoofable = True
        else:
            spoofable = False

        if spoofable:
            output_good("Spoofing possible for " + domain + "!")
        else:
            output_bad("Spoofing not possible for " + domain)

    except IndexError:
        output_error("Usage: " + sys.argv[0] + " [DOMAIN]")
コード例 #10
0
ファイル: spoofcheck.py プロジェクト: BishopFox/spoofcheck
    elif dmarc.get_org_domain() is not None:
        output_info("No DMARC record found. Looking for organizational record")
        dmarc_record_strong = check_dmarc_org_policy(dmarc)
    else:
        output_good(domain + " has no DMARC record!")

    return dmarc_record_strong


if __name__ == "__main__":
    color_init()
    spoofable = False

    try:
        domain = sys.argv[1]

        spf_record_strength = is_spf_record_strong(domain)

        dmarc_record_strength = is_dmarc_record_strong(domain)
        if dmarc_record_strength is False:
            spoofable = True
        else:
            spoofable = False

        if spoofable:
            output_good("Spoofing possible for " + domain + "!")
        else:
            output_bad("Spoofing not possible for " + domain)

    except IndexError:
        output_error("Usage: " + sys.argv[0] + " [DOMAIN]")
コード例 #11
0
    spoofable = False

    try:
        scope = sys.argv[1]
        hosts = open(scope).readlines()
        hosts_spoofable = []
        for host in hosts:
            domain = host.strip()
            spf_record_strength = is_spf_record_strong(domain)

            dmarc_record_strength = is_dmarc_record_strong(domain)
            if dmarc_record_strength is False:
                spoofable = True
            else:
                spoofable = False

            if spoofable:
                output_good("Spoofing possible for " + domain + "!")
                hosts_spoofable.append(domain)
            else:
                output_bad("Spoofing not possible for " + domain)
            output_good("\n")
        if len(hosts_spoofable) > 0:
            output_good("Spoofing possible for the following domains:\n")
            for line in hosts_spoofable:
                output_good(line)
        else:
            output_bad("Spoofing not possible for any of the domains.")
    except IndexError:
        output_error("Usage: " + sys.argv[0] + " [SCOPE_FILE]")
コード例 #12
0
        check_dmarc_extras(dmarc)

    elif dmarc.get_org_domain():
        output_info(
            "No DMARC record found. Looking for organizational record...")
        dmarc_record_strong = check_dmarc_org_policy(dmarc)

    else:
        output_good(f"{domain} has no DMARC record!")

    return dmarc_record_strong


if __name__ == "__main__":
    color_init()
    spoofable = False

    try:
        domain = sys.argv[1]

        spf_record_strong = is_spf_record_strong(domain)
        dmarc_record_strong = is_dmarc_record_strong(domain)

        if spf_record_strong and dmarc_record_strong:
            output_bad(f"Spoofing not possible for {domain}")
        else:
            output_good(f"Spoofing possible for {domain}!")

    except IndexError:
        output_error(f"Usage: {sys.argv[0]} [DOMAIN]")