Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
talltechy committed Jun 9, 2023
1 parent 86a60bd commit f0ada9c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions api_pa_xdr_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import hashlib
from typing import Optional
from dotenv import load_dotenv
import logging
from mlogconfig import setup_logging

# Python script that uses the Palo Alto Cortex XDR API and Rapid7 InsightVM API
# This script is provided as-is without warranty of any kind.
Expand All @@ -24,6 +26,15 @@
if not xdr_api_key or not xdr_api_key_id:
raise ValueError("Missing XDR API credentials. Please check .env file.")

# Set up logging via mlogconfig
setup_logging(
file_path="myapp.log",
error_log_file_path="myapp_error.log",
console_logging=True,
syslog_logging=True,
log_level=logging.DEBUG,
)

def generate_advanced_authentication(api_key: str, api_key_id: str,
payload: Optional[dict] = None):
"""
Expand Down Expand Up @@ -59,3 +70,7 @@ def generate_advanced_authentication(api_key: str, api_key_id: str,
'x-xdr-auth-id': str(api_key_id)
}
return headers

# Call the `generate_advanced_authentication()` function
auth_headers = generate_advanced_authentication(xdr_api_key, xdr_api_key_id)
print(auth_headers)
2 changes: 1 addition & 1 deletion pa_cortex_xdr_get_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
import requests
from datetime import datetime, timezone
import secrets
import string
import hashlib
import requests
from dotenv import load_dotenv
from api_functions import get_xdr_credentials

Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0ada9c

Please sign in to comment.