Skip to content

Commit

Permalink
Update otx provider (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-marchand authored Jul 22, 2023
2 parents b9c0f8f + a7a9f4f commit cb09743
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions gau_python/providers/otx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,29 @@

import requests

base_url = 'https://otx.alienvault.com/api/v1/indicators/hostname'
base_urls = ['https://otx.alienvault.com/api/v1/indicators/hostname',
'https://otx.alienvault.com/api/v1/indicators/url',
'https://otx.alienvault.com/api/v1/indicators/domain']


def get_urls_otx(domain):
urls = []
page = 1
try:
while True:
request_url = base_url + f'/{domain}/url_list?limit=100&page={str(page)}'
logging.info(f'GET {request_url}')
response = requests.get(url=request_url)
response_json = json.loads(response.text)
for base_url in base_urls:
page = 1
while True:
request_url = base_url + f'/{domain}/url_list?limit=100&page={str(page)}'
logging.info(f'GET {request_url}')
response = requests.get(url=request_url)
response_json = json.loads(response.text)

for url_item in response_json["url_list"]:
urls.append(str(url_item["url"]))
if response_json['has_next']:
page += 1
else:
if 'url_list' not in response_json:
for url_item in response_json["url_list"]:
urls.append(str(url_item["url"]))
if response_json['has_next']:
page += 1
else:
break
break

except requests.exceptions.Timeout:
Expand Down

0 comments on commit cb09743

Please sign in to comment.