def whois_search(self, query='', field=''):
"""
Performs a WHOIS search with the given parameters
:param query: the search term
:type str:
:param field: WHOIS field to execute the search on: domain, email,
name, organization, address, phone, nameserver
:type str:
:returns dict using json.loads()
"""
log.debug('Permforming WHOIS search with query: {0} and field: '
'{1}'.format(query, field))
params = {'query': query, 'field': field}
r = requests.get('https://api.passivetotal.org/v2/whois/search',
auth=HTTPBasicAuth(self.username, self.apikey),
proxies=self.proxies, params=params)
if r.status_code == 200:
results = json.loads(r.text)
return results
else:
log.error('HTTP code {0} returned during WHOIS search '
'request.'.format(r.status_code))
return None
评论列表
文章目录