Skip to content

Commit

Permalink
Merge pull request #861 from omererdem/master
Browse files Browse the repository at this point in the history
Fixes status_code 503 error caused by Cloudflare
  • Loading branch information
dadokkio committed Sep 21, 2020
2 parents a56645d + 49b375b commit 09cbf95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions analyzers/TalosReputation/TalosReputation.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
# encoding: utf-8

import requests
import cloudscraper
from cortexutils.analyzer import Analyzer
import json


class TalosReputation(Analyzer):

Expand All @@ -12,7 +12,7 @@ def __init__(self):

def summary(self, raw):
taxonomies = []
level = 'info' #If there's a change of naming, will be presented as info
level = 'info' # If there's a change of naming, will be presented as info
namespace = 'Talos'
predicate = 'Reputation'
value = raw.get('email_score_name')
Expand All @@ -31,29 +31,28 @@ def run(self):
try:
data = self.get_data()

s = requests.Session()
s.get('https://talosintelligence.com/reputation_center/lookup?search={}'.format(data))
scraper = cloudscraper.CloudScraper()

headers={
'Host':'talosintelligence.com',
'Referer':'https://talosintelligence.com/reputation_center/lookup?search={}'.format(data),
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
'Accept':'application/json'
headers = {
'Host': 'talosintelligence.com',
'Referer': 'https://talosintelligence.com/reputation_center/lookup?search={}'.format(data),
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
'Accept': 'application/json'
}

response_details = s.get('https://talosintelligence.com/sb_api/query_lookup',
response_details = scraper.get('https://talosintelligence.com/sb_api/query_lookup',
headers = headers,
params = {
'query':'/api/v2/details/ip/',
'query_entry':data
'query': '/api/v2/details/ip/',
'query_entry': data
}
)

response_location = s.get('https://talosintelligence.com/sb_api/query_lookup',
response_location = scraper.get('https://talosintelligence.com/sb_api/query_lookup',
headers = headers,
params = {
'query':'/api/v2/location/ip/',
'query_entry':data
'query': '/api/v2/location/ip/',
'query_entry': data
}
)

Expand All @@ -69,7 +68,8 @@ def run(self):
except Exception as e:
self.unexpectedError(e)
else:
self.notSupported()
self.notSupported()


if __name__ == '__main__':
TalosReputation().run()
2 changes: 1 addition & 1 deletion analyzers/TalosReputation/requirements.txt
@@ -1,2 +1,2 @@
cortexutils
requests
cloudscraper

0 comments on commit 09cbf95

Please sign in to comment.