
Analyzing Indicators Of Compromise
- 375 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Run a structured investigation when logs or alerts surface suspicious hashes, IPs, domains, or URLs.
About
Analyzing Indicators Of Compromise is a Security agent skill for solo and indie builders who need repeatable triage when something looks wrong in production or pre-launch monitoring. Instead of improvising in chat, you hand your coding agent concrete artifacts—hashes, IPs, domains, URLs, or pasted intel—and follow a procedural path to validate severity, link related indicators, and decide what to block, rotate, or patch. It fits the Ship security shelf and Operate incident moments when you are wearing every hat and cannot afford a vague “looks fine” answer. The skill emphasizes documentation-friendly conclusions you can attach to a ticket, share with a cofounder, or feed into a deeper forensics step. It does not replace commercial EDR or paid threat feeds; it gives you agent-native procedure so investigation stays consistent under time pressure.
- Structured workflow for analyzing file hashes, IP addresses, domains, and URLs from alerts or exports
- Correlation guidance to tie multiple IOC types to the same incident narrative
- Triage-oriented outputs suited to solo builders without a full SOC stack
- Framed for agent-assisted investigation alongside your existing logs and tooling
- Apache 2.0 skill package from the anthropic-cybersecurity-skills collection
Analyzing Indicators Of Compromise by the numbers
- 375 all-time installs (skills.sh)
- +20 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #570 of 2,203 Security skills by installs in the Skillselion catalog
- Security screen: CRITICAL risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-indicators-of-compromiseAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 375 |
|---|---|
| repo stars | ★ 27.3k |
| Security audit | 1 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
What it does
Run a structured investigation when logs or alerts surface suspicious hashes, IPs, domains, or URLs.
Files
Analyzing Indicators of Compromise
When to Use
Use this skill when:
- A phishing email or alert generates IOCs (URLs, IP addresses, file hashes) requiring rapid triage
- Automated feeds deliver bulk IOCs that need confidence scoring before ingestion into blocking controls
- An incident investigation requires contextual enrichment of observed network artifacts
Do not use this skill in isolation for high-stakes blocking decisions — always combine automated enrichment with analyst judgment, especially for shared infrastructure (CDNs, cloud providers).
Prerequisites
- VirusTotal API key (free or Enterprise) for multi-AV and sandbox lookup
- AbuseIPDB API key for IP reputation checks
- MISP instance or TIP for cross-referencing against known campaigns
- Python with
requestsandvt-pylibraries, or SOAR platform with pre-built connectors
Workflow
Step 1: Normalize and Classify IOC Types
Before enriching, classify each IOC:
- IPv4/IPv6 address: Check if RFC 1918 private (skip external enrichment), validate format
- Domain/FQDN: Defang for safe handling (
evil[.]com), extract registered domain via tldextract - URL: Extract domain + path separately; check for redirectors
- File hash: Identify hash type (MD5/SHA-1/SHA-256); prefer SHA-256 for uniqueness
- Email address: Split into domain (check MX/DMARC) and local part for pattern analysis
Defang IOCs in documentation (replace . with [.] and :// with [://]) to prevent accidental clicks.
Step 2: Multi-Source Enrichment
VirusTotal (file hash, URL, IP, domain):
import vt
client = vt.Client("YOUR_VT_API_KEY")
# File hash lookup
file_obj = client.get_object(f"/files/{sha256_hash}")
detections = file_obj.last_analysis_stats
print(f"Malicious: {detections['malicious']}/{sum(detections.values())}")
# Domain analysis
domain_obj = client.get_object(f"/domains/{domain}")
print(domain_obj.last_analysis_stats)
print(domain_obj.reputation)
client.close()AbuseIPDB (IP addresses):
import requests
response = requests.get(
"https://api.abuseipdb.com/api/v2/check",
headers={"Key": "YOUR_KEY", "Accept": "application/json"},
params={"ipAddress": "1.2.3.4", "maxAgeInDays": 90}
)
data = response.json()["data"]
print(f"Confidence: {data['abuseConfidenceScore']}%, Reports: {data['totalReports']}")MalwareBazaar (file hashes):
response = requests.post(
"https://mb-api.abuse.ch/api/v1/",
data={"query": "get_info", "hash": sha256_hash}
)
result = response.json()
if result["query_status"] == "ok":
print(result["data"][0]["tags"], result["data"][0]["signature"])Step 3: Contextualize with Campaign Attribution
Query MISP for existing events matching the IOC:
from pymisp import PyMISP
misp = PyMISP("https://misp.example.com", "API_KEY")
results = misp.search(value="evil-domain.com", type_attribute="domain")
for event in results:
print(event["Event"]["info"], event["Event"]["threat_level_id"])Check Shodan for IP context (hosting provider, open ports, banners) to identify if the IP belongs to bulletproof hosting or a legitimate cloud provider (false positive risk).
Step 4: Assign Confidence Score and Disposition
Apply a tiered decision framework:
- Block (High Confidence ≥ 70%): ≥15 AV detections on VT, AbuseIPDB score ≥70, matches known malware family or campaign
- Monitor/Alert (Medium 40–69%): 5–14 AV detections, moderate AbuseIPDB score, no campaign attribution
- Whitelist/Investigate (Low <40%): ≤4 AV detections, no abuse reports, legitimate service (Google, Cloudflare CDN IPs)
- False Positive: Legitimate business service incorrectly flagged; document and exclude from future alerts
Step 5: Document and Distribute
Record findings in TIP/MISP with:
- All enrichment data collected (timestamps, source, score)
- Disposition decision and rationale
- Blocking actions taken (firewall, proxy, DNS sinkhole)
- Related incident ticket number
Export to STIX indicator object with confidence field set appropriately.
Key Concepts
| Term | Definition |
|---|---|
| IOC | Indicator of Compromise — observable network or host artifact indicating potential compromise |
| Enrichment | Process of adding contextual data to a raw IOC from multiple intelligence sources |
| Defanging | Modifying IOCs (replacing . with [.]) to prevent accidental activation in documentation |
| False Positive Rate | Percentage of benign artifacts incorrectly flagged as malicious; critical for tuning block thresholds |
| Sinkhole | DNS server redirecting malicious domain lookups to a benign IP for detection without blocking traffic entirely |
| TTL | Time-to-live for an IOC in blocking controls; IP indicators should expire after 30 days, domains after 90 days |
Tools & Systems
- VirusTotal: Multi-engine malware scanner and threat intelligence platform with 70+ AV engines, sandbox reports, and community comments
- AbuseIPDB: Community-maintained IP reputation database with 90-day abuse report history
- MalwareBazaar (abuse.ch): Free malware hash repository with YARA rule associations and malware family tagging
- URLScan.io: Free URL analysis service that captures screenshots, DOM, and network requests for phishing URL triage
- Shodan: Internet-wide scan data providing hosting provider, open ports, and banner information for IP enrichment
Common Pitfalls
- Blocking shared infrastructure: CDN IPs (Cloudflare 104.21.x.x, AWS CloudFront) may legitimately host malicious content but blocking the IP disrupts thousands of legitimate sites.
- VT score obsession: Low VT detection count does not mean benign — zero-day malware and custom APT tools often score 0 initially. Check sandbox behavior, MISP, and passive DNS.
- Missing defanging: Pasting live IOCs in emails or Confluence docs can trigger automated URL scanners or phishing tools.
- No expiration policy: IOCs without TTLs accumulate in blocklists indefinitely, generating false positives as infrastructure is repurposed by legitimate users.
- Over-relying on single source: VirusTotal aggregates AV opinions — all may be wrong or lag behind emerging malware. Use 3+ independent sources for high-stakes decisions.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: IOC Enrichment Tools
VirusTotal API v3
File Hash Lookup
curl -H "x-apikey: $VT_KEY" \
"https://www.virustotal.com/api/v3/files/<sha256>"Domain Lookup
curl -H "x-apikey: $VT_KEY" \
"https://www.virustotal.com/api/v3/domains/<domain>"IP Lookup
curl -H "x-apikey: $VT_KEY" \
"https://www.virustotal.com/api/v3/ip_addresses/<ip>"Key Response Fields
| Field | Description |
|---|---|
last_analysis_stats.malicious | Number of AV engines detecting as malicious |
last_analysis_stats.undetected | AV engines finding clean |
reputation | Community reputation score |
popular_threat_classification | Threat label consensus |
Python (vt-py)
import vt
client = vt.Client("API_KEY")
file_obj = client.get_object(f"/files/{sha256}")
stats = file_obj.last_analysis_stats
client.close()AbuseIPDB API v2
Check IP
curl -G "https://api.abuseipdb.com/api/v2/check" \
-H "Key: $ABUSE_KEY" -H "Accept: application/json" \
-d "ipAddress=1.2.3.4" -d "maxAgeInDays=90"Response Fields
| Field | Description |
|---|---|
abuseConfidenceScore | 0-100 abuse confidence |
totalReports | Report count in timeframe |
countryCode | Source country |
isp | Internet service provider |
isTor | Tor exit node flag |
MalwareBazaar API (abuse.ch)
Hash Lookup
curl -X POST "https://mb-api.abuse.ch/api/v1/" \
-d "query=get_info" -d "hash=<sha256>"Response Fields
| Field | Description |
|---|---|
signature | Malware family name |
tags | Associated tags |
file_type | File type identification |
first_seen | First submission date |
reporter | Submitting analyst |
URLScan.io API
Submit URL for Scan
curl -X POST "https://urlscan.io/api/v1/scan/" \
-H "API-Key: $KEY" -H "Content-Type: application/json" \
-d '{"url": "http://suspicious.com", "visibility": "private"}'Retrieve Results
curl "https://urlscan.io/api/v1/result/<uuid>/"Shodan API
IP Lookup
curl "https://api.shodan.io/shodan/host/<ip>?key=$SHODAN_KEY"Response Fields
| Field | Description |
|---|---|
ports | Open ports list |
os | Operating system |
org | Organization |
asn | Autonomous system number |
hostnames | Associated hostnames |
IOC Confidence Scoring Framework
| Score | Disposition | Criteria |
|---|---|---|
| >= 70 | BLOCK | 15+ VT detections, AbuseIPDB >= 70%, or MalwareBazaar match |
| 40-69 | MONITOR | 5-14 VT detections, moderate abuse score |
| < 40 | INVESTIGATE | Low detection, no campaign attribution |
Defanging Convention
| Original | Defanged |
|---|---|
http:// | hxxp:// |
https:// | hxxps:// |
.com | [.]com |
evil.com | evil[.]com |
#!/usr/bin/env python3
"""IOC analysis and enrichment agent using VirusTotal, AbuseIPDB, and MalwareBazaar APIs."""
import re
import os
import json
import datetime
try:
import requests
HAS_REQUESTS = True
except ImportError:
HAS_REQUESTS = False
def classify_ioc(value):
"""Classify an IOC by type: ipv4, domain, url, sha256, sha1, md5, email."""
value = value.strip()
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", value):
return "ipv4"
if re.match(r"^[a-fA-F0-9]{64}$", value):
return "sha256"
if re.match(r"^[a-fA-F0-9]{40}$", value):
return "sha1"
if re.match(r"^[a-fA-F0-9]{32}$", value):
return "md5"
if re.match(r"^https?://", value):
return "url"
if re.match(r"^[^@]+@[^@]+\.[^@]+$", value):
return "email"
if re.match(r"^[a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$", value):
return "domain"
return "unknown"
def defang_ioc(value):
"""Defang an IOC for safe documentation."""
value = value.replace("http://", "hxxp://")
value = value.replace("https://", "hxxps://")
value = re.sub(r"\.(?=\w)", "[.]", value)
return value
def refang_ioc(value):
"""Refang a defanged IOC for querying APIs."""
value = value.replace("hxxp://", "http://")
value = value.replace("hxxps://", "https://")
value = value.replace("[.]", ".")
value = value.replace("[://]", "://")
return value
def is_private_ip(ip):
"""Check if an IP is RFC 1918 private."""
octets = [int(o) for o in ip.split(".")]
if octets[0] == 10:
return True
if octets[0] == 172 and 16 <= octets[1] <= 31:
return True
if octets[0] == 192 and octets[1] == 168:
return True
if octets[0] == 127:
return True
return False
def query_virustotal_hash(sha256, api_key):
"""Query VirusTotal for a file hash."""
url = f"https://www.virustotal.com/api/v3/files/{sha256}"
resp = requests.get(url, headers={"x-apikey": api_key}, timeout=30)
if resp.status_code == 200:
data = resp.json().get("data", {}).get("attributes", {})
stats = data.get("last_analysis_stats", {})
return {
"sha256": sha256,
"malicious": stats.get("malicious", 0),
"total": sum(stats.values()),
"type_description": data.get("type_description", ""),
"popular_threat_name": data.get("popular_threat_classification", {}).get(
"suggested_threat_label", ""),
"tags": data.get("tags", []),
}
return None
def query_virustotal_domain(domain, api_key):
"""Query VirusTotal for domain reputation."""
url = f"https://www.virustotal.com/api/v3/domains/{domain}"
resp = requests.get(url, headers={"x-apikey": api_key}, timeout=30)
if resp.status_code == 200:
data = resp.json().get("data", {}).get("attributes", {})
stats = data.get("last_analysis_stats", {})
return {
"domain": domain,
"malicious": stats.get("malicious", 0),
"suspicious": stats.get("suspicious", 0),
"reputation": data.get("reputation", 0),
"registrar": data.get("registrar", ""),
"creation_date": data.get("creation_date", ""),
}
return None
def query_abuseipdb(ip, api_key, max_age_days=90):
"""Query AbuseIPDB for IP reputation."""
url = "https://api.abuseipdb.com/api/v2/check"
resp = requests.get(url, headers={"Key": api_key, "Accept": "application/json"},
params={"ipAddress": ip, "maxAgeInDays": max_age_days}, timeout=30)
if resp.status_code == 200:
data = resp.json().get("data", {})
return {
"ip": ip,
"abuse_confidence": data.get("abuseConfidenceScore", 0),
"total_reports": data.get("totalReports", 0),
"country": data.get("countryCode", ""),
"isp": data.get("isp", ""),
"domain": data.get("domain", ""),
"is_tor": data.get("isTor", False),
}
return None
def query_malwarebazaar(sha256):
"""Query MalwareBazaar for file hash information."""
url = "https://mb-api.abuse.ch/api/v1/"
resp = requests.post(url, data={"query": "get_info", "hash": sha256}, timeout=30)
if resp.status_code == 200:
result = resp.json()
if result.get("query_status") == "ok" and result.get("data"):
entry = result["data"][0]
return {
"sha256": sha256,
"signature": entry.get("signature", ""),
"tags": entry.get("tags", []),
"file_type": entry.get("file_type", ""),
"reporter": entry.get("reporter", ""),
"first_seen": entry.get("first_seen", ""),
}
return None
def score_ioc(vt_result=None, abuse_result=None, mb_result=None):
"""Assign a confidence score and disposition to an IOC."""
score = 0
reasons = []
if vt_result:
malicious = vt_result.get("malicious", 0)
if malicious >= 15:
score += 40
reasons.append(f"VT: {malicious} detections (high)")
elif malicious >= 5:
score += 20
reasons.append(f"VT: {malicious} detections (moderate)")
elif malicious > 0:
score += 5
reasons.append(f"VT: {malicious} detections (low)")
if abuse_result:
abuse_score = abuse_result.get("abuse_confidence", 0)
if abuse_score >= 70:
score += 30
reasons.append(f"AbuseIPDB: {abuse_score}% confidence")
elif abuse_score >= 30:
score += 15
reasons.append(f"AbuseIPDB: {abuse_score}% confidence")
if mb_result:
score += 30
reasons.append(f"MalwareBazaar: {mb_result.get('signature', 'known malware')}")
if score >= 70:
disposition = "BLOCK"
elif score >= 40:
disposition = "MONITOR"
else:
disposition = "INVESTIGATE"
return {"score": score, "disposition": disposition, "reasons": reasons}
def enrich_ioc(value, vt_key=None, abuse_key=None):
"""Enrich a single IOC with multi-source intelligence."""
ioc_type = classify_ioc(value)
result = {
"ioc": value,
"type": ioc_type,
"defanged": defang_ioc(value),
"enrichment": {},
"timestamp": datetime.datetime.utcnow().isoformat() + "Z",
}
if not HAS_REQUESTS:
result["error"] = "requests library not installed"
return result
if ioc_type == "ipv4" and is_private_ip(value):
result["note"] = "RFC 1918 private IP - skipping external enrichment"
return result
if ioc_type in ("sha256", "sha1", "md5") and vt_key:
result["enrichment"]["virustotal"] = query_virustotal_hash(value, vt_key)
result["enrichment"]["malwarebazaar"] = query_malwarebazaar(value)
elif ioc_type == "ipv4":
if abuse_key:
result["enrichment"]["abuseipdb"] = query_abuseipdb(value, abuse_key)
if vt_key:
result["enrichment"]["virustotal"] = query_virustotal_domain(value, vt_key)
elif ioc_type == "domain" and vt_key:
result["enrichment"]["virustotal"] = query_virustotal_domain(value, vt_key)
scoring = score_ioc(
result["enrichment"].get("virustotal"),
result["enrichment"].get("abuseipdb"),
result["enrichment"].get("malwarebazaar"),
)
result["score"] = scoring["score"]
result["disposition"] = scoring["disposition"]
result["reasons"] = scoring["reasons"]
return result
if __name__ == "__main__":
print("=" * 60)
print("IOC Analysis & Enrichment Agent")
print("VirusTotal, AbuseIPDB, MalwareBazaar integration")
print("=" * 60)
demo_iocs = [
"185.220.101.42",
"evil-domain.com",
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"http://malicious-site.com/payload.exe",
"192.168.1.100",
]
print("\n--- IOC Classification & Defanging ---")
for ioc in demo_iocs:
ioc_type = classify_ioc(ioc)
defanged = defang_ioc(ioc)
private = " (private)" if ioc_type == "ipv4" and is_private_ip(ioc) else ""
print(f" {ioc_type:8s} | {defanged}{private}")
vt_key = os.environ.get("VT_API_KEY")
abuse_key = os.environ.get("ABUSEIPDB_API_KEY")
if vt_key or abuse_key:
print("\n--- Enrichment (live API queries) ---")
for ioc in demo_iocs:
result = enrich_ioc(ioc, vt_key, abuse_key)
print(f"\n {result['ioc']} ({result['type']})")
print(f" Disposition: {result.get('disposition', 'N/A')} "
f"(score: {result.get('score', 0)})")
for reason in result.get("reasons", []):
print(f" - {reason}")
else:
print("\n[*] Set VT_API_KEY and/or ABUSEIPDB_API_KEY environment variables for live enrichment.")
Related skills
FAQ
Is Analyzing Indicators Of Compromise safe to install?
skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.