2018-11-21 01:04:57 +08:00
|
|
|
import requests
|
|
|
|
import myparser
|
|
|
|
|
|
|
|
class search_crtsh:
|
|
|
|
|
|
|
|
def __init__(self, word):
|
|
|
|
self.word = word.replace(' ', '%20')
|
|
|
|
self.results = ""
|
|
|
|
self.totalresults = ""
|
|
|
|
self.server = "www.google.com"
|
|
|
|
self.hostname = "www.google.com"
|
|
|
|
self.userAgent = "(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100116 Firefox/3.7"
|
|
|
|
self.quantity = "100"
|
|
|
|
self.counter = 0
|
|
|
|
|
|
|
|
|
|
|
|
def do_search(self):
|
|
|
|
try:
|
2018-11-21 11:17:41 +08:00
|
|
|
urly = "https://crt.sh/?q=%25" + self.word
|
2018-11-21 01:04:57 +08:00
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
|
|
|
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0'}
|
|
|
|
try:
|
|
|
|
r=requests.get(urly,headers=headers)
|
|
|
|
except Exception as e:
|
|
|
|
print(e)
|
|
|
|
self.results = r.text
|
|
|
|
self.totalresults += self.results
|
|
|
|
|
|
|
|
def get_hostnames(self):
|
|
|
|
rawres = myparser.parser(self.results, self.word)
|
|
|
|
return rawres.hostnames()
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
self.do_search()
|
2018-11-16 01:52:33 +08:00
|
|
|
print("\tSearching CRT.sh results..")
|