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

Update snort_blocklist_importer.py #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
8 changes: 8 additions & 0 deletions snort_blocklist_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
# Snort Blocklist Cache
SNORT_DATA_FILE = "blocklist.json"

# Stealthwatch Constants
XSRF_HEADER_NAME = 'X-XSRF-TOKEN'

####################
# FUNCTIONS #
####################
Expand Down Expand Up @@ -189,7 +192,12 @@ def get_access_token():
response = API_SESSION.post(url, data=login_credentials, verify=False)

# If the request was successful, then proceed
# Set XSRF token for future requests
if response.status_code == 200:
for cookie in response.cookies:
if cookie.name == 'XSRF-TOKEN':
API_SESSION.headers.update({XSRF_HEADER_NAME: cookie.value})
break
print("Successfully Authenticated.")

return response.text
Expand Down