def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'GoogleSearch'
     self.init = 'https://www.google.com/'
     self.addr = 'https://www.google.com/search'
示例#2
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = self.register(domain)
     self.module = 'Search'
     self.source = 'ShodanSearch'
     self.addr = 'https://api.shodan.io/shodan/host/search'
     self.key = config.shodan_api_key
示例#3
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'SogouSearch'
     self.addr = 'https://www.sogou.com/web'
     self.limit_num = 1000  # Limit the number of searches
示例#4
0
 def __init__(self, domain):
     Search.__init__(self)
     self.module ='Search'
     self.source ='BaiduSearch'
     self.addr ='https://www.baidu.com/s'
     self.domain = domain
     self.limit_num = 750 # Limit the number of searches
示例#5
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GiteeSearch'
     self.module = 'Search'
     self.addr = 'https://search.gitee.com/'
     self.domain = self.register(domain)
     self.header = self.get_header()
示例#6
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'ShodanAPISearch'
     self.addr = 'https://api.shodan.io/shodan/host/search'
     self.key = settings.shodan_api_key
示例#7
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = "ExaleadSearch"
     self.addr = "http://www.exalead.com/search/web/results/"
     self.per_page_num = 30
示例#8
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'HunterAPISearch'
     self.addr = 'https://hunter.qianxin.com/openApi/search'
     self.delay = 1
     self.key = settings.hunter_api_key
示例#9
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'SoSearch'
     self.addr = 'https://www.so.com/s'
     self.limit_num = 640  # 限制搜索条数
     self.per_page_num = 10  # 默认每页显示10页
示例#10
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'SoSearch'
     self.addr = 'https://www.so.com/s'
     self.limit_num = 640  # Limit the number of searches
     self.per_page_num = 10  # By default, each page displays 10 pages
示例#11
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'DuckDuckGoSearch'
     self.addr = 'https://duckduckgo.com/html/'
     self.header = self.get_header()
     self.delay = 2
示例#12
0
文件: ask.py 项目: zkbupt/OneForAll
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'AskSearch'
     self.addr = 'https://www.search.ask.com/web'
     self.limit_num = 200  # 限制搜索条数
     self.per_page_num = 10  # 默认每页显示10页
示例#13
0
 def __init__(self, domain):
     Search.__init__(self)
     self.module = 'Search'
     self.source = 'BaiduSearch'
     self.init = 'https://www.baidu.com/'
     self.addr = 'https://www.baidu.com/s'
     self.domain = domain
     self.limit_num = 750  # 限制搜索条数
示例#14
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GithubAPISearch'
     self.module = 'Search'
     self.addr = 'https://api.github.com/search/code'
     self.domain = domain
     self.delay = 5
     self.token = settings.github_api_token
示例#15
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'BingSearch'
     self.init = 'https://www.bing.com/'
     self.addr = 'https://www.bing.com/search'
     self.limit_num = 1000  # 限制搜索条数
示例#16
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'FoFaAPISearch'
     self.addr = 'https://fofa.so/api/v1/search/all'
     self.delay = 1
     self.email = settings.fofa_api_email
     self.key = settings.fofa_api_key
示例#17
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GithubAPISearch'
     self.module = 'Search'
     self.addr = 'https://api.github.com/search/code'
     self.domain = self.get_maindomain(domain)
     self.session = requests.Session()
     self.auth_url = 'https://api.github.com'
     self.token = api.github_api_token
示例#18
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'YandexSearch'
     self.init = 'https://yandex.com/'
     self.addr = 'https://yandex.com/search'
     self.limit_num = 1000  # 限制搜索条数
     self.delay = 5
示例#19
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'ZoomEyeAPISearch'
     self.addr = 'https://api.zoomeye.org/web/search'
     self.delay = 2
     self.user = config.zoomeye_api_username
     self.pwd = config.zoomeye_api_password
示例#20
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'BingAPISearch'
     self.addr = 'https://api.cognitive.microsoft.com/bing/v7.0/search'
     self.id = settings.bing_api_id
     self.key = settings.bing_api_key
     self.limit_num = 1000  # 必应同一个搜索关键词限制搜索条数
     self.delay = 1  # 必应自定义搜索限制时延1秒
示例#21
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module ='Search'
     self.source ='BingAPISearch'
     self.addr ='https://api.cognitive.microsoft.com/bing/v7.0/search'
     self.id = settings.bing_api_id
     self.key = settings.bing_api_key
     self.limit_num = 1000 # Bing limits the number of searches for the same search keyword
     self.delay = 1 # Bing custom search limit delay is 1 second
示例#22
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'GoogleAPISearch'
     self.addr = 'https://www.googleapis.com/customsearch/v1'
     self.delay = 1
     self.key = settings.google_api_key
     self.id = settings.google_api_id
     self.per_page_num = 10  # Only 10 results can be requested at a time
示例#23
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'YahooSearch'
     self.init = 'https://search.yahoo.com/'
     self.addr = 'https://search.yahoo.com/search'
     self.limit_num = 1000  # Yahoo limits the number of searches
     self.delay = 2
     self.per_page_num = 30  # Yahoo maximum number of items per search
