Path: blob/master/tests/discovery/test_certspotter.py
916 views
#!/usr/bin/env python31# coding=utf-82import os3from typing import Optional45import pytest6import httpx78from theHarvester.discovery import certspottersearch9from theHarvester.lib.core import *1011github_ci: Optional[str] = os.getenv(12"GITHUB_ACTIONS"13) # Github set this to be the following: true instead of True141516class TestCertspotter(object):17@staticmethod18def domain() -> str:19return "metasploit.com"202122@pytest.mark.skipif(github_ci == 'true', reason="Skipping this test for now")23class TestCertspotterSearch(object):24@pytest.mark.asyncio25async def test_api(self) -> None:26base_url = f"https://api.certspotter.com/v1/issuances?domain={TestCertspotter.domain()}&expand=dns_names"27headers = {"User-Agent": Core.get_user_agent()}28request = httpx.get(base_url, headers=headers)29assert request.status_code == 2003031@pytest.mark.asyncio32async def test_search(self) -> None:33search = certspottersearch.SearchCertspoter(TestCertspotter.domain())34await search.process()35assert isinstance(await search.get_hostnames(), set)363738if __name__ == "__main__":39pytest.main()404142