Skip to content

Commit

Permalink
Create threat_intelligence.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 27, 2024
1 parent aef1cd1 commit 3b8c4d4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions cybersecurity/threat_intelligence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import requests
import json
from datetime import datetime

# Threat Intelligence API keys
api_keys = {
'virustotal': 'YOUR_API_KEY',
'alienvault': 'YOUR_API_KEY',
'threatcrowd': 'YOUR_API_KEY'
}

# Function to fetch threat intelligence data
def fetch_threat_intel(ip_address):
intel_data = {}
for api, key in api_keys.items():
if api == 'virustotal':
url = f'https://www.virustotal.com/api/v3/ip_addresses/{ip_address}'
headers = {'x-apikey': key}
response = requests.get(url, headers=headers)
intel_data[api] = response.json()
elif api == 'alienvault':
url = f'https://otx.alienvault.com/api/v1/indicators/ip/{ip_address}'
headers = {'x-apikey': key}
response = requests.get(url, headers=headers)
intel_data[api] = response.json()
elif api == 'threatcrowd':
url = f'https://www.threatcrowd.org/api/v2/ip/{ip_address}'
response = requests.get(url)
intel_data[api] = response.json()
return intel_data

# Example usage
ip_address = '8.8.8.8'
intel_data = fetch_threat_intel(ip_address)
print(json.dumps(intel_data, indent=4))

0 comments on commit 3b8c4d4

Please sign in to comment.