Ejemplo n.º 1
0
	def fetchDmarc(self):
		result = OrderedDict([("record", None),
			("valid", True),
			("location", None)])
		try:
			dmarc_query = checkdmarc.query_dmarc_record(self.domain,
				nameservers=self.nameservers,
				timeout=self.timeout)
			result["record"] = dmarc_query["record"]
			result["location"] = dmarc_query["location"]
			parsed_dmarc_record = checkdmarc.parse_dmarc_record(
				dmarc_query["record"],
				dmarc_query["location"],
				parked=self.parked,
				include_tag_descriptions=self.include_dmarc_tag_descriptions,
				nameservers=self.nameservers,
				timeout=self.timeout)
			result["warnings"] = dmarc_query["warnings"]

			result["tags"] = parsed_dmarc_record["tags"]
			result["warnings"] += parsed_dmarc_record[
			"warnings"]
		except checkdmarc.DMARCError as error:
			result["error"] = str(error)
			result["valid"] = False
			if hasattr(error, "data") and error.data:
				for key in error.data:
					result[key] = error.data[key]
		return result
Ejemplo n.º 2
0
    def testDMARCPctLessThan100Warning(self):
        """A warning is issued if the DMARC pvt value is less than 100"""

        dmarc_record = "v=DMARC1; p=none; sp=none; fo=1; pct=50; adkim=r; " \
                       "aspf=r; rf=afrf; ri=86400; " \
                       "rua=mailto:[email protected]; " \
                       "ruf=mailto:[email protected]"
        domain = "energy.gov"
        results = checkdmarc.parse_dmarc_record(dmarc_record, domain)
        self.assertIn("pct value is less than 100", results["warnings"][0])