mirror of
https://github.com/laramies/theHarvester.git
synced 2026-10-01 22:14:55 +02:00
Add new param to api key exception to say which API is missing
This commit is contained in:
@@ -107,9 +107,9 @@ class MissingKey(Exception):
|
||||
"""
|
||||
:raise: When there is a module that has not been provided its API key
|
||||
"""
|
||||
def __init__(self, identity_flag: bool):
|
||||
def __init__(self, identity_flag: bool, source: str):
|
||||
if identity_flag:
|
||||
self.message = '\n\033[93m[!] Missing API key. \033[0m'
|
||||
self.message = f'\n\033[93m[!] Missing API key for {source}. \033[0m'
|
||||
else:
|
||||
self.message = '\n\033[93m[!] Missing CSE id. \033[0m'
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class SearchGithubCode:
|
||||
# rate limits you more severely
|
||||
# https://developer.github.com/v3/search/#rate-limit
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Github')
|
||||
self.proxy = False
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -11,7 +11,7 @@ class SearchHunter:
|
||||
self.start = start
|
||||
self.key = Core.hunter_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Hunter')
|
||||
self.total_results = ""
|
||||
self.counter = start
|
||||
self.database = f'https://api.hunter.io/v2/domain-search?domain={self.word}&api_key={self.key}&limit={self.limit}'
|
||||
|
||||
@@ -11,7 +11,7 @@ class SearchIntelx:
|
||||
# default key is public key
|
||||
self.key = Core.intelx_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Intelx')
|
||||
self.database = 'https://public.intelx.io/'
|
||||
self.results = None
|
||||
self.info = ()
|
||||
|
||||
@@ -11,7 +11,7 @@ class SearchPentestTools:
|
||||
self.word = word
|
||||
self.key = Core.pentest_tools_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'PentestTools')
|
||||
self.total_results = []
|
||||
self.api = f'https://pentest-tools.com/api?key={self.key}'
|
||||
self.proxy = False
|
||||
|
||||
@@ -8,7 +8,7 @@ class SearchDiscovery:
|
||||
self.word = word
|
||||
self.key = Core.projectdiscovery_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'ProjectDiscovery')
|
||||
self.total_results = None
|
||||
self.proxy = False
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class SearchSecuritytrail:
|
||||
self.word = word
|
||||
self.key = Core.security_trails_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Securitytrail')
|
||||
self.results = ""
|
||||
self.totalresults = ""
|
||||
self.api = 'https://api.securitytrails.com/v1/'
|
||||
|
||||
@@ -9,7 +9,7 @@ class SearchShodan:
|
||||
def __init__(self):
|
||||
self.key = Core.shodan_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Shodan')
|
||||
self.api = Shodan(self.key)
|
||||
self.hostdatarow = []
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class SearchSpyse:
|
||||
self.word = word
|
||||
self.key = Core.spyse_key()
|
||||
if self.key is None:
|
||||
raise MissingKey(True)
|
||||
raise MissingKey(True, 'Spyse')
|
||||
self.results = ''
|
||||
self.hosts = set()
|
||||
self.proxy = False
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# coding=utf-8
|
||||
|
||||
from typing import Set, Union, Any, Tuple, List
|
||||
import yaml
|
||||
import asyncio
|
||||
@@ -12,7 +11,7 @@ import certifi
|
||||
class Core:
|
||||
@staticmethod
|
||||
def version() -> str:
|
||||
return '3.2.0'
|
||||
return '3.2.1dev0'
|
||||
|
||||
@staticmethod
|
||||
def bing_key() -> str:
|
||||
@@ -161,6 +160,7 @@ class Core:
|
||||
'linkedin',
|
||||
'linkedin_links',
|
||||
'netcraft',
|
||||
'omnisint',
|
||||
'otx',
|
||||
'pentesttools',
|
||||
'projectdiscovery',
|
||||
|
||||
Reference in New Issue
Block a user