
Automating Ioc Enrichment
- 184 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Automating-ioc-enrichment is an agent skill aimed at security-minded solo builders and indie teams who need to turn raw indicators into actionable context without opening five browser tabs. It packages procedural steps f
About
automating-ioc-enrichment is an agent skill aimed at security-minded solo builders and indie teams who need to turn raw indicators into actionable context without opening five browser tabs. It packages procedural steps for enriching IOCs—such as tying hashes, domains, and addresses to reputation and context—so your coding agent can run a repeatable enrichment pass as part of alert triage or post-deploy review. Because the published SKILL excerpt in the catalog is thin, treat it as a focused security automation module within mukul975’s Anthropic cybersecurity skills collection rather than a full SIEM replacement. Use it when you already have indicators from logs, a breach checklist, or a dependency audit and want structured enrichment before blocking, patching, or documenting an incident. Pair with review and monitoring skills once you have production traffic to watch.
- Automates IOC enrichment workflows for common indicator types
- Fits agent-driven security runbooks in Anthropic cybersecurity skill packs
- Apache 2.0 licensed packaging from a multi-skill security repository
- Intended to chain with broader SOC and detection skills in the same catalog
Automating Ioc Enrichment by the numbers
- 184 all-time installs (skills.sh)
- +5 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #808 of 2,203 Security skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill automating-ioc-enrichmentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 184 |
|---|---|
| repo stars | ★ 27.3k |
| Security audit | 2 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
Enrich indicators of compromise (IPs, hashes, domains) automatically so a solo builder or small team can triage alerts without manual threat-intel lookups.?
Enrich indicators of compromise (IPs, hashes, domains) automatically so a developer or small team can triage alerts without manual threat-intel lookups.
Who is it for?
A developer or small team who needs enrich indicators of compromise (ips, hashes, domains) automatically so a developer or small team can triage alerts without manual threat-intel lookups..
Skip if: Teams with no use for automating-ioc-enrichment or anyone needing capabilities outside what the skill documents.
When should I use this skill?
When you need to enrich indicators of compromise (ips, hashes, domains) automatically so a solo builder or small team can triage alerts without manual threat-intel lookups..
What you get
Deliverables covering automates ioc enrichment workflows for common indicator types, fits agent-driven security runbooks in anthropic cybersecurity skill packs, apache 2.0 licensed packaging from a multi-skill security r
Files
Automating IOC Enrichment
When to Use
Use this skill when:
- Building a SOAR playbook that automatically enriches SIEM alerts with threat intelligence context before routing to analysts
- Creating a Python pipeline for bulk IOC enrichment from phishing email submissions
- Reducing analyst mean time to triage (MTTT) by pre-populating alert context with VT, Shodan, and MISP data
Do not use this skill for fully automated blocking decisions without human review — enrichment automation should inform decisions, not execute blocks autonomously for high-impact actions.
Prerequisites
- SOAR platform (Cortex XSOAR, Splunk SOAR, Tines, or n8n) or Python 3.9+ environment
- API keys: VirusTotal, AbuseIPDB, Shodan, and at minimum one TIP (MISP or OpenCTI)
- SIEM integration endpoint for alert consumption
- Rate limit budgets documented per API (VT: 4/min free, 500/min enterprise)
Workflow
Step 1: Design Enrichment Pipeline Architecture
Define the enrichment flow for each IOC type:
SIEM Alert → Extract IOCs → Classify Type → Route to enrichment functions
IP Address → AbuseIPDB + Shodan + VirusTotal IP + MISP
Domain → VirusTotal Domain + PassiveTotal + Shodan + MISP
URL → URLScan.io + VirusTotal URL + Google Safe Browse
File Hash → VirusTotal Files + MalwareBazaar + MISP
→ Aggregate results → Calculate confidence score → Update alert → Notify analystStep 2: Implement Python Enrichment Functions
import requests
import time
from dataclasses import dataclass, field
from typing import Optional
RATE_LIMIT_DELAY = 0.25 # 4 requests/second for VT free tier
@dataclass
class EnrichmentResult:
ioc_value: str
ioc_type: str
vt_malicious: int = 0
vt_total: int = 0
abuse_confidence: int = 0
shodan_ports: list = field(default_factory=list)
misp_events: list = field(default_factory=list)
confidence_score: int = 0
def enrich_ip(ip: str, vt_key: str, abuse_key: str, shodan_key: str) -> EnrichmentResult:
result = EnrichmentResult(ip, "ip")
# VirusTotal IP lookup
vt_resp = requests.get(
f"https://www.virustotal.com/api/v3/ip_addresses/{ip}",
headers={"x-apikey": vt_key}
)
if vt_resp.status_code == 200:
stats = vt_resp.json()["data"]["attributes"]["last_analysis_stats"]
result.vt_malicious = stats.get("malicious", 0)
result.vt_total = sum(stats.values())
time.sleep(RATE_LIMIT_DELAY)
# AbuseIPDB
abuse_resp = requests.get(
"https://api.abuseipdb.com/api/v2/check",
headers={"Key": abuse_key, "Accept": "application/json"},
params={"ipAddress": ip, "maxAgeInDays": 90}
)
if abuse_resp.status_code == 200:
result.abuse_confidence = abuse_resp.json()["data"]["abuseConfidenceScore"]
# Calculate composite confidence score
result.confidence_score = min(
(result.vt_malicious / max(result.vt_total, 1)) * 60 +
(result.abuse_confidence / 100) * 40, 100
)
return result
def enrich_hash(sha256: str, vt_key: str) -> EnrichmentResult:
result = EnrichmentResult(sha256, "sha256")
vt_resp = requests.get(
f"https://www.virustotal.com/api/v3/files/{sha256}",
headers={"x-apikey": vt_key}
)
if vt_resp.status_code == 200:
stats = vt_resp.json()["data"]["attributes"]["last_analysis_stats"]
result.vt_malicious = stats.get("malicious", 0)
result.vt_total = sum(stats.values())
result.confidence_score = int((result.vt_malicious / max(result.vt_total, 1)) * 100)
return resultStep 3: Build SOAR Playbook (Cortex XSOAR)
In Cortex XSOAR, create an enrichment playbook: 1. Trigger: Alert created in SIEM (via webhook or polling) 2. Extract IOCs: Use "Extract Indicators" task with regex patterns for IP, domain, URL, hash 3. Parallel enrichment: Fan-out to multiple enrichment tasks simultaneously 4. VT Enrichment: Call !vt-file-scan or !vt-ip-scan commands 5. AbuseIPDB check: Call !abuseipdb-check-ip command 6. MISP Lookup: Call !misp-search for cross-referencing 7. Score aggregation: Python transform task computing composite score 8. Conditional routing: If score ≥70 → High Priority queue; if 40–69 → Medium; <40 → Auto-close with note 9. Alert enrichment: Write enrichment results to alert context for analyst view
Step 4: Handle Rate Limiting and Failures
import time
from functools import wraps
def rate_limited(max_per_second):
min_interval = 1.0 / max_per_second
def decorator(func):
last_called = [0.0]
@wraps(func)
def wrapper(*args, **kwargs):
elapsed = time.time() - last_called[0]
wait = min_interval - elapsed
if wait > 0:
time.sleep(wait)
result = func(*args, **kwargs)
last_called[0] = time.time()
return result
return wrapper
return decorator
def retry_on_429(max_retries=3):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
for attempt in range(max_retries):
response = func(*args, **kwargs)
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 60))
time.sleep(retry_after)
else:
return response
return wrapper
return decoratorStep 5: Metrics and Tuning
Track pipeline performance weekly:
- Enrichment latency: Target <30 seconds from alert trigger to enriched output
- API success rate: Target >99% (identify rate limit or outage events)
- True positive rate: Track analyst overrides of automated confidence scores
- Cost: Track API call volume against budget (VT Enterprise: $X per 1M lookups)
Key Concepts
| Term | Definition |
|---|---|
| SOAR | Security Orchestration, Automation, and Response — platform for automating security workflows and integrating disparate tools |
| Enrichment Playbook | Automated workflow sequence that adds contextual intelligence to raw security events |
| Rate Limiting | API provider restrictions on request frequency (e.g., VT free: 4 requests/minute); pipelines must respect these limits |
| Composite Confidence Score | Single score aggregating signals from multiple enrichment sources using weighted formula |
| Fan-out Pattern | Parallel execution of multiple enrichment queries simultaneously to minimize total enrichment latency |
Tools & Systems
- Cortex XSOAR (Palo Alto): Enterprise SOAR with 700+ marketplace integrations including VT, MISP, Shodan, and AbuseIPDB
- Splunk SOAR (Phantom): SOAR platform with Python-based playbooks; native Splunk SIEM integration
- Tines: No-code SOAR platform with webhook-driven automation; cost-effective for smaller teams
- TheHive + Cortex: Open-source IR/enrichment platform with observable enrichment via Cortex analyzers
Common Pitfalls
- Blocking on enrichment latency: If enrichment takes >5 minutes, analysts start working unenriched alerts, defeating the purpose. Set timeout limits and provide partial results.
- No caching: Querying the same IOC 50 times generates unnecessary API costs. Cache enrichment results for 24 hours by default.
- Ignoring API failures silently: Failed enrichment calls should be logged and trigger fallback logic, not silently produce empty results that appear as clean IOCs.
- Automating blocks on enrichment score alone: Composite scores contain false positives; require human confirmation for blocking decisions against shared infrastructure.
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: Automating IOC Enrichment
VirusTotal API v3
IP Lookup
import requests
resp = requests.get(
"https://www.virustotal.com/api/v3/ip_addresses/1.2.3.4",
headers={"x-apikey": VT_KEY},
)
stats = resp.json()["data"]["attributes"]["last_analysis_stats"]
print(stats["malicious"], "/", sum(stats.values()))File Hash Lookup
resp = requests.get(
f"https://www.virustotal.com/api/v3/files/{sha256}",
headers={"x-apikey": VT_KEY},
)Domain Lookup
resp = requests.get(
f"https://www.virustotal.com/api/v3/domains/{domain}",
headers={"x-apikey": VT_KEY},
)AbuseIPDB API v2
resp = requests.get(
"https://api.abuseipdb.com/api/v2/check",
headers={"Key": ABUSE_KEY, "Accept": "application/json"},
params={"ipAddress": "1.2.3.4", "maxAgeInDays": 90},
)
data = resp.json()["data"]
print("Confidence:", data["abuseConfidenceScore"])
print("Reports:", data["totalReports"])Shodan API
import shodan
api = shodan.Shodan(SHODAN_KEY)
info = api.host("1.2.3.4")
print("Ports:", info.get("ports"))
print("Vulns:", info.get("vulns"))STIX 2.1 Export
from stix2 import Indicator, Bundle
indicator = Indicator(
pattern="[ipv4-addr:value = '1.2.3.4']",
pattern_type="stix",
valid_from="2025-01-01T00:00:00Z",
confidence=85,
)
bundle = Bundle(objects=[indicator])Rate Limits
| API | Free Tier | Enterprise |
|---|---|---|
| VirusTotal | 4 req/min | 500 req/min |
| AbuseIPDB | 1000 req/day | 5000 req/day |
| Shodan | 1 req/sec | 10 req/sec |
References
- VirusTotal API: https://docs.virustotal.com/reference/overview
- AbuseIPDB API: https://docs.abuseipdb.com/
- stix2 library: https://pypi.org/project/stix2/
- Shodan: https://shodan.readthedocs.io/
#!/usr/bin/env python3
"""Agent for automating IOC enrichment with VirusTotal, AbuseIPDB, and STIX."""
import os
import re
import json
import time
import argparse
from datetime import datetime
from dataclasses import dataclass, field
import requests
from stix2 import Indicator, Bundle
RATE_LIMIT_DELAY = 0.25
@dataclass
class EnrichmentResult:
ioc_value: str
ioc_type: str
vt_malicious: int = 0
vt_total: int = 0
vt_threat_label: str = ""
abuse_confidence: int = 0
abuse_reports: int = 0
shodan_ports: list = field(default_factory=list)
confidence_score: int = 0
def classify_ioc(value):
"""Auto-detect IOC type from value."""
if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", value):
return "ip"
if re.match(r"^[a-fA-F0-9]{64}$", value):
return "sha256"
if re.match(r"^[a-fA-F0-9]{32}$", value):
return "md5"
if re.match(r"^https?://", value):
return "url"
return "domain"
def enrich_ip_virustotal(ip, api_key):
"""Enrich an IP address via VirusTotal API v3."""
resp = requests.get(
f"https://www.virustotal.com/api/v3/ip_addresses/{ip}",
headers={"x-apikey": api_key},
timeout=30,
)
if resp.status_code == 200:
attrs = resp.json()["data"]["attributes"]
stats = attrs.get("last_analysis_stats", {})
return {
"malicious": stats.get("malicious", 0),
"total": sum(stats.values()),
"country": attrs.get("country", ""),
"asn": attrs.get("asn", 0),
"as_owner": attrs.get("as_owner", ""),
}
return {}
def enrich_hash_virustotal(file_hash, api_key):
"""Enrich a file hash via VirusTotal API v3."""
resp = requests.get(
f"https://www.virustotal.com/api/v3/files/{file_hash}",
headers={"x-apikey": api_key},
timeout=30,
)
if resp.status_code == 200:
attrs = resp.json()["data"]["attributes"]
stats = attrs.get("last_analysis_stats", {})
ptc = attrs.get("popular_threat_classification", {})
return {
"malicious": stats.get("malicious", 0),
"total": sum(stats.values()),
"threat_label": ptc.get("suggested_threat_label", ""),
"type_description": attrs.get("type_description", ""),
}
return {}
def enrich_domain_virustotal(domain, api_key):
"""Enrich a domain via VirusTotal API v3."""
resp = requests.get(
f"https://www.virustotal.com/api/v3/domains/{domain}",
headers={"x-apikey": api_key},
timeout=30,
)
if resp.status_code == 200:
attrs = resp.json()["data"]["attributes"]
stats = attrs.get("last_analysis_stats", {})
return {
"malicious": stats.get("malicious", 0),
"total": sum(stats.values()),
"registrar": attrs.get("registrar", ""),
}
return {}
def enrich_ip_abuseipdb(ip, api_key):
"""Check an IP against AbuseIPDB."""
resp = requests.get(
"https://api.abuseipdb.com/api/v2/check",
headers={"Key": api_key, "Accept": "application/json"},
params={"ipAddress": ip, "maxAgeInDays": 90},
timeout=30,
)
if resp.status_code == 200:
data = resp.json()["data"]
return {
"abuse_confidence": data.get("abuseConfidenceScore", 0),
"total_reports": data.get("totalReports", 0),
"country": data.get("countryCode", ""),
"isp": data.get("isp", ""),
}
return {}
def compute_confidence(vt_result, abuse_result=None):
"""Calculate composite confidence score from enrichment sources."""
vt_score = 0
if vt_result.get("total", 0) > 0:
vt_score = (vt_result["malicious"] / vt_result["total"]) * 60
abuse_score = 0
if abuse_result:
abuse_score = (abuse_result.get("abuse_confidence", 0) / 100) * 40
return min(int(vt_score + abuse_score), 100)
def enrich_ioc(value, ioc_type, vt_key, abuse_key=None):
"""Enrich a single IOC through all available sources."""
result = EnrichmentResult(ioc_value=value, ioc_type=ioc_type)
vt_data = {}
if ioc_type == "ip":
vt_data = enrich_ip_virustotal(value, vt_key)
time.sleep(RATE_LIMIT_DELAY)
if abuse_key:
abuse_data = enrich_ip_abuseipdb(value, abuse_key)
result.abuse_confidence = abuse_data.get("abuse_confidence", 0)
result.abuse_reports = abuse_data.get("total_reports", 0)
elif ioc_type in ("sha256", "md5"):
vt_data = enrich_hash_virustotal(value, vt_key)
time.sleep(RATE_LIMIT_DELAY)
elif ioc_type == "domain":
vt_data = enrich_domain_virustotal(value, vt_key)
time.sleep(RATE_LIMIT_DELAY)
result.vt_malicious = vt_data.get("malicious", 0)
result.vt_total = vt_data.get("total", 0)
result.vt_threat_label = vt_data.get("threat_label", "")
abuse_dict = {"abuse_confidence": result.abuse_confidence} if ioc_type == "ip" else None
result.confidence_score = compute_confidence(vt_data, abuse_dict)
return result
def export_stix_indicators(results, output_path):
"""Export enriched IOCs as STIX 2.1 indicators."""
pattern_map = {
"ip": lambda v: f"[ipv4-addr:value = '{v}']",
"domain": lambda v: f"[domain-name:value = '{v}']",
"sha256": lambda v: f"[file:hashes.'SHA-256' = '{v}']",
"md5": lambda v: f"[file:hashes.MD5 = '{v}']",
"url": lambda v: f"[url:value = '{v}']",
}
indicators = []
for r in results:
pattern_fn = pattern_map.get(r.ioc_type)
if pattern_fn:
ind = Indicator(
name=f"{r.ioc_type}: {r.ioc_value}",
pattern=pattern_fn(r.ioc_value),
pattern_type="stix",
valid_from=datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
confidence=r.confidence_score,
)
indicators.append(ind)
bundle = Bundle(objects=indicators, allow_custom=True)
with open(output_path, "w") as f:
f.write(bundle.serialize(pretty=True))
return len(indicators)
def main():
parser = argparse.ArgumentParser(description="IOC Enrichment Automation Agent")
parser.add_argument("--vt-key", default=os.getenv("VT_API_KEY"), help="VirusTotal API key")
parser.add_argument("--abuse-key", default=os.getenv("ABUSEIPDB_KEY"), help="AbuseIPDB API key")
parser.add_argument("--ioc-file", help="File with IOCs (one per line)")
parser.add_argument("--ioc", help="Single IOC to enrich")
parser.add_argument("--output", default="enrichment_results.json")
parser.add_argument("--stix-output", help="Export as STIX bundle")
args = parser.parse_args()
iocs = []
if args.ioc:
iocs.append(args.ioc)
if args.ioc_file:
with open(args.ioc_file) as f:
iocs.extend(line.strip() for line in f if line.strip() and not line.startswith("#"))
results = []
for ioc_val in iocs:
ioc_type = classify_ioc(ioc_val)
print(f" Enriching {ioc_type}: {ioc_val}...")
result = enrich_ioc(ioc_val, ioc_type, args.vt_key, args.abuse_key)
results.append(result)
verdict = "MALICIOUS" if result.confidence_score >= 70 else "SUSPICIOUS" if result.confidence_score >= 40 else "CLEAN"
print(f" VT: {result.vt_malicious}/{result.vt_total} | Confidence: {result.confidence_score} | {verdict}")
report = {
"enriched_at": datetime.utcnow().isoformat(),
"total_iocs": len(results),
"results": [r.__dict__ for r in results],
}
with open(args.output, "w") as f:
json.dump(report, f, indent=2, default=str)
print(f"[+] Results saved to {args.output}")
if args.stix_output:
count = export_stix_indicators(results, args.stix_output)
print(f"[+] Exported {count} STIX indicators to {args.stix_output}")
if __name__ == "__main__":
main()
Related skills
FAQ
What is automating-ioc-enrichment?
automating-ioc-enrichment is an agent skill aimed at security-minded developers and teams who need to turn raw indicators into actionable context without opening five browser tabs. It packages procedural steps for enriching IOCs—such as tyin
When should I use automating-ioc-enrichment?
When you need to enrich indicators of compromise (ips, hashes, domains) automatically so a developer or small team can triage alerts without manual threat-intel lookups.
Is Automating Ioc Enrichment safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.