Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes status_code 503 error caused by Cloudflare #861

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions analyzers/TalosReputation/TalosReputation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# encoding: utf-8

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

Expand Down Expand Up @@ -30,9 +30,8 @@ def run(self):
if self.data_type == 'ip':
try:
data = self.get_data()

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

scraper = cloudscraper.CloudScraper()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please change tabs with spaces? There is a "TabError: inconsistent use of tabs and spaces in indentation" error.


headers={
'Host':'talosintelligence.com',
Expand All @@ -41,15 +40,15 @@ def run(self):
'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
}
)

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/',
Expand Down