theHarvester/tests/discovery/test_otx.py
J.Townsend 22e1eb9bdb
A lot of changes and fixes (#1168)
* add pytest.ini file and fix test warning in qwantsearch

* ignore unsed imports

* Remove n45ht as the api is down

* Remove modules that use google as google blocks you after one go

* Remove missed code from when removing modules that use google

* Remove missed code from when removing modules that use google

* Add new vt-py dep and update pytest

* WIP virustotal migration to api

* Remove test that fails due to how the api returns not found entries

* Remove entries from myparser re google

* update fastapi and starlette

* update version

* Update dockerfile to use dev ubuntu version

* remove spyse module

* remove spyse dep

* fix tests by removing un-needed tests and indentation fix

* fix some mypy errors

* remove spyse and remove color output and fix mypy error

* flake8 fixes

* bump version and set it a dev version
2022-08-03 23:12:59 +01:00

32 lines
969 B
Python

#!/usr/bin/env python3
# coding=utf-8
from theHarvester.lib.core import *
from theHarvester.discovery import otxsearch
import os
import requests
import pytest
pytestmark = pytest.mark.asyncio
github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True
class TestOtx(object):
@staticmethod
def domain() -> str:
return 'metasploit.com'
async def test_api(self):
base_url = f'https://otx.alienvault.com/api/v1/indicators/domain/{TestOtx.domain()}/passive_dns'
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 = otxsearch.SearchOtx(TestOtx.domain())
await search.process()
assert isinstance(await search.get_hostnames(), set)
assert isinstance(await search.get_ips(), set)
if __name__ == '__main__':
pytest.main()