def search(self, domain): base_url = "https://ctsearch.entrust.com/api/v1/certificates?domain={}&fields=subjectDN" url = base_url.format(domain) ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1' req = requests.get(url, headers={'User-Agent': ua}) if req.ok: try: content = req.content.decode('utf-8') pattern = r'cn\\u003d([^,]+),' regex = re.compile(pattern, re.IGNORECASE) data = [] for match in regex.finditer(content): x = Utils.cleanString(match.group(1), '"} ') data.append(x) return list(set(data)) except Exception as err: print("Error retrieving information.") print err return []
def search(self, domain): base_url = "https://censys.io/ipv4/_search?q={}" url = base_url.format(domain) ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1' req = requests.get(url, headers={'User-Agent': ua}) if req.ok: try: content = req.content.decode('utf-8') pattern = r'names on certificate"></i>([^<]*)<' regex = re.compile(pattern, re.IGNORECASE) data = [] for match in regex.finditer(content): for i in match.group(1).split(","): x = Utils.cleanString(i, '"} ') data.append(x) return list(set(data)) except Exception as err: print("Error retrieving information.") print err return []
def search(self, domain): base_url = "https://crt.sh/?q={}" wildcard_domain = "%25.{}".format(domain) url = base_url.format(wildcard_domain) ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1' req = requests.get(url, headers={'User-Agent': ua}) if req.ok: try: content = req.content.decode('utf-8') pattern = r'>(.*\.' + domain + ')<' regex = re.compile(pattern, re.IGNORECASE) data = [] for match in regex.finditer(content): if match.group(1).strip() != "crt.sh|%." + domain: x = Utils.cleanString(match.group(1), '"} ') data.append(x) return list(set(data)) except Exception as err: print("Error retrieving information.") print err return []