Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
laramies
GitHub Repository: laramies/theHarvester
Path: blob/master/tests/discovery/test_otx.py
917 views
1
#!/usr/bin/env python3
2
# coding=utf-8
3
import os
4
from typing import Optional
5
import httpx
6
import pytest
7
8
from theHarvester.discovery import otxsearch
9
from theHarvester.lib.core import *
10
11
github_ci: Optional[str] = os.getenv(
12
"GITHUB_ACTIONS"
13
) # Github set this to be the following: true instead of True
14
15
16
class TestOtx(object):
17
@staticmethod
18
def domain() -> str:
19
return "apple.com"
20
21
@pytest.mark.asyncio
22
async def test_search(self) -> None:
23
search = otxsearch.SearchOtx(TestOtx.domain())
24
try:
25
await search.process()
26
except (httpx.TimeoutException, httpx.RequestError):
27
pytest.skip("Skipping OTX search due to network error")
28
assert isinstance(await search.get_hostnames(), set)
29
assert isinstance(await search.get_ips(), set)
30
31
32
if __name__ == "__main__":
33
pytest.main()
34
35