Compare commits

...

4 Commits

Author SHA1 Message Date
Guillaume BOURGEOIS 203273715c feat(censys): new Censys enrichment integration
3 commands: host lookup by IP and Censys Search Language host query.
API ID + secret (Basic) auth, stdlib-only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 22:39:29 +02:00
Guillaume BOURGEOIS 1294e3b330 feat(maltiverse): new Maltiverse enrichment integration
5 commands: IP/domain/URL/file threat-intel reputation. Bearer-token
auth, stdlib-only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 22:39:29 +02:00
Guillaume BOURGEOIS 79d870a4e8 feat(emailrep): new EmailRep.io enrichment integration
3 commands: email reputation lookup, report malicious address. API-key
auth, stdlib-only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 22:39:29 +02:00
Guillaume BOURGEOIS ac6a52cecd feat(pulsedive): new Pulsedive enrichment integration
4 commands: indicator lookup, scan submission, scan-result retrieval.
API-key auth, stdlib-only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 22:39:28 +02:00
19 changed files with 841 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
id: censys
name: Censys
version: 1.0.0
description: "Censys Search (API v2) — host (IP) details from internet-wide scanning: open services/ports, software, certificates and location, plus a Censys Search Language host query. API ID + secret (Basic) authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: host lookup by IP and host search."
category: enrichment
config_schema:
properties:
api_id:
type: string
description: "Censys API ID"
api_secret:
type: string
description: "Censys API secret"
x-soar-sensitive: true
required:
- api_id
- api_secret
commands:
- id: host
name: censys-host
description: "Get the current view of a host by IP (services, ports, software, certificates, location)."
risk: read
inputs_schema:
properties:
ip: { type: string, description: "IP address" }
required: [ip]
outputs_schema: { properties: {} }
- id: host_search
name: censys-host-search
description: "Search hosts with a Censys Search Language query (e.g. services.service_name: HTTP and location.country: France)."
risk: read
inputs_schema:
properties:
query: { type: string, description: "Censys Search Language query" }
per_page: { type: number, description: "Results per page (default 50, max 100)" }
cursor: { type: string, description: "Pagination cursor for the next page" }
required: [query]
outputs_schema: { properties: {} }
- id: test_connection
name: censys-test-connection
description: "Verify the API credentials (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
+43
View File
@@ -0,0 +1,43 @@
import base64, json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://search.censys.io/api/v2"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None):
url = API + path
q = {k: str(x) for k, x in (params or {}).items() if x not in (None, "")}
if q:
url += ("&" if "?" in url else "?") + urllib.parse.urlencode(q)
cfg = _cfg()
cred = (str(cfg.get("api_id") or "") + ":" + str(cfg.get("api_secret") or "")).encode("utf-8")
headers = {"Accept": "application/json", "Authorization": "Basic " + base64.b64encode(cred).decode("ascii")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
ip = inputs.get("ip")
if not ip:
raise Exception("ip is required")
result = request("GET", "/hosts/" + q(ip))
print(json.dumps(result))
try:
main()
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)
@@ -0,0 +1,45 @@
import base64, json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://search.censys.io/api/v2"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None):
url = API + path
q = {k: str(x) for k, x in (params or {}).items() if x not in (None, "")}
if q:
url += ("&" if "?" in url else "?") + urllib.parse.urlencode(q)
cfg = _cfg()
cred = (str(cfg.get("api_id") or "") + ":" + str(cfg.get("api_secret") or "")).encode("utf-8")
headers = {"Accept": "application/json", "Authorization": "Basic " + base64.b64encode(cred).decode("ascii")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
query = inputs.get("query")
if not query:
raise Exception("query is required")
per_page = inputs.get("per_page")
cursor = inputs.get("cursor")
result = request("GET", "/hosts/search", {"q": query, "per_page": per_page or 50, "cursor": cursor or None})
print(json.dumps(result))
try:
main()
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)
@@ -0,0 +1,41 @@
import base64, json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://search.censys.io/api/v2"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None):
url = API + path
q = {k: str(x) for k, x in (params or {}).items() if x not in (None, "")}
if q:
url += ("&" if "?" in url else "?") + urllib.parse.urlencode(q)
cfg = _cfg()
cred = (str(cfg.get("api_id") or "") + ":" + str(cfg.get("api_secret") or "")).encode("utf-8")
headers = {"Accept": "application/json", "Authorization": "Basic " + base64.b64encode(cred).decode("ascii")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
result = request("GET", "/hosts/8.8.8.8")
if not isinstance(result, dict) or "result" not in result:
raise Exception("unexpected response")
print(json.dumps({"ok": True}))
try:
main()
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)
+47
View File
@@ -0,0 +1,47 @@
id: emailrep
name: EmailRep
version: 1.0.0
description: "EmailRep.io (API) — reputation and risk profile of an email address (deliverability, first/last seen, malicious activity, breaches, profiles), plus reporting an address as malicious. API-key authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: email reputation lookup and malicious-address reporting."
category: enrichment
config_schema:
properties:
api_key:
type: string
description: "EmailRep.io API key"
x-soar-sensitive: true
required:
- api_key
commands:
- id: get_reputation
name: emailrep-get-reputation
description: "Get the reputation and risk profile of an email address."
risk: read
inputs_schema:
properties:
email: { type: string, description: "Email address" }
required: [email]
outputs_schema: { properties: {} }
- id: report
name: emailrep-report
description: "Report an email address as malicious to EmailRep.io."
inputs_schema:
properties:
email: { type: string, description: "Email address to report" }
tags: { type: string, description: "Comma-separated tags, e.g. bec,phishing (see EmailRep docs for the allowed set)" }
description: { type: string, description: "Free-text description of the malicious activity" }
timestamp: { type: number, description: "Unix time the activity occurred (default now)" }
expires: { type: number, description: "Days after which the report expires" }
required: [email, tags]
outputs_schema: { properties: {} }
- id: test_connection
name: emailrep-test-connection
description: "Verify the API key (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
@@ -0,0 +1,42 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://emailrep.io"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, body=None):
url = API + path
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json", "Key": str(_cfg().get("api_key") or ""),
"User-Agent": "Riposte"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
email = inputs.get("email")
if not email:
raise Exception("email is required")
res = request("GET", "/" + q(email))
print(json.dumps(res))
try:
main()
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)
+55
View File
@@ -0,0 +1,55 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://emailrep.io"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, body=None):
url = API + path
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json", "Key": str(_cfg().get("api_key") or ""),
"User-Agent": "Riposte"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
email = inputs.get("email")
if not email:
raise Exception("email is required")
tags = inputs.get("tags")
if not tags:
raise Exception("tags is required")
body = {"email": email, "tags": [t.strip() for t in tags.split(",") if t.strip()]}
description = inputs.get("description")
if description:
body["description"] = description
timestamp = inputs.get("timestamp")
if timestamp:
body["timestamp"] = int(timestamp)
expires = inputs.get("expires")
if expires:
body["expires"] = int(expires)
res = request("POST", "/report", body=body)
print(json.dumps(res))
try:
main()
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)
@@ -0,0 +1,40 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://emailrep.io"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, body=None):
url = API + path
data = json.dumps(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json", "Key": str(_cfg().get("api_key") or ""),
"User-Agent": "Riposte"}
if data is not None:
headers["Content-Type"] = "application/json"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
res = request("GET", "/test@example.com")
if not isinstance(res, dict) or "email" not in res:
raise Exception("unexpected response")
print(json.dumps({"ok": True}))
try:
main()
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)
+62
View File
@@ -0,0 +1,62 @@
id: maltiverse
name: Maltiverse
version: 1.0.0
description: "Maltiverse (API) — threat-intelligence reputation for IPs, hostnames/domains, URLs and file samples (classification, blacklist sources, tags, first/last seen). Bearer-token authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: IP, hostname/domain, URL and file-sample reputation."
category: enrichment
config_schema:
properties:
api_key:
type: string
description: "Maltiverse API key (Bearer token, from your Maltiverse account)"
x-soar-sensitive: true
required:
- api_key
commands:
- id: ip_reputation
name: maltiverse-ip
description: "Threat-intelligence reputation for an IP address."
risk: read
inputs_schema:
properties:
ip: { type: string, description: "IP address" }
required: [ip]
outputs_schema: { properties: {} }
- id: domain_reputation
name: maltiverse-domain
description: "Threat-intelligence reputation for a hostname/domain."
risk: read
inputs_schema:
properties:
domain: { type: string, description: "Hostname or domain" }
required: [domain]
outputs_schema: { properties: {} }
- id: url_reputation
name: maltiverse-url
description: "Threat-intelligence reputation for a URL."
risk: read
inputs_schema:
properties:
url: { type: string, description: "URL" }
required: [url]
outputs_schema: { properties: {} }
- id: file_reputation
name: maltiverse-file
description: "Threat-intelligence reputation for a file sample by hash (MD5, SHA1 or SHA256)."
risk: read
inputs_schema:
properties:
file: { type: string, description: "File hash" }
required: [file]
outputs_schema: { properties: {} }
- id: test_connection
name: maltiverse-test-connection
description: "Verify the API key (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
@@ -0,0 +1,38 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://api.maltiverse.com"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path):
url = API + path
headers = {"Accept": "application/json", "Authorization": "Bearer " + str(_cfg().get("api_key") or "")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
domain = inputs.get("domain")
if not domain:
raise Exception("domain is required")
result = request("GET", "/hostname/" + q(domain))
print(json.dumps(result))
try:
main()
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)
@@ -0,0 +1,38 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://api.maltiverse.com"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path):
url = API + path
headers = {"Accept": "application/json", "Authorization": "Bearer " + str(_cfg().get("api_key") or "")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
file_hash = inputs.get("file")
if not file_hash:
raise Exception("file is required")
result = request("GET", "/sample/" + q(file_hash))
print(json.dumps(result))
try:
main()
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)
@@ -0,0 +1,38 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://api.maltiverse.com"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path):
url = API + path
headers = {"Accept": "application/json", "Authorization": "Bearer " + str(_cfg().get("api_key") or "")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
ip = inputs.get("ip")
if not ip:
raise Exception("ip is required")
result = request("GET", "/ip/" + q(ip))
print(json.dumps(result))
try:
main()
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)
@@ -0,0 +1,36 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://api.maltiverse.com"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path):
url = API + path
headers = {"Accept": "application/json", "Authorization": "Bearer " + str(_cfg().get("api_key") or "")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
result = request("GET", "/ip/8.8.8.8")
if not isinstance(result, dict):
raise Exception("unexpected response")
print(json.dumps({"ok": True}))
try:
main()
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)
@@ -0,0 +1,40 @@
import hashlib
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://api.maltiverse.com"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path):
url = API + path
headers = {"Accept": "application/json", "Authorization": "Bearer " + str(_cfg().get("api_key") or "")}
req = urllib.request.Request(url, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
url = inputs.get("url")
if not url:
raise Exception("url is required")
checksum = hashlib.sha256(url.encode("utf-8")).hexdigest()
result = request("GET", "/url/" + checksum)
print(json.dumps(result))
try:
main()
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)
+53
View File
@@ -0,0 +1,53 @@
id: pulsedive
name: Pulsedive
version: 1.0.0
description: "Pulsedive (API) — reputation and threat context for any indicator (IP, domain, URL or hash), plus on-demand scanning and scan-result retrieval. API-key authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: indicator lookup, scan submission and scan-result retrieval."
category: enrichment
config_schema:
properties:
api_key:
type: string
description: "Pulsedive API key"
x-soar-sensitive: true
required:
- api_key
commands:
- id: lookup_indicator
name: pulsedive-lookup-indicator
description: "Look up the reputation and threat context of an indicator (IP, domain, URL or hash)."
risk: read
inputs_schema:
properties:
indicator: { type: string, description: "Indicator value (IP, domain, URL or hash)" }
required: [indicator]
outputs_schema: { properties: {} }
- id: scan
name: pulsedive-scan
description: "Submit an indicator for an on-demand scan. Returns a qid; retrieve the report with pulsedive-scan-result once it finishes."
inputs_schema:
properties:
value: { type: string, description: "Indicator to scan (IP, domain or URL)" }
probe: { type: boolean, description: "Actively probe the indicator (default true)" }
required: [value]
outputs_schema: { properties: {} }
- id: scan_result
name: pulsedive-scan-result
description: "Retrieve the result of a scan by its qid."
risk: read
inputs_schema:
properties:
qid: { type: string, description: "Scan qid (from pulsedive-scan)" }
required: [qid]
outputs_schema: { properties: {} }
- id: test_connection
name: pulsedive-test-connection
description: "Verify the API key (used by the Test button)."
risk: read
inputs_schema:
properties: {}
required: []
outputs_schema: { properties: {} }
@@ -0,0 +1,43 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://pulsedive.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None, body=None):
p = dict(params or {})
p["key"] = str(_cfg().get("api_key") or "")
url = API + path + "?" + urllib.parse.urlencode({k: str(v) for k, v in p.items() if v not in (None, "")})
data = urllib.parse.urlencode(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/x-www-form-urlencoded"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
indicator = inputs.get("indicator")
if not indicator:
raise Exception("indicator is required")
res = request("GET", "/info.php", params={"indicator": indicator, "pretty": "1"})
print(json.dumps(res))
try:
main()
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)
+44
View File
@@ -0,0 +1,44 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://pulsedive.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None, body=None):
p = dict(params or {})
p["key"] = str(_cfg().get("api_key") or "")
url = API + path + "?" + urllib.parse.urlencode({k: str(v) for k, v in p.items() if v not in (None, "")})
data = urllib.parse.urlencode(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/x-www-form-urlencoded"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
value = inputs.get("value")
if not value:
raise Exception("value is required")
probe = inputs.get("probe", True)
res = request("POST", "/analyze.php", body={"value": value, "probe": "1" if probe else "0"})
print(json.dumps(res))
try:
main()
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)
@@ -0,0 +1,43 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://pulsedive.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None, body=None):
p = dict(params or {})
p["key"] = str(_cfg().get("api_key") or "")
url = API + path + "?" + urllib.parse.urlencode({k: str(v) for k, v in p.items() if v not in (None, "")})
data = urllib.parse.urlencode(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/x-www-form-urlencoded"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
inputs = json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
qid = inputs.get("qid")
if not qid:
raise Exception("qid is required")
res = request("GET", "/analyze.php", params={"qid": qid, "pretty": "1"})
print(json.dumps(res))
try:
main()
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)
@@ -0,0 +1,43 @@
import json, os, sys, urllib.parse, urllib.request, urllib.error
API = "https://pulsedive.com/api"
def _cfg():
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
def request(method, path, params=None, body=None):
p = dict(params or {})
p["key"] = str(_cfg().get("api_key") or "")
url = API + path + "?" + urllib.parse.urlencode({k: str(v) for k, v in p.items() if v not in (None, "")})
data = urllib.parse.urlencode(body).encode("utf-8") if body is not None else None
headers = {"Accept": "application/json"}
if data is not None:
headers["Content-Type"] = "application/x-www-form-urlencoded"
req = urllib.request.Request(url, data=data, headers=headers, method=method)
with urllib.request.urlopen(req, timeout=60) as r:
raw = r.read()
return json.loads(raw) if raw else {}
q = lambda v: urllib.parse.quote(str(v), safe="")
def main():
res = request("GET", "/info.php", params={"indicator": "8.8.8.8"})
if not isinstance(res, dict):
raise Exception("unexpected response")
if res.get("error"):
raise Exception(res["error"])
print(json.dumps({"ok": True}))
try:
main()
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)