Skip to content

Commit

Permalink
Merge pull request #71 from Yelp/issue_67_threat_grid_integration
Browse files Browse the repository at this point in the history
Added integration with OpenDNS Investigate endpoint for file hashes
  • Loading branch information
megancarney authored Dec 21, 2016
2 parents 55de81a + 41f1a6a commit 09a1cd7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/opendns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,11 @@ def test_related_domains(self):
expected_query_params='domain',
api_response={},
expected_result={})

def test_sample(self):
self._test_api_call_get(call=self.opendns.sample,
endpoint=u'sample/{0}',
request=['0492d93195451e41f568f68e7704eb0812bc2b19'],
expected_query_params='0492d93195451e41f568f68e7704eb0812bc2b19',
api_response={},
expected_result={})
13 changes: 13 additions & 0 deletions threat_intel/opendns.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ def latest_malicious(self, ips):
fmt_url_path = u'ips/{0}/latest_domains'
return self._multi_get(api_name, fmt_url_path, ips)

def sample(self, hashes):
"""Get the information about a sample based on its hash.
Args:
hashes: an enumerable of strings as hashes
Returns:
An enumerable of arrays which contains the information
about the original samples
"""
api_name = 'opendns-sample'
fmt_url_path = u'sample/{0}'
return self._multi_get(api_name, fmt_url_path, hashes)


class ResponseError(Exception):

Expand Down

0 comments on commit 09a1cd7

Please sign in to comment.