Skip to content

Commit

Permalink
Merge pull request #343 from CAPESandbox/misp
Browse files Browse the repository at this point in the history
Create whoisxmlapi.py
  • Loading branch information
doomedraven authored Feb 8, 2023
2 parents dde3fcc + 1a5a86f commit 36735ce
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/cuckoo/common/integrations/whoisxmlapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import logging

import requests

from lib.cuckoo.common.config import Config

log = logging.getLogger()
externalservices_cfg = Config("externalservices")
apikey = externalservices_cfg.whoisxmlapi.apikey

def whoisxmlapi_lookup(host):
if not externalservices_cfg.whoisxmlapi.enabled or not apikey:
return {}

result = {}
log.debug("Performing WHOIS Query for IP/Domain: %s", host)
url = f"https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey={apikey}&domainName={host}&outputFormat=json"
try:
r = requests.get(url, verify=False)
if r.ok:
result = r.json()
except Exception as e:
log.error("whoismlapi.com exception: %s", str(e))

return result

0 comments on commit 36735ce

Please sign in to comment.