From 0efdf38bec31eca8e025288984d65fc0c52775b4 Mon Sep 17 00:00:00 2001 From: L1ghtn1ng Date: Mon, 21 Sep 2020 18:36:20 +0100 Subject: [PATCH] Add new module Omnisint --- .github/workflows/theHarvester.yml | 4 ++++ README.md | 4 +++- tests/discovery/test_omnisint.py | 30 ++++++++++++++++++++++++++++++ theHarvester/__main__.py | 10 +++++++++- theHarvester/discovery/omnisint.py | 30 ++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tests/discovery/test_omnisint.py create mode 100644 theHarvester/discovery/omnisint.py diff --git a/.github/workflows/theHarvester.yml b/.github/workflows/theHarvester.yml index 28883ed5..d2131701 100644 --- a/.github/workflows/theHarvester.yml +++ b/.github/workflows/theHarvester.yml @@ -83,6 +83,10 @@ jobs: run: | python theHarvester.py -d yale.edu -b netcraft + - name: Run theHarvester module Omnisint + run: | + python theHarvester.py -d yale.edu -b omnisint + - name: Run theHarvester module Otx run: | python theHarvester.py -d yale.edu -b otx diff --git a/README.md b/README.md index 17ebf4e3..66a14c74 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,12 @@ Passive: * linkedin: Google search engine, specific search for LinkedIn users - www.linkedin.com -* linkedin_links: +* linkedin_links: specific search for LinkedIn users for target domain * netcraft: Internet Security and Data Mining - www.netcraft.com +* omnisint: Project Crobat, A Centralised Searchable Open Source Project Sonar DNS Database - https://github.com/Cgboal/SonarSearch + * otx: AlienVault Open Threat Exchange - https://otx.alienvault.com * pentesttools: Powerful Penetration Testing Tools, Easy to Use (Needs an API key and is not free for API access) - https://pentest-tools.com/home diff --git a/tests/discovery/test_omnisint.py b/tests/discovery/test_omnisint.py new file mode 100644 index 00000000..ab6980e4 --- /dev/null +++ b/tests/discovery/test_omnisint.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# coding=utf-8 +from theHarvester.lib.core import * +from theHarvester.discovery import omnisint +import requests +import pytest + +pytestmark = pytest.mark.asyncio + + +class TestOmnisint(object): + @staticmethod + def domain() -> str: + return 'uber.com' + + async def test_api(self): + base_url = f'https://sonar.omnisint.io/all/{TestOmnisint.domain()}' + headers = {'User-Agent': Core.get_user_agent()} + request = requests.get(base_url, headers=headers) + assert request.status_code == 200 + + async def test_search(self): + search = omnisint.SearchOmnisint(TestOmnisint.domain()) + await search.process() + assert isinstance(await search.get_hostnames(), set) + assert isinstance(await search.get_ips(), set) + + +if __name__ == '__main__': + pytest.main() diff --git a/theHarvester/__main__.py b/theHarvester/__main__.py index 7c4252b1..723b3f33 100644 --- a/theHarvester/__main__.py +++ b/theHarvester/__main__.py @@ -35,7 +35,7 @@ async def start(): parser.add_argument('-b', '--source', help='''baidu, bing, bingapi, bufferoverun, certspotter, crtsh, dnsdumpster, duckduckgo, exalead, github-code, google, hackertarget, hunter, intelx, linkedin, linkedin_links, - netcraft, otx, pentesttools, projectdiscovery, + netcraft, omnisint, otx, pentesttools, projectdiscovery, qwant, rapiddns, securityTrails, spyse, sublist3r, threatcrowd, threatminer, trello, twitter, urlscan, virustotal, yahoo''') @@ -283,6 +283,14 @@ async def start(): netcraft_search = netcraft.SearchNetcraft(word) stor_lst.append(store(netcraft_search, engineitem, store_host=True)) + elif engineitem == 'omnisint': + from theHarvester.discovery import omnisint + try: + omnisint_search = omnisint.SearchOmnisint(word) + stor_lst.append(store(omnisint_search, engineitem, store_host=True, store_ip=True)) + except Exception as e: + print(e) + elif engineitem == 'otx': from theHarvester.discovery import otxsearch try: diff --git a/theHarvester/discovery/omnisint.py b/theHarvester/discovery/omnisint.py new file mode 100644 index 00000000..31a3fef8 --- /dev/null +++ b/theHarvester/discovery/omnisint.py @@ -0,0 +1,30 @@ +from theHarvester.lib.core import * +import re + + +class SearchOmnisint: + + def __init__(self, word): + self.word = word + self.totalhosts = set() + self.totalips = set() + self.proxy = False + + async def do_search(self): + url = f'https://sonar.omnisint.io/all/{self.word}?page=0' + response = await AsyncFetcher.fetch_all([url], json=True, headers={'User-Agent': Core.get_user_agent()}, + proxy=self.proxy) + + self.totalhosts: set = {host['name'] for host in response[0]} + self.totalips: set = {ip['value'] for ip in response[0] + if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", ip['value'])} + + async def get_hostnames(self) -> set: + return self.totalhosts + + async def get_ips(self) -> set: + return self.totalips + + async def process(self, proxy=False): + self.proxy = proxy + await self.do_search()