示例#24
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'GoogleAPISearch'
     self.addr = 'https://www.googleapis.com/customsearch/v1'
     self.delay = 1
     self.key = config.google_api_key
     self.cx = config.google_api_cx
     self.per_page_num = 10  # 每次只能请求10个结果
示例#25
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GithubAPISearch'
     self.module = 'Search'
     self.addr = 'https://api.github.com/search/code'
     self.domain = domain
     self.session = requests.Session()
     self.session.trust_env = False
     self.auth_url = 'https://api.github.com'
     self.token = settings.github_api_token
示例#26
0
 def __init__(self, domain):
     Search.__init__(self)
     self.domain = domain
     self.module = 'Search'
     self.source = 'YahooSearch'
     self.init = 'https://search.yahoo.com/'
     self.addr = 'https://search.yahoo.com/search'
     self.limit_num = 1000  # 限制搜索条数
     self.delay = 5
     self.per_page_num = 40
示例#27
0
    def __init__(self, domain):
        Search.__init__(self)
        self.domain = domain
        self.module = 'Search'
        self.source = 'FoFaAPISearch'
        self.addr = 'https://fofa.so/api/v1/search/all'
        self.delay = 1
        self.email = settings.fofa_api_email
        self.key = settings.fofa_api_key

        def search(self):
            """
            Send search request and do subdomain matching
            """
            self.page_num = 1
            subdomain_encode = f'domain="{self.domain}"'.encode('utf-8')
            query_data = base64.b64encode(subdomain_encode)
            while True:
                time.sleep(self.delay)
                self.header = self.get_header()
                self.proxy = self.get_proxy(self.source)
                query = {
                    'email': self.email,
                    'key': self.key,
                    'qbase64': query_data,
                    'page': self.page_num,
                    'full': 'true',
                    'size': 1000
                }
                resp = self.get(self.addr, query)
                if not resp:
                    return
                resp_json = resp.json()
                subdomains = self.match_subdomains(resp)
                if not subdomains:  # If the search does not find a subdomain, stop the search
                    break
                self.subdomains.update(subdomains)
                size = resp_json.get('size')
                if size < 1000:
                    break
                self.page_num += 1

        def run(self):
            """
            Class execution entry
            """
            if not self.have_api(self.email, self.key):
                return
            self.begin()
            self.search()
            self.finish()
            self.save_json()
            self.gen_result()
            self.save_db()
示例#28
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GithubSearch'
     self.module = 'Search'
     self.addr = 'https://github.com/search'
     self.domain = self.register(domain)
     self.header = self.get_header()
     self.session = requests.Session()
     self.login_url = 'https://github.com/login'
     self.post_url = 'https://github.com/session'
     self.email = api.github_email
     self.password = api.github_password
示例#29
0
    def __init__(self, domain):
        Search.__init__(self)
        self.source = 'GithubAPISearch'
        self.module = 'Search'
        self.addr = 'https://api.github.com/search/code'
        self.domain = domain
        self.session = requests.Session()
        self.session.trust_env = False
        self.auth_url = 'https://api.github.com'
        self.token = settings.github_api_token

        def auth_github(self):
            """
            github api certification

            :return: return False if authentication fails, return True if successful
            """
            self.session.headers.update(
                {'Authorization': 'token ' + self.token})
            try:
                resp = self.session.get(self.auth_url)
            except Exception as e:
                logger.log('ERROR', e.args)
                return False
            if resp.status_code != 200:
                resp_json = resp.json()
                msg = resp_json.get('message')
                logger.log('ERROR', msg)
                return False
            return True

        def search(self):
            """
            Query the subdomain from the interface and do subdomain matching
            """
            self.session.headers = self.get_header()
            self.session.proxies = self.get_proxy(self.source)
            self.session.verify = self.verify
            self.session.headers.update(
                {'Accept': 'application/vnd.github.v3.text-match+json'})

            if not self.auth_github():
                logger.log('ERROR', f'{self.source} module login failed')
                return
            page = 1
            while True:
                time.sleep(self.delay)
                params = {
                    'q': self.domain,
                    'per_page': 100,
                    'page': page,
                    'sort': 'indexed'
                }
                try:
                    resp = self.session.get(self.addr, params=params)
                except Exception as e:
                    logger.log('ERROR', e.args)
                    break
                if resp.status_code != 200:
                    logger.log('ERROR', f'{self.source} module query failed')
                    break
                subdomains = self.match_subdomains(resp)
                if not subdomains:
                    break
                self.subdomains.update(subdomains)
                page += 1
                try:
                    resp_json = resp.json()
                except Exception as e:
                    logger.log('ERROR', e.args)
                    break
                total_count = resp_json.get('total_count')
                if not isinstance(total_count, int):
                    break
                if page * 100 > total_count:
                    break
                if page * 100 > 1000:
                    break

        def run(self):
            """
            Class execution entry
            """
            if not self.have_api(self.token):
                return
            self.begin()
            self.search()
            self.finish()
            self.save_json()
            self.gen_result()
            self.save_db()
示例#30
0
 def __init__(self, domain):
     Search.__init__(self)
     self.source = 'GiteeSearch'
     self.module = 'Search'
     self.addr = 'https://search.gitee.com/'
     self.domain = domain