Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lyzers into mgabriel-silva-master

 especially if it merges an updated upstream into a topic branch.
  • Loading branch information
jeromeleonard committed May 7, 2019
2 parents 7eac15a + a271710 commit 1de05c7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions analyzers/TalosReputation/TalosReputation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import requests
from cortexutils.analyzer import Analyzer
import json

class TalosReputation(Analyzer):

Expand Down Expand Up @@ -31,8 +32,10 @@ def run(self):
data = self.get_data()

headers={
'Host':'talosintelligence.com',
'Referer':'https://talosintelligence.com/reputation_center/lookup?search={}'.format(data),
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',
'Accept':'*/*'
}

response_details = requests.get('https://talosintelligence.com/sb_api/query_lookup',
Expand All @@ -54,12 +57,12 @@ def run(self):
if response_details.status_code == 200 | 201:
if response_location.status_code == 200 | 201:
result = response_details.json()
result['country'] = response_location.json()['country']
result['country'] = response_location.json().get('country', None)
self.report(result if len(result) > 0 else {})
else:
self.error('Failed to query Talos. Status_code {}'.format(response_location.status_code))
self.error('Failed to query Talos location. Status_code {}'.format(response_location.status_code))
else:
self.error('Failed to query Talos. Status_code {}'.format(response_details.status_code))
self.error('Failed to query Talos details. Status_code {}'.format(response_details.status_code))
except Exception as e:
self.unexpectedError(e)
else:
Expand Down

0 comments on commit 1de05c7

Please sign in to comment.