Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7187e7b607 | |||
| 5bb465eb18 | |||
| a4dcd00cc7 |
@@ -0,0 +1,45 @@
|
||||
id: feed_sslbl
|
||||
name: SSL Blacklist Feed
|
||||
version: 1.0.0
|
||||
description: "abuse.ch SSL Blacklist (SSLBL) feed connector — pull the botnet C2 blocklists: malicious SSL certificate SHA1 fingerprints, or the associated C2 IP:port list. Emits normalized IOCs (hash or IP + type) for import into the Threat Indicator Manager. Free abuse.ch feed (Auth-Key supported); stdlib-only, no extra Python dependencies."
|
||||
changelog: "1.0.0 — Initial release: fetch the SSLBL C2 IP list or SSL certificate fingerprint blacklist."
|
||||
category: feed
|
||||
|
||||
# SSLBL is an abuse.ch feed. An Auth-Key (free) is sent as the Auth-Key header
|
||||
# when provided.
|
||||
config_schema:
|
||||
properties:
|
||||
api_key:
|
||||
type: string
|
||||
description: "abuse.ch Auth-Key (free — from your abuse.ch account profile)"
|
||||
x-soar-sensitive: true
|
||||
list:
|
||||
type: string
|
||||
description: "Which list: ips (botnet C2 IPs) or fingerprints (malicious SSL cert SHA1). Default ips"
|
||||
default: "ips"
|
||||
insecure:
|
||||
type: boolean
|
||||
description: "Trust any TLS certificate (not secure)"
|
||||
default: false
|
||||
required: []
|
||||
|
||||
commands:
|
||||
- id: fetch_indicators
|
||||
name: feed-sslbl-fetch-indicators
|
||||
description: "Fetch an SSLBL list and return normalized indicators."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
list: { type: string, description: "ips | fingerprints (overrides the config default)" }
|
||||
max_indicators: { type: number, description: "Max indicators to return (0 = no limit, default 0)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: feed-sslbl-test-connection
|
||||
description: "Verify the SSLBL feed is reachable (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,92 @@
|
||||
import json, os, sys, ssl, io, csv, urllib.request, urllib.error
|
||||
|
||||
LISTS = {
|
||||
"ips": "https://sslbl.abuse.ch/blacklist/sslipblacklist.csv",
|
||||
"fingerprints": "https://sslbl.abuse.ch/blacklist/sslblacklist.csv",
|
||||
}
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=120, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
key = str(inputs.get("list") or cfg.get("list") or "ips").lower()
|
||||
url = LISTS.get(key, LISTS["ips"])
|
||||
raw = _get(url, cfg).decode("utf-8", "replace")
|
||||
|
||||
maxn = int(inputs.get("max_indicators") or 0)
|
||||
out = []
|
||||
for row in csv.reader(io.StringIO(raw)):
|
||||
if not row or row[0].lstrip().startswith("#"):
|
||||
continue
|
||||
first = row[0].strip()
|
||||
if first.lower() in ("firstseen", "listingdate"): # header row
|
||||
continue
|
||||
if key == "ips":
|
||||
# Firstseen,DstIP,DstPort
|
||||
if len(row) < 2:
|
||||
continue
|
||||
ip = row[1].strip()
|
||||
if not ip:
|
||||
continue
|
||||
item = {"value": ip, "type": "ip"}
|
||||
if len(row) > 2:
|
||||
item["port"] = row[2].strip()
|
||||
out.append(item)
|
||||
else:
|
||||
# Listingdate,SHA1,Listingreason
|
||||
if len(row) < 2:
|
||||
continue
|
||||
fp = row[1].strip()
|
||||
if not fp:
|
||||
continue
|
||||
item = {"value": fp, "type": "hash"}
|
||||
if len(row) > 2:
|
||||
item["reason"] = row[2].strip()
|
||||
out.append(item)
|
||||
if maxn and len(out) >= maxn:
|
||||
break
|
||||
|
||||
return {"source": "sslbl:" + key, "count": len(out), "indicators": out}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,59 @@
|
||||
import json, os, sys, ssl, urllib.request, urllib.error
|
||||
|
||||
LISTS = {
|
||||
"ips": "https://sslbl.abuse.ch/blacklist/sslipblacklist.csv",
|
||||
"fingerprints": "https://sslbl.abuse.ch/blacklist/sslblacklist.csv",
|
||||
}
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
key = str(cfg.get("list") or "ips").lower()
|
||||
url = LISTS.get(key, LISTS["ips"])
|
||||
raw = _get(url, cfg).decode("utf-8", "replace")
|
||||
n = sum(1 for ln in raw.splitlines() if ln and not ln.lstrip().startswith("#"))
|
||||
return {"ok": True, "sample_lines": max(0, n - 1), "list": key}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,40 @@
|
||||
id: feed_threatfox
|
||||
name: ThreatFox Feed
|
||||
version: 1.0.0
|
||||
description: "abuse.ch ThreatFox feed connector — pull the recent IOC export (IPs, domains, URLs and file hashes tied to malware and botnet C2) and emit normalized IOCs (value + type, with malware/threat_type/confidence context) for import into the Threat Indicator Manager. abuse.ch now requires a free Auth-Key for downloads; stdlib-only, no extra Python dependencies."
|
||||
changelog: "1.0.0 — Initial release: fetch the ThreatFox recent JSON export."
|
||||
category: feed
|
||||
|
||||
# ThreatFox is an abuse.ch feed. As of 2024 abuse.ch requires a free Auth-Key
|
||||
# (sent as the Auth-Key header) for feed downloads.
|
||||
config_schema:
|
||||
properties:
|
||||
api_key:
|
||||
type: string
|
||||
description: "abuse.ch Auth-Key (free — from your abuse.ch account profile)"
|
||||
x-soar-sensitive: true
|
||||
insecure:
|
||||
type: boolean
|
||||
description: "Trust any TLS certificate (not secure)"
|
||||
default: false
|
||||
required: []
|
||||
|
||||
commands:
|
||||
- id: fetch_indicators
|
||||
name: feed-threatfox-fetch-indicators
|
||||
description: "Fetch the ThreatFox recent export and return normalized indicators."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
max_indicators: { type: number, description: "Max indicators to return (0 = no limit, default 0)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: feed-threatfox-test-connection
|
||||
description: "Verify the ThreatFox feed is reachable (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,91 @@
|
||||
import json, os, sys, ssl, urllib.request, urllib.error
|
||||
|
||||
URL = "https://threatfox.abuse.ch/export/json/recent/"
|
||||
|
||||
_TMAP = {
|
||||
"ip:port": "ip",
|
||||
"domain": "domain",
|
||||
"url": "url",
|
||||
"md5_hash": "hash",
|
||||
"sha1_hash": "hash",
|
||||
"sha256_hash": "hash",
|
||||
}
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR", "Accept": "application/json"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=120, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
raw = _get(URL, cfg)
|
||||
data = json.loads(raw) if raw else {}
|
||||
|
||||
maxn = int(inputs.get("max_indicators") or 0)
|
||||
out = []
|
||||
items = data.items() if isinstance(data, dict) else []
|
||||
for _id, arr in items:
|
||||
if not isinstance(arr, list):
|
||||
continue
|
||||
for e in arr:
|
||||
if not isinstance(e, dict):
|
||||
continue
|
||||
ioc = e.get("ioc")
|
||||
if not ioc:
|
||||
continue
|
||||
it = e.get("ioc_type")
|
||||
t = _TMAP.get(it, "other")
|
||||
val = ioc.split(":")[0] if it == "ip:port" else ioc
|
||||
out.append({
|
||||
"value": val,
|
||||
"type": t,
|
||||
"ioc_type": it,
|
||||
"malware": e.get("malware_printable") or e.get("malware"),
|
||||
"threat_type": e.get("threat_type"),
|
||||
"confidence": e.get("confidence_level"),
|
||||
"first_seen": e.get("first_seen_utc"),
|
||||
})
|
||||
if maxn and len(out) >= maxn:
|
||||
return {"source": "threatfox:recent", "count": len(out), "indicators": out}
|
||||
|
||||
return {"source": "threatfox:recent", "count": len(out), "indicators": out}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,55 @@
|
||||
import json, os, sys, ssl, urllib.request, urllib.error
|
||||
|
||||
URL = "https://threatfox.abuse.ch/export/json/recent/"
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR", "Accept": "application/json"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
raw = _get(URL, cfg)
|
||||
data = json.loads(raw) if raw else {}
|
||||
n = len(data) if isinstance(data, dict) else 0
|
||||
return {"ok": True, "sample_count": n}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,45 @@
|
||||
id: feed_urlhaus
|
||||
name: URLhaus Feed
|
||||
version: 1.0.0
|
||||
description: "abuse.ch URLhaus feed connector — pull the bulk list of malware-distribution URLs (recent additions or currently-online) and emit normalized IOCs (URL + type, with threat/tags/status context) for import into the Threat Indicator Manager. abuse.ch now requires a free Auth-Key for downloads; stdlib-only, no extra Python dependencies."
|
||||
changelog: "1.0.0 — Initial release: fetch the URLhaus recent/online CSV feed."
|
||||
category: feed
|
||||
|
||||
# URLhaus is an abuse.ch feed. As of 2024 abuse.ch requires a free Auth-Key
|
||||
# (sent as the Auth-Key header) for feed downloads.
|
||||
config_schema:
|
||||
properties:
|
||||
api_key:
|
||||
type: string
|
||||
description: "abuse.ch Auth-Key (free — from your abuse.ch account profile)"
|
||||
x-soar-sensitive: true
|
||||
list:
|
||||
type: string
|
||||
description: "Which feed: recent (last additions) or online (currently active). Default recent"
|
||||
default: "recent"
|
||||
insecure:
|
||||
type: boolean
|
||||
description: "Trust any TLS certificate (not secure)"
|
||||
default: false
|
||||
required: []
|
||||
|
||||
commands:
|
||||
- id: fetch_indicators
|
||||
name: feed-urlhaus-fetch-indicators
|
||||
description: "Fetch the URLhaus CSV feed and return normalized indicators."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
list: { type: string, description: "recent | online (overrides the config default)" }
|
||||
max_indicators: { type: number, description: "Max indicators to return (0 = no limit, default 0)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: feed-urlhaus-test-connection
|
||||
description: "Verify the URLhaus feed is reachable (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,80 @@
|
||||
import json, os, sys, ssl, io, csv, urllib.request, urllib.error
|
||||
|
||||
BASE = "https://urlhaus.abuse.ch/downloads/"
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=120, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
which = str(inputs.get("list") or cfg.get("list") or "recent").lower()
|
||||
fname = "csv_online" if which == "online" else "csv_recent"
|
||||
raw = _get(BASE + fname + "/", cfg).decode("utf-8", "replace")
|
||||
|
||||
maxn = int(inputs.get("max_indicators") or 0)
|
||||
out = []
|
||||
for row in csv.reader(io.StringIO(raw)):
|
||||
if not row or row[0].lstrip().startswith("#"):
|
||||
continue
|
||||
if row[0].strip().strip('"') == "id": # header row
|
||||
continue
|
||||
# columns: id,dateadded,url,url_status,last_online,threat,tags,urlhaus_link,reporter
|
||||
if len(row) < 3:
|
||||
continue
|
||||
url = row[2].strip()
|
||||
if not url:
|
||||
continue
|
||||
item = {"value": url, "type": "url"}
|
||||
if len(row) > 3:
|
||||
item["status"] = row[3].strip()
|
||||
if len(row) > 5:
|
||||
item["threat"] = row[5].strip()
|
||||
if len(row) > 6:
|
||||
item["tags"] = row[6].strip()
|
||||
out.append(item)
|
||||
if maxn and len(out) >= maxn:
|
||||
break
|
||||
|
||||
return {"source": "urlhaus:" + fname, "count": len(out), "indicators": out}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,54 @@
|
||||
import json, os, sys, ssl, urllib.request, urllib.error
|
||||
|
||||
BASE = "https://urlhaus.abuse.ch/downloads/"
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _ctx(cfg):
|
||||
if cfg.get("insecure"):
|
||||
c = ssl.create_default_context()
|
||||
c.check_hostname = False
|
||||
c.verify_mode = ssl.CERT_NONE
|
||||
return c
|
||||
return None
|
||||
|
||||
|
||||
def _headers(cfg):
|
||||
h = {"User-Agent": "Riposte-SOAR"}
|
||||
k = cfg.get("api_key")
|
||||
if k:
|
||||
h["Auth-Key"] = str(k)
|
||||
return h
|
||||
|
||||
|
||||
def _get(url, cfg):
|
||||
req = urllib.request.Request(url, headers=_headers(cfg))
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
return r.read()
|
||||
|
||||
|
||||
def _run(fn):
|
||||
try:
|
||||
print(json.dumps(fn(_cfg(), _inputs())))
|
||||
except urllib.error.HTTPError as e:
|
||||
print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")}))
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
print(json.dumps({"error": str(e)}))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
raw = _get(BASE + "csv_recent/", cfg).decode("utf-8", "replace")
|
||||
n = sum(1 for ln in raw.splitlines() if ln and not ln.lstrip().startswith("#"))
|
||||
return {"ok": True, "sample_lines": max(0, n - 1)}
|
||||
|
||||
|
||||
_run(main)
|
||||
Reference in New Issue
Block a user