Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d8bb41b4c5 | |||
| 855f1b132c | |||
| 74bf6126fb |
@@ -0,0 +1,78 @@
|
||||
id: efficientip
|
||||
name: EfficientIP SOLIDserver
|
||||
version: 1.0.0
|
||||
description: "EfficientIP SOLIDserver (REST API) — DNS/DDI containment and visibility: add an RPZ record to block a domain (DNS sinkhole), list DNS zones, search IP addresses, and list networks. HTTP Basic authentication; stdlib-only, no extra Python dependencies. (French vendor.)"
|
||||
changelog: "1.0.0 — Initial release: add RPZ record, list DNS zones, search IP, list networks."
|
||||
category: network
|
||||
|
||||
# Per-instance configuration. HTTP Basic auth against the SOLIDserver REST API.
|
||||
config_schema:
|
||||
properties:
|
||||
base_url:
|
||||
type: string
|
||||
description: "SOLIDserver URL (e.g. https://ipam.example.com)"
|
||||
username:
|
||||
type: string
|
||||
description: "API username"
|
||||
password:
|
||||
type: string
|
||||
description: "API password"
|
||||
x-soar-sensitive: true
|
||||
insecure:
|
||||
type: boolean
|
||||
description: "Trust any TLS certificate (not secure)"
|
||||
default: false
|
||||
required:
|
||||
- base_url
|
||||
- username
|
||||
- password
|
||||
|
||||
commands:
|
||||
- id: add_rpz_record
|
||||
name: efficientip-add-rpz-record
|
||||
description: "Add an RPZ resource record to block a domain (DNS sinkhole)."
|
||||
inputs_schema:
|
||||
properties:
|
||||
dns_name: { type: string, description: "DNS server name that hosts the RPZ zone" }
|
||||
rpz_zone: { type: string, description: "RPZ zone name" }
|
||||
record_name: { type: string, description: "Record name (the domain to block)" }
|
||||
rr_type: { type: string, description: "Record type (default CNAME)" }
|
||||
value: { type: string, description: "Record value (default '.' for NXDOMAIN)" }
|
||||
required: [dns_name, rpz_zone, record_name]
|
||||
outputs_schema: { properties: {} }
|
||||
- id: list_dns_zones
|
||||
name: efficientip-list-dns-zones
|
||||
description: "List DNS zones."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
limit: { type: number, description: "Max zones (default 50)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
- id: search_ip
|
||||
name: efficientip-search-ip
|
||||
description: "Search IP addresses by value."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
ip: { type: string, description: "IP address to search" }
|
||||
required: [ip]
|
||||
outputs_schema: { properties: {} }
|
||||
- id: list_networks
|
||||
name: efficientip-list-networks
|
||||
description: "List IP subnets/networks."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
limit: { type: number, description: "Max networks (default 50)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: efficientip-test-connection
|
||||
description: "Verify connectivity and credentials (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,74 @@
|
||||
import json, os, sys, base64, ssl, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
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 _auth(cfg):
|
||||
raw = str(cfg.get("username", "")) + ":" + str(cfg.get("password", ""))
|
||||
return "Basic " + base64.b64encode(raw.encode("utf-8")).decode("utf-8")
|
||||
|
||||
|
||||
def request(method, path, cfg, params=None):
|
||||
url = str(cfg.get("base_url", "")).rstrip("/") + "/rest" + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
req = urllib.request.Request(url, headers={"Authorization": _auth(cfg), "Accept": "application/json"}, method=method)
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
raw = r.read()
|
||||
try:
|
||||
return json.loads(raw) if raw else {}
|
||||
except Exception:
|
||||
return {"result": raw.decode("utf-8", "replace")}
|
||||
|
||||
|
||||
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):
|
||||
dns_name = inputs.get("dns_name")
|
||||
if not dns_name:
|
||||
raise Exception("dns_name is required")
|
||||
rpz_zone = inputs.get("rpz_zone")
|
||||
if not rpz_zone:
|
||||
raise Exception("rpz_zone is required")
|
||||
record_name = inputs.get("record_name")
|
||||
if not record_name:
|
||||
raise Exception("record_name is required")
|
||||
rr_type = inputs.get("rr_type") or "CNAME"
|
||||
value = inputs.get("value") or "."
|
||||
|
||||
return request("POST", "/dns_rr_add", cfg, params={
|
||||
"dns_name": dns_name,
|
||||
"dns_rr_name": record_name,
|
||||
"dns_rr_type": rr_type,
|
||||
"dns_rr_value1": value,
|
||||
"dns_zone_name": rpz_zone,
|
||||
})
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,59 @@
|
||||
import json, os, sys, base64, ssl, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
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 _auth(cfg):
|
||||
raw = str(cfg.get("username", "")) + ":" + str(cfg.get("password", ""))
|
||||
return "Basic " + base64.b64encode(raw.encode("utf-8")).decode("utf-8")
|
||||
|
||||
|
||||
def request(method, path, cfg, params=None):
|
||||
url = str(cfg.get("base_url", "")).rstrip("/") + "/rest" + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
req = urllib.request.Request(url, headers={"Authorization": _auth(cfg), "Accept": "application/json"}, method=method)
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
raw = r.read()
|
||||
try:
|
||||
return json.loads(raw) if raw else {}
|
||||
except Exception:
|
||||
return {"result": raw.decode("utf-8", "replace")}
|
||||
|
||||
|
||||
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):
|
||||
limit = inputs.get("limit")
|
||||
limit = int(limit) if limit not in (None, "") else 50
|
||||
|
||||
return request("GET", "/dns_zone_list", cfg, params={"limit": limit})
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,59 @@
|
||||
import json, os, sys, base64, ssl, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
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 _auth(cfg):
|
||||
raw = str(cfg.get("username", "")) + ":" + str(cfg.get("password", ""))
|
||||
return "Basic " + base64.b64encode(raw.encode("utf-8")).decode("utf-8")
|
||||
|
||||
|
||||
def request(method, path, cfg, params=None):
|
||||
url = str(cfg.get("base_url", "")).rstrip("/") + "/rest" + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
req = urllib.request.Request(url, headers={"Authorization": _auth(cfg), "Accept": "application/json"}, method=method)
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
raw = r.read()
|
||||
try:
|
||||
return json.loads(raw) if raw else {}
|
||||
except Exception:
|
||||
return {"result": raw.decode("utf-8", "replace")}
|
||||
|
||||
|
||||
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):
|
||||
limit = inputs.get("limit")
|
||||
limit = int(limit) if limit not in (None, "") else 50
|
||||
|
||||
return request("GET", "/ip_subnet_list", cfg, params={"limit": limit})
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,60 @@
|
||||
import json, os, sys, base64, ssl, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
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 _auth(cfg):
|
||||
raw = str(cfg.get("username", "")) + ":" + str(cfg.get("password", ""))
|
||||
return "Basic " + base64.b64encode(raw.encode("utf-8")).decode("utf-8")
|
||||
|
||||
|
||||
def request(method, path, cfg, params=None):
|
||||
url = str(cfg.get("base_url", "")).rstrip("/") + "/rest" + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
req = urllib.request.Request(url, headers={"Authorization": _auth(cfg), "Accept": "application/json"}, method=method)
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
raw = r.read()
|
||||
try:
|
||||
return json.loads(raw) if raw else {}
|
||||
except Exception:
|
||||
return {"result": raw.decode("utf-8", "replace")}
|
||||
|
||||
|
||||
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):
|
||||
ip = inputs.get("ip")
|
||||
if not ip:
|
||||
raise Exception("ip is required")
|
||||
|
||||
return request("GET", "/ip_address_list", cfg, params={"WHERE": "hostaddr='" + ip + "'"})
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,57 @@
|
||||
import json, os, sys, base64, ssl, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
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 _auth(cfg):
|
||||
raw = str(cfg.get("username", "")) + ":" + str(cfg.get("password", ""))
|
||||
return "Basic " + base64.b64encode(raw.encode("utf-8")).decode("utf-8")
|
||||
|
||||
|
||||
def request(method, path, cfg, params=None):
|
||||
url = str(cfg.get("base_url", "")).rstrip("/") + "/rest" + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
req = urllib.request.Request(url, headers={"Authorization": _auth(cfg), "Accept": "application/json"}, method=method)
|
||||
with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r:
|
||||
raw = r.read()
|
||||
try:
|
||||
return json.loads(raw) if raw else {}
|
||||
except Exception:
|
||||
return {"result": raw.decode("utf-8", "replace")}
|
||||
|
||||
|
||||
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):
|
||||
request("GET", "/dns_server_list", cfg, params={"limit": 1})
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,74 @@
|
||||
id: ovhcloud
|
||||
name: OVHcloud
|
||||
version: 1.0.0
|
||||
description: "OVHcloud (API v1) — cloud account and infrastructure visibility: read the account, list public cloud projects, and list/read dedicated servers. Signed application-key authentication; stdlib-only, no extra Python dependencies. (French vendor.)"
|
||||
changelog: "1.0.0 — Initial release: get account, list cloud projects, list/get dedicated servers."
|
||||
category: cloud
|
||||
|
||||
# Per-instance configuration. Requests are signed (SHA-1) with the application
|
||||
# key/secret + consumer key. endpoint selects the region (eu/ca/us).
|
||||
config_schema:
|
||||
properties:
|
||||
endpoint:
|
||||
type: string
|
||||
description: "OVH API endpoint"
|
||||
default: "https://eu.api.ovh.com/1.0"
|
||||
application_key:
|
||||
type: string
|
||||
description: "Application key"
|
||||
application_secret:
|
||||
type: string
|
||||
description: "Application secret"
|
||||
x-soar-sensitive: true
|
||||
consumer_key:
|
||||
type: string
|
||||
description: "Consumer key"
|
||||
x-soar-sensitive: true
|
||||
required:
|
||||
- application_key
|
||||
- application_secret
|
||||
- consumer_key
|
||||
|
||||
commands:
|
||||
- id: get_account
|
||||
name: ovh-get-account
|
||||
description: "Get the current account (nichandle)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
- id: list_cloud_projects
|
||||
name: ovh-list-cloud-projects
|
||||
description: "List Public Cloud project IDs."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
- id: list_dedicated_servers
|
||||
name: ovh-list-dedicated-servers
|
||||
description: "List dedicated server names."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
- id: get_dedicated_server
|
||||
name: ovh-get-dedicated-server
|
||||
description: "Get a dedicated server's details."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
server_name: { type: string, description: "Dedicated server name" }
|
||||
required: [server_name]
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: ovh-test-connection
|
||||
description: "Verify the signed credentials via /me (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,63 @@
|
||||
import json, os, sys, hashlib, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _endpoint(cfg):
|
||||
return (str(cfg.get("endpoint") or "https://eu.api.ovh.com/1.0")).rstrip("/")
|
||||
|
||||
|
||||
def _server_time(cfg):
|
||||
req = urllib.request.Request(_endpoint(cfg) + "/auth/time", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return r.read().decode("utf-8", "replace").strip()
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None):
|
||||
url = _endpoint(cfg) + path
|
||||
app_key = str(cfg.get("application_key", ""))
|
||||
app_secret = str(cfg.get("application_secret", ""))
|
||||
consumer = str(cfg.get("consumer_key", ""))
|
||||
ts = _server_time(cfg)
|
||||
body_str = json.dumps(body) if body is not None else ""
|
||||
to_sign = app_secret + "+" + consumer + "+" + method.upper() + "+" + url + "+" + body_str + "+" + ts
|
||||
signature = "$1$" + hashlib.sha1(to_sign.encode("utf-8")).hexdigest()
|
||||
headers = {
|
||||
"X-Ovh-Application": app_key,
|
||||
"X-Ovh-Consumer": consumer,
|
||||
"X-Ovh-Timestamp": ts,
|
||||
"X-Ovh-Signature": signature,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
data = None
|
||||
if body is not None:
|
||||
data = body_str.encode("utf-8")
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
return request("GET", "/me", cfg)
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,69 @@
|
||||
import json, os, sys, hashlib, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _endpoint(cfg):
|
||||
return (str(cfg.get("endpoint") or "https://eu.api.ovh.com/1.0")).rstrip("/")
|
||||
|
||||
|
||||
def _server_time(cfg):
|
||||
req = urllib.request.Request(_endpoint(cfg) + "/auth/time", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return r.read().decode("utf-8", "replace").strip()
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None):
|
||||
url = _endpoint(cfg) + path
|
||||
app_key = str(cfg.get("application_key", ""))
|
||||
app_secret = str(cfg.get("application_secret", ""))
|
||||
consumer = str(cfg.get("consumer_key", ""))
|
||||
ts = _server_time(cfg)
|
||||
body_str = json.dumps(body) if body is not None else ""
|
||||
to_sign = app_secret + "+" + consumer + "+" + method.upper() + "+" + url + "+" + body_str + "+" + ts
|
||||
signature = "$1$" + hashlib.sha1(to_sign.encode("utf-8")).hexdigest()
|
||||
headers = {
|
||||
"X-Ovh-Application": app_key,
|
||||
"X-Ovh-Consumer": consumer,
|
||||
"X-Ovh-Timestamp": ts,
|
||||
"X-Ovh-Signature": signature,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
data = None
|
||||
if body is not None:
|
||||
data = body_str.encode("utf-8")
|
||||
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 {}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
q = lambda v: urllib.parse.quote(str(v), safe="")
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
server_name = inputs.get("server_name")
|
||||
if not server_name:
|
||||
raise Exception("server_name is required")
|
||||
return request("GET", "/dedicated/server/" + q(server_name), cfg)
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,64 @@
|
||||
import json, os, sys, hashlib, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _endpoint(cfg):
|
||||
return (str(cfg.get("endpoint") or "https://eu.api.ovh.com/1.0")).rstrip("/")
|
||||
|
||||
|
||||
def _server_time(cfg):
|
||||
req = urllib.request.Request(_endpoint(cfg) + "/auth/time", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return r.read().decode("utf-8", "replace").strip()
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None):
|
||||
url = _endpoint(cfg) + path
|
||||
app_key = str(cfg.get("application_key", ""))
|
||||
app_secret = str(cfg.get("application_secret", ""))
|
||||
consumer = str(cfg.get("consumer_key", ""))
|
||||
ts = _server_time(cfg)
|
||||
body_str = json.dumps(body) if body is not None else ""
|
||||
to_sign = app_secret + "+" + consumer + "+" + method.upper() + "+" + url + "+" + body_str + "+" + ts
|
||||
signature = "$1$" + hashlib.sha1(to_sign.encode("utf-8")).hexdigest()
|
||||
headers = {
|
||||
"X-Ovh-Application": app_key,
|
||||
"X-Ovh-Consumer": consumer,
|
||||
"X-Ovh-Timestamp": ts,
|
||||
"X-Ovh-Signature": signature,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
data = None
|
||||
if body is not None:
|
||||
data = body_str.encode("utf-8")
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
resp = request("GET", "/cloud/project", cfg)
|
||||
return {"projects": resp}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,64 @@
|
||||
import json, os, sys, hashlib, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _endpoint(cfg):
|
||||
return (str(cfg.get("endpoint") or "https://eu.api.ovh.com/1.0")).rstrip("/")
|
||||
|
||||
|
||||
def _server_time(cfg):
|
||||
req = urllib.request.Request(_endpoint(cfg) + "/auth/time", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return r.read().decode("utf-8", "replace").strip()
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None):
|
||||
url = _endpoint(cfg) + path
|
||||
app_key = str(cfg.get("application_key", ""))
|
||||
app_secret = str(cfg.get("application_secret", ""))
|
||||
consumer = str(cfg.get("consumer_key", ""))
|
||||
ts = _server_time(cfg)
|
||||
body_str = json.dumps(body) if body is not None else ""
|
||||
to_sign = app_secret + "+" + consumer + "+" + method.upper() + "+" + url + "+" + body_str + "+" + ts
|
||||
signature = "$1$" + hashlib.sha1(to_sign.encode("utf-8")).hexdigest()
|
||||
headers = {
|
||||
"X-Ovh-Application": app_key,
|
||||
"X-Ovh-Consumer": consumer,
|
||||
"X-Ovh-Timestamp": ts,
|
||||
"X-Ovh-Signature": signature,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
data = None
|
||||
if body is not None:
|
||||
data = body_str.encode("utf-8")
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
resp = request("GET", "/dedicated/server", cfg)
|
||||
return {"servers": resp}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,64 @@
|
||||
import json, os, sys, hashlib, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _endpoint(cfg):
|
||||
return (str(cfg.get("endpoint") or "https://eu.api.ovh.com/1.0")).rstrip("/")
|
||||
|
||||
|
||||
def _server_time(cfg):
|
||||
req = urllib.request.Request(_endpoint(cfg) + "/auth/time", method="GET")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
return r.read().decode("utf-8", "replace").strip()
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None):
|
||||
url = _endpoint(cfg) + path
|
||||
app_key = str(cfg.get("application_key", ""))
|
||||
app_secret = str(cfg.get("application_secret", ""))
|
||||
consumer = str(cfg.get("consumer_key", ""))
|
||||
ts = _server_time(cfg)
|
||||
body_str = json.dumps(body) if body is not None else ""
|
||||
to_sign = app_secret + "+" + consumer + "+" + method.upper() + "+" + url + "+" + body_str + "+" + ts
|
||||
signature = "$1$" + hashlib.sha1(to_sign.encode("utf-8")).hexdigest()
|
||||
headers = {
|
||||
"X-Ovh-Application": app_key,
|
||||
"X-Ovh-Consumer": consumer,
|
||||
"X-Ovh-Timestamp": ts,
|
||||
"X-Ovh-Signature": signature,
|
||||
"Accept": "application/json",
|
||||
}
|
||||
data = None
|
||||
if body is not None:
|
||||
data = body_str.encode("utf-8")
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
resp = request("GET", "/me", cfg)
|
||||
return {"ok": True, "nichandle": resp.get("nichandle")}
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,61 @@
|
||||
id: vade
|
||||
name: Vade
|
||||
version: 1.0.0
|
||||
description: "Vade (email security API) — anti-phishing remediation: search messages, read a message, and remediate (remove/quarantine) a malicious message. Bearer-token authentication; stdlib-only, no extra Python dependencies. (French vendor. NOTE: exact API paths are best-effort — verify against the Vade API documentation before production use.)"
|
||||
changelog: "1.0.0 — Initial release: search messages, get message, remediate message."
|
||||
category: email
|
||||
|
||||
# Per-instance configuration. Auth header 'Authorization: Bearer <api_token>'.
|
||||
config_schema:
|
||||
properties:
|
||||
base_url:
|
||||
type: string
|
||||
description: "Vade API base URL"
|
||||
default: "https://api.vadesecure.com"
|
||||
api_token:
|
||||
type: string
|
||||
description: "Vade API token"
|
||||
x-soar-sensitive: true
|
||||
required:
|
||||
- api_token
|
||||
|
||||
commands:
|
||||
- id: search_messages
|
||||
name: vade-search-messages
|
||||
description: "Search messages by recipient, sender, or subject."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
recipient: { type: string, description: "Recipient address filter" }
|
||||
sender: { type: string, description: "Sender address filter" }
|
||||
subject: { type: string, description: "Subject filter" }
|
||||
limit: { type: number, description: "Max messages (default 25)" }
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
- id: get_message
|
||||
name: vade-get-message
|
||||
description: "Get a single message by ID."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties:
|
||||
message_id: { type: string, description: "Message ID" }
|
||||
required: [message_id]
|
||||
outputs_schema: { properties: {} }
|
||||
- id: remediate_message
|
||||
name: vade-remediate-message
|
||||
description: "Remediate (remove/quarantine) a malicious message."
|
||||
inputs_schema:
|
||||
properties:
|
||||
message_id: { type: string, description: "Message ID" }
|
||||
action: { type: string, description: "remove or quarantine (default remove)" }
|
||||
required: [message_id]
|
||||
outputs_schema: { properties: {} }
|
||||
|
||||
- id: test_connection
|
||||
name: vade-test-connection
|
||||
description: "Verify the API token (used by the Test button)."
|
||||
risk: read
|
||||
inputs_schema:
|
||||
properties: {}
|
||||
required: []
|
||||
outputs_schema: { properties: {} }
|
||||
@@ -0,0 +1,53 @@
|
||||
import json, os, sys, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _base(cfg):
|
||||
return (str(cfg.get("base_url") or "https://api.vadesecure.com")).rstrip("/")
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None, params=None):
|
||||
url = _base(cfg) + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
data = json.dumps(body).encode("utf-8") if body is not None else None
|
||||
headers = {"Authorization": "Bearer " + str(cfg.get("api_token", "")), "Accept": "application/json"}
|
||||
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 {}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
q = lambda v: urllib.parse.quote(str(v), safe="")
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
message_id = inputs.get("message_id")
|
||||
if not message_id:
|
||||
raise Exception("message_id is required")
|
||||
return request("GET", "/messages/" + q(message_id), cfg)
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,57 @@
|
||||
import json, os, sys, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _base(cfg):
|
||||
return (str(cfg.get("base_url") or "https://api.vadesecure.com")).rstrip("/")
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None, params=None):
|
||||
url = _base(cfg) + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
data = json.dumps(body).encode("utf-8") if body is not None else None
|
||||
headers = {"Authorization": "Bearer " + str(cfg.get("api_token", "")), "Accept": "application/json"}
|
||||
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 {}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
q = lambda v: urllib.parse.quote(str(v), safe="")
|
||||
|
||||
|
||||
def main(cfg, inputs):
|
||||
message_id = inputs.get("message_id")
|
||||
if not message_id:
|
||||
raise Exception("message_id is required")
|
||||
action = inputs.get("action") or "remove"
|
||||
resp = request("POST", "/messages/" + q(message_id) + "/remediate", cfg, body={"action": action})
|
||||
if not resp:
|
||||
return {"ok": True, "message_id": message_id, "action": action}
|
||||
return resp
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,54 @@
|
||||
import json, os, sys, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _base(cfg):
|
||||
return (str(cfg.get("base_url") or "https://api.vadesecure.com")).rstrip("/")
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None, params=None):
|
||||
url = _base(cfg) + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
data = json.dumps(body).encode("utf-8") if body is not None else None
|
||||
headers = {"Authorization": "Bearer " + str(cfg.get("api_token", "")), "Accept": "application/json"}
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
limit = inputs.get("limit")
|
||||
params = {
|
||||
"recipient": inputs.get("recipient"),
|
||||
"sender": inputs.get("sender"),
|
||||
"subject": inputs.get("subject"),
|
||||
"limit": int(limit) if limit not in (None, "") else 25,
|
||||
}
|
||||
return request("GET", "/messages", cfg, params=params)
|
||||
|
||||
|
||||
_run(main)
|
||||
@@ -0,0 +1,48 @@
|
||||
import json, os, sys, urllib.parse, urllib.request, urllib.error
|
||||
|
||||
|
||||
def _cfg():
|
||||
return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}"))
|
||||
|
||||
|
||||
def _inputs():
|
||||
return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}"))
|
||||
|
||||
|
||||
def _base(cfg):
|
||||
return (str(cfg.get("base_url") or "https://api.vadesecure.com")).rstrip("/")
|
||||
|
||||
|
||||
def request(method, path, cfg, body=None, params=None):
|
||||
url = _base(cfg) + path
|
||||
if params:
|
||||
clean = {k: v for k, v in params.items() if v not in (None, "")}
|
||||
if clean:
|
||||
url += "?" + urllib.parse.urlencode(clean)
|
||||
data = json.dumps(body).encode("utf-8") if body is not None else None
|
||||
headers = {"Authorization": "Bearer " + str(cfg.get("api_token", "")), "Accept": "application/json"}
|
||||
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 {}
|
||||
|
||||
|
||||
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):
|
||||
request("GET", "/messages", cfg, params={"limit": 1})
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
_run(main)
|
||||
Reference in New Issue
Block a user