SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
sfp_open_passive_dns_database: Cleanup (#1579)
bcoles79a4d5e36e2f
diff --git a/modules/sfp_open_passive_dns_database.py b/modules/sfp_open_passive_dns_database.pyindex af9ece16..b33d23f4 100644--- a/modules/sfp_open_passive_dns_database.py+++ b/modules/sfp_open_passive_dns_database.py@@ -42,13 +42,11 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):}}- # Default optionsopts = {"timeout": 30,"verify": True,}- # Option descriptionsoptdescs = {"timeout": "Query timeout, in seconds.","verify": "Verify identified domains still resolve to the associated specified IP address.",@@ -65,16 +63,21 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]- # What events is this module interested in for inputdef watchedEvents(self):return ["DOMAIN_NAME"]- # What events this module producesdef producedEvents(self):return ["INTERNET_NAME", "INTERNET_NAME_UNRESOLVED", "IP_ADDRESS", "IPV6_ADDRESS"]- # Query the Open Passive DNS Database for a domaindef query(self, qry):+ """Query the Open Passive DNS Database for subdomains of a domain name.++ Args:+ qry (str): Domain name++ Returns:+ list: List of subdomain details+ """params = {"alike": 1, # alike is required to find subdomains"q": qry.encode('raw_unicode_escape').decode("ascii", errors='replace')@@ -96,7 +99,7 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):rows = re.findall(r'<tr>(.+?)</tr>', str(res['content']), re.DOTALL)if not rows:- self.debug("No passive DNS results for " + qry)+ self.debug(f"No passive DNS results for {qry}")return Nonedata = list()@@ -109,16 +112,15 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):continueif len(columns) != 7:- self.error("Unexpected number of columns for row. Expected 7, Found " + str(len(columns)))+ self.error(f"Unexpected number of columns for row. Expected 7, Found {len(columns)}")continuedata.append(columns)- self.info("Retrieved " + str(len(data)) + " DNS records")+ self.info(f"Retrieved {len(data)} DNS records for {qry}")return data- # Handle events sent to this moduledef handleEvent(self, event):eventName = event.eventTypesrcModuleName = event.module@@ -127,8 +129,8 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):if self.errorState:return- if srcModuleName == "sfp_open_passive_dns_database":- self.debug("Ignoring " + eventName + ", from self.")+ if srcModuleName == self.__class__.__name__:+ self.debug(f"Ignoring {eventName}, from self.")returnif eventData in self.results:@@ -142,7 +144,7 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):data = self.query(eventData)if data is None or len(data) == 0:- self.info("No passive DNS data found for " + eventData)+ self.info(f"No passive DNS data found for {eventData}")returndomains = list()@@ -203,7 +205,7 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):continueif self.opts['verify'] and not self.sf.validateIP(query, answer):- self.debug("Host " + query + " no longer resolves to " + answer)+ self.debug(f"Host {query} no longer resolves to {answer}")continueevt = SpiderFootEvent("IP_ADDRESS", answer, self.__name__, event)@@ -214,11 +216,11 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):continueif not self.sf.validIP6(answer):- self.debug("Skipping invalid IPv6 address " + answer)+ self.debug(f"Skipping invalid IPv6 address {answer}")continueif self.opts['verify'] and not self.sf.validateIP(query, answer):- self.debug("Host " + query + " no longer resolves to " + answer)+ self.debug(f"Host {query} no longer resolves to {answer}")continueevt = SpiderFootEvent("IPV6_ADDRESS", answer, self.__name__, event)