From 41dbbf0a0aa68acbe4be9eae9cfa8a063c2e5b54 Mon Sep 17 00:00:00 2001 From: L1ghtn1ng Date: Mon, 21 Sep 2020 18:35:23 +0100 Subject: [PATCH] Add new param to api key exception to say which API is missing --- theHarvester/discovery/constants.py | 4 ++-- theHarvester/discovery/githubcode.py | 2 +- theHarvester/discovery/huntersearch.py | 2 +- theHarvester/discovery/intelxsearch.py | 2 +- theHarvester/discovery/pentesttools.py | 2 +- theHarvester/discovery/projectdiscovery.py | 2 +- theHarvester/discovery/securitytrailssearch.py | 2 +- theHarvester/discovery/shodansearch.py | 2 +- theHarvester/discovery/spyse.py | 2 +- theHarvester/lib/core.py | 4 ++-- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/theHarvester/discovery/constants.py b/theHarvester/discovery/constants.py index c3dac5a0..c5b97ccb 100644 --- a/theHarvester/discovery/constants.py +++ b/theHarvester/discovery/constants.py @@ -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' diff --git a/theHarvester/discovery/githubcode.py b/theHarvester/discovery/githubcode.py index 8c7f8154..0410d740 100644 --- a/theHarvester/discovery/githubcode.py +++ b/theHarvester/discovery/githubcode.py @@ -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 diff --git a/theHarvester/discovery/huntersearch.py b/theHarvester/discovery/huntersearch.py index 67b92f89..4c821959 100644 --- a/theHarvester/discovery/huntersearch.py +++ b/theHarvester/discovery/huntersearch.py @@ -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}' diff --git a/theHarvester/discovery/intelxsearch.py b/theHarvester/discovery/intelxsearch.py index 370fe6a9..388359ae 100644 --- a/theHarvester/discovery/intelxsearch.py +++ b/theHarvester/discovery/intelxsearch.py @@ -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 = () diff --git a/theHarvester/discovery/pentesttools.py b/theHarvester/discovery/pentesttools.py index fdd4e192..351174ce 100644 --- a/theHarvester/discovery/pentesttools.py +++ b/theHarvester/discovery/pentesttools.py @@ -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 diff --git a/theHarvester/discovery/projectdiscovery.py b/theHarvester/discovery/projectdiscovery.py index d31aacba..0f70b125 100644 --- a/theHarvester/discovery/projectdiscovery.py +++ b/theHarvester/discovery/projectdiscovery.py @@ -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 diff --git a/theHarvester/discovery/securitytrailssearch.py b/theHarvester/discovery/securitytrailssearch.py index 0b96691a..91c88727 100644 --- a/theHarvester/discovery/securitytrailssearch.py +++ b/theHarvester/discovery/securitytrailssearch.py @@ -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/' diff --git a/theHarvester/discovery/shodansearch.py b/theHarvester/discovery/shodansearch.py index 1fccf6d7..399dadc7 100644 --- a/theHarvester/discovery/shodansearch.py +++ b/theHarvester/discovery/shodansearch.py @@ -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 = [] diff --git a/theHarvester/discovery/spyse.py b/theHarvester/discovery/spyse.py index 65a66460..158dbc4b 100644 --- a/theHarvester/discovery/spyse.py +++ b/theHarvester/discovery/spyse.py @@ -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 diff --git a/theHarvester/lib/core.py b/theHarvester/lib/core.py index c064055b..2660c623 100644 --- a/theHarvester/lib/core.py +++ b/theHarvester/lib/core.py @@ -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',