From 006cb148c27a391b2bd7204c4e35372f964faa1a Mon Sep 17 00:00:00 2001 From: Cameron Ruatta Date: Sun, 9 Jun 2019 10:05:26 -0700 Subject: [PATCH] WIP: Adding github-code search --- api-keys.yaml | 5 ++++- theHarvester/__main__.py | 15 ++++++++++++++- theHarvester/lib/core.py | 7 +++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/api-keys.yaml b/api-keys.yaml index d0be6aa3..8b41630f 100644 --- a/api-keys.yaml +++ b/api-keys.yaml @@ -12,4 +12,7 @@ apikeys: key: shodan: - key: oCiMsgM6rQWqiTvPxFHYcExlZgg7wvTt \ No newline at end of file + key: oCiMsgM6rQWqiTvPxFHYcExlZgg7wvTt + + github: + key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff --git a/theHarvester/__main__.py b/theHarvester/__main__.py index ec725790..193cc7c7 100644 --- a/theHarvester/__main__.py +++ b/theHarvester/__main__.py @@ -54,7 +54,7 @@ def start(): parser.add_argument('-c', '--dns-brute', help='perform a DNS brute force on the domain', default=False, action='store_true') parser.add_argument('-f', '--filename', help='save the results to an HTML and/or XML file', default='', type=str) parser.add_argument('-b', '--source', help='''baidu, bing, bingapi, censys, crtsh, cymon, dnsdumpster, - dogpile, duckduckgo, google, + dogpile, duckduckgo, github-code, google, google-certificates, hunter, intelx, linkedin, netcraft, securityTrails, threatcrowd, trello, twitter, vhost, virustotal, yahoo, all''') @@ -204,6 +204,19 @@ def start(): db.store_all(word, all_hosts, 'email', 'duckduckgo') db.store_all(word, all_hosts, 'host', 'duckduckgo') + elif engineitem == 'github-code': + print('\033[94m[*] Searching Github (code). \033[0m') + from theHarvester.discovery import githubcode + search = githubcode.SearchGithubCode(word, limit) + search.process() + emails = filter(search.get_emails()) + all_emails.extend(emails) + hosts = filter(search.get_hostnames()) + all_hosts.extend(hosts) + db = stash.stash_manager() + db.store_all(word, all_hosts, 'host', 'github-code') + db.store_all(word, all_emails, 'email', 'github-code') + elif engineitem == 'google': print('\033[94m[*] Searching Google. \033[0m') search = googlesearch.search_google(word, limit, start) diff --git a/theHarvester/lib/core.py b/theHarvester/lib/core.py index 908544d8..07607539 100644 --- a/theHarvester/lib/core.py +++ b/theHarvester/lib/core.py @@ -15,6 +15,12 @@ class Core: keys = yaml.safe_load(api_keys) return keys['apikeys']['bing']['key'] + @staticmethod + def github_key(): + with open('api-keys.yaml', 'r') as api_keys: + keys = yaml.safe_load(api_keys) + return keys['apikeys']['github']['key'] + @staticmethod def hunter_key(): with open('api-keys.yaml', 'r') as api_keys: @@ -66,6 +72,7 @@ class Core: 'dnsdumpster', 'dogpile', 'duckduckgo', + 'github-code', 'google', 'google-certificates', 'hunter',