### Example: $salt for GUID Generation Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_type_specific.html Demonstrates how '$salt' can be used to introduce extra entropy into the GUID generation algorithm, ensuring distinct nodes for otherwise colliding deconfliction keys. ```storm storm> [ ou:org=( { "name": "salty org", "$salt": "source-a" } ) ] ou:org=31dcb02de25cf801c504649249da2b51 :name = salty org ``` -------------------------------- ### Example of an InitBlock in Synapse Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.lib.html Demonstrates the usage of an init block, which executes its content only once before any nodes are yielded. This is useful for setup operations that should occur before the main processing begins, even if no nodes are ultimately produced. ```synapse init { // stuff here runs *once* before the first node yield (even if there are no nodes) } ``` -------------------------------- ### Storm parallel query example Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html An example of using the `parallel` command to execute a Storm query pipeline, including importing and looking up data. ```shell inet:ipv4#foo | parallel { $place = $lib.import(foobar).lookup(:latlong) [ :place=$place ] } ``` -------------------------------- ### Generate GUID using $lib.guid() with Variables Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_type_specific.html Demonstrates using the $lib.guid() function with variables as inputs to create a GUID for a node property. ```storm storm> $name='the vertex project' $url=https://vertex.link/ $guid=$lib.guid($name, $url) [ ou:org=$guid ] ou:org=d7f0d5bd78b358a74147995fc9b2e1b2 ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/300changes.html Starts a daemon. ```APIDOC ## $lib.dmon.start ### Description Starts a daemon. ### Parameters - **iden** (string) - The identifier of the daemon to start. ``` -------------------------------- ### Setup Custom Synchronous Resource in Test Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.tests.html Example of setting up a custom synchronous resource within a test's setup method. Remember to call the superclass's setUp method first. ```python def teardown(): super().setUp() self.my_sync_resource = Foo() ``` -------------------------------- ### Demo API Endpoint Example Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devopsguide.html This example demonstrates how to add a simple GET API endpoint named 'demo/path00' that returns a custom JSON response. ```APIDOC ## GET /api/ext/demo/path00 ### Description This endpoint returns a simple greeting message and demonstrates custom headers and a JSON body. ### Method GET ### Endpoint /api/ext/demo/path00 ### Parameters None ### Request Body None ### Request Example ```bash $ curl -D - -sku "root:root" "https://127.0.0.1:4443/api/ext/demo/path00" ``` ### Response #### Success Response (200) - **mesg** (string) - A greeting message. - **headers** (object) - Custom headers defined for the response. #### Response Example ```json { "mesg": "Hello! I am a request made to demo/path00" } ``` ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/analytical_model.html Starts a demon. ```APIDOC ## $lib.dmon.start ### Description Starts the execution of a specified demon. ### Parameters - **iden** (string): The identifier of the demon to start. ### Usage ```python $lib.dmon.start(iden) ``` ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/datamodel-ip-unification.html Starts a dmon monitor. ```APIDOC ## $lib.dmon.start ### Description Starts a specified dmon monitor. ### Method N/A (Function call) ### Endpoint N/A ### Parameters - **iden** (any) - Required - The identifier of the dmon to start. ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/stormtypes.html Starts a dmon process. ```APIDOC ## $lib.dmon.start ### Description Starts a dmon process. ### Parameters - **iden** (any) - The identifier of the dmon to start. ``` -------------------------------- ### GET Method Handler Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devopsguide.html Example Storm script for handling a GET request to an Extended HTTP API endpoint. It accesses request headers and query parameters to construct a response. ```APIDOC ## GET Method Handler ### Description Example Storm script for handling a GET request to an Extended HTTP API endpoint. It accesses request headers and query parameters to construct a response. ### Method GET ### Handler Logic ```storm $body= ({ "ua": $request.headers."UseR-AGent", // case insensitive match on the User-Agent string "hehe": $request.params.hehe, "HEHE": $request.params.HEHE, }) $request.reply(200, body=$body) ``` ``` -------------------------------- ### Storm Library - $lib.auth.easyperm.init Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/admin-tombstones.html Initializes easy permission settings. ```APIDOC ## $lib.auth.easyperm.init(edef=(null), default=(1)) ### Description Initializes easy permission settings. ### Method $lib.auth.easyperm.init ### Parameters - **edef** (dict) - Optional - The initial permission definition. Defaults to null. - **default** (integer) - Optional - The default permission level. Defaults to 1. ``` -------------------------------- ### $lib.tabular.schema Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_libs.html Gets a copy of the table configuration schema. An example shows how to print a human-readable version of the schema using YAML. ```APIDOC ## $lib.tabular.schema() ### Description Get a copy of the table configuration schema. ### Returns - The table configuration schema. The return type is dict. ### Examples Print a human-readable version of the schema: ``` $schema = $lib.tabular.schema() $lib.print($lib.yaml.save($schema)) ``` ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/admin-counts-cardinality.html Starts a data monitor. ```APIDOC ## $lib.dmon.start ### Description Starts the execution of a data monitor. ### Parameters - **iden** (string) - The identifier of the data monitor to start. ### Example ```python $lib.dmon.start('monitor_id') ``` ``` -------------------------------- ### Axon Get File Retrieval Status Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_axon_get.html Example output messages indicating the progress and successful retrieval of files during an `axon.get` operation. ```bash Fetching 229cdde419ba9549023de39c6a0ca8af74b45fade2d7a22cdc4105a75cd40ab0 to file Fetched 229cdde419ba9549023de39c6a0ca8af74b45fade2d7a22cdc4105a75cd40ab0 to file Fetching 52c672f45adacca4878461c1bdd5800af8518e675819a0bdcd5c64a72075a478 to file Fetched 52c672f45adacca4878461c1bdd5800af8518e675819a0bdcd5c64a72075a478 to file ``` -------------------------------- ### Dmon Library Functions Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_axon_dump.html Functions for managing 'dmon' entities, including adding, deleting, getting, listing, bumping, starting, stopping, and logging. ```APIDOC ## Dmon Library ### Functions - `$lib.dmon.add(text, name=noname, ddef=(null))` - `$lib.dmon.bump(iden)` - `$lib.dmon.del(iden)` - `$lib.dmon.get(iden)` - `$lib.dmon.list()` - `$lib.dmon.log(iden)` - `$lib.dmon.start(iden)` - `$lib.dmon.stop(iden)` ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/datamodel-form-renames.html Starts a dmon entry. ```APIDOC ## $lib.dmon.start ### Description Starts a dmon entry. ### Parameters #### Path Parameters None #### Query Parameters - **iden** (string) - Required - The identifier of the dmon entry to start. ### Request Example ```json { "example": "$lib.dmon.start(iden='daemon123')" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "example": "Dmon entry started successfully." } ``` ``` -------------------------------- ### Dmon Utilities Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/datamodel_deprecation.html Provides functions for managing and interacting with 'dmon' entities, including adding, deleting, getting, listing, logging, starting, and stopping them. ```APIDOC ## Dmon Utilities - `$lib.dmon.add(text, name=noname, ddef=null)`: Adds a new dmon entity. - `$lib.dmon.bump(iden)`: Increments the version or status of a dmon entity. - `$lib.dmon.del(iden)`: Deletes a dmon entity by its identifier. - `$lib.dmon.get(iden)`: Retrieves a dmon entity by its identifier. - `$lib.dmon.list()`: Lists all available dmon entities. - `$lib.dmon.log(iden)`: Retrieves logs for a specific dmon entity. - `$lib.dmon.start(iden)`: Starts a dmon entity. - `$lib.dmon.stop(iden)`: Stops a dmon entity. ``` -------------------------------- ### $lib.auth.easyperm.init Source: https://docs.vertex.link/docs/synapse/3.0.0b1/search.html Initializes easy permission settings. ```APIDOC ## $lib.auth.easyperm.init(edef=(null), default=(1)) ### Description Initializes easy permission settings. ### Parameters - **edef** (dict) - Optional - The default permission definition. Defaults to null. - **default** (integer) - Optional - The default permission level. Defaults to 1. ``` -------------------------------- ### $lib.auth.easyperm.init(edef=(null), default=(1)) Source: https://docs.vertex.link/docs/synapse/3.0.0b1/genindex.html Initializes easy permissions. ```APIDOC ## $lib.auth.easyperm.init(edef=(null), default=(1)) ### Description Initializes easy permissions. ### Parameters - **edef** - Optional - The default permission definition. - **default** (number) - Optional - The default permission level. ``` -------------------------------- ### Get Bytes from Axon Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.html Retrieve bytes of a file from the Axon. This example shows how to accumulate chunks of bytes from an Axon object and then process the complete buffer. ```python buf = b'' async for bytz in axon.get(sha256): buf =+ bytz await dostuff(buf) ``` -------------------------------- ### Get substring slice Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_prims.html Use `slice` to extract a portion of a string. Provide start and optional end indices. If end is omitted, it slices to the end. ```python $y=$x.slice(1,5) // "ooba" ``` ```python $y=$x.slice(3) // "bar" ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/devops-logging-iso8601.html Starts a specified daemon process. ```APIDOC ## $lib.dmon.start ### Description Starts a daemon process that was previously added or defined. ### Parameters - **iden** (string) - Required - The identifier of the daemon to start. ``` -------------------------------- ### Filter Files Compiled in 2019 using Range Operator Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_type_specific.html Achieves the same result as the wildcard example by using the `*range=` operator to specify the start and end of the year 2019. ```storm file:bytes:mime:pe:compiled*range=('2019/01/01 00:00:00.000', '2019/12/31 23:59:59.999') ``` -------------------------------- ### $lib.dmon.start(iden) Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_libs.html Starts a specified Storm Dmon. ```APIDOC ## $lib.dmon.start(iden) ### Description Start a storm dmon. ### Args - iden (str): The GUID of the dmon to start. ### Returns `(true)` unless the dmon does not exist or was already started. ``` -------------------------------- ### Get Phone Information Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.lookup.html Walk the phone info tree to find the best-match info for the given number. Example usage shows how to retrieve country code from the returned info. ```python info = getPhoneInfo(17035551212) country = info.get(‘cc’) ``` -------------------------------- ### Login Example with requests Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/httpapi.html Demonstrates logging in using requests by sending user credentials and handling the response. Requires session management for subsequent calls. ```python import requests def logInExample(ssl=False): sess = requests.session() url = 'https://localhost:4443/api/v3/login' info = {'user': 'visi', 'passwd': 'secret'} resp = sess.post(url, json=info, verify=ssl) item = resp.json() if item.get('status') != 'ok': code = item.get('code') mesg = item.get('mesg') raise Exception(f'Login error ({code}): {mesg}') # we are now clear to make additional HTTP API calls using sess ``` -------------------------------- ### Login Example with aiohttp Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/httpapi.html Demonstrates logging in using aiohttp by sending user credentials and handling the response. Requires session management for subsequent calls. ```python import aiohttp async def logInExample(ssl=False): async with aiohttp.ClientSession() as sess: info = {'user': 'visi', 'passwd': 'secret'} async with sess.post('https://localhost:4443/api/v3/login', json=info, ssl=ssl) as resp: item = await resp.json() if item.get('status') != 'ok': code = item.get('code') mesg = item.get('mesg') raise Exception(f'Login error ({code}): {mesg}') # we are now clear to make additional HTTP API calls using sess ``` -------------------------------- ### Get file:bytes node with highest $tick value Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html This example shows how to retrieve the file:bytes node with the highest value for the $tick variable, often used with time-based data. ```shell file:bytes#foo.bar +:seen ($tick, $tock) = :seen | max $tick ``` -------------------------------- ### Synapse service.promote Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_service_promote.html Displays the usage and options for the service.promote tool. This is useful for understanding the available parameters and their purpose. ```bash python -m synapse.tools.service.promote -h ``` -------------------------------- ### Get All Sub-tags with $node.globtags() Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_adv_methods.html Retrieves all sub-tags for any tags starting with a specified prefix, using a double wildcard to match across any number of tag elements. The double wildcard is not constrained by dot boundaries. ```storm storm> inet:fqdn=aunewsonline.com $lib.print($node.globtags(foo.**)) | spin ['bar', 'bar.baz', 'derp'] ``` -------------------------------- ### Initialize EasyPerm with Storm Library Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/datamodel-ip-unification.html Use $lib.auth.easyperm.init to initialize easy permissions. An optional definition and default level can be provided. ```python $lib.auth.easyperm.init(edef=(null), default=(1)) ``` -------------------------------- ### Get WHOIS record for most recently created FQDN Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html Retrieves the WHOIS record associated with the FQDN that has the most recent ':created' timestamp within a specific threat cluster. This example links FQDNs to WHOIS records and filters by creation time. ```shell storm> inet:fqdn#cno.threat.sparkling_unicorn -> inet:whois:record | max :created inet:whois:record=5200d9b0914e2bfe8bac590aa3f517fc :created = 2026-03-26T13:00:00Z :fqdn = derp.net ``` -------------------------------- ### Get all available commands, libraries, and types Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html Execute the 'help' command without arguments to list all available commands, libraries, and types with brief descriptions. ```shell help ``` -------------------------------- ### $lib.dmon.start Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/devops-python-version.html Starts a daemon by its identifier. ```APIDOC ## $lib.dmon.start ### Description Starts a daemon by its identifier. ### Parameters #### Query Parameters - **iden** (string) - Required - The identifier of the daemon to start. ``` -------------------------------- ### Get Path Links for Single Path Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_adv_methods.html The $path.links() method returns a list of (node id, link info) tuples for each link in a node's path. This example shows a path with two pivots to a single end node. ```storm storm> inet:fqdn=aunewsonline.com -> inet:dns:a +:ip=67.215.66.149 -> inet:ip $lib.print($path.links()) [(4, {'type': 'prop', 'prop': 'fqdn', 'reverse': True}), (48, {'type': 'prop', 'prop': 'ip'})] inet:ip=67.215.66.149 :type = unicast :version = 4 ``` -------------------------------- ### Streaming JSON Lines Response for Extended HTTP API Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.lib.stormlib.html Stream multiple chunks of data as JSON lines for an extended HTTP API's GET method. This example demonstrates sending the code, headers, and body separately. ```storm $api.methods.get = ${ $request.sendcode(200) $request.sendheaders(("Content-Type": "text/plain; charset=utf8") $values = ((1), (2), (3)) for $i in $values { $body=`{$lib.json.save(("value": $i))}\n` $request.sendbody($body.encode()) } } ``` -------------------------------- ### Show service.livebackup Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_service_livebackup.html Display the help message for the service.livebackup tool to understand its usage and available options. ```bash python -m synapse.tools.service.livebackup -h ``` -------------------------------- ### $lib.backup.run Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_libs.html Run a Cortex backup. ```APIDOC ## $lib.backup.run(name=(null), wait=(true)) ### Description Run a Cortex backup. ### Args name (str): The name of the backup to generate. wait (boolean): If true, wait for the backup to complete before returning. ### Returns The name of the newly created backup. The return type is str. ``` -------------------------------- ### Get Path Links for Multiple Paths Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_adv_methods.html Use $path.links() to retrieve link information when a node's path diverges into multiple end nodes. This example demonstrates a FQDN with three DNS A records, resulting in three distinct paths. ```storm storm> inet:fqdn=aunewsonline.com -> inet:dns:a -> inet:ip $lib.print($path.links()) [(4, {'type': 'prop', 'prop': 'fqdn', 'reverse': True}), (48, {'type': 'prop', 'prop': 'ip'})] inet:ip=67.215.66.149 :type = unicast :version = 4 [(4, {'type': 'prop', 'prop': 'fqdn', 'reverse': True}), (50, {'type': 'prop', 'prop': 'ip'})] inet:ip=184.168.221.92 :type = unicast :version = 4 [(4, {'type': 'prop', 'prop': 'fqdn', 'reverse': True}), (52, {'type': 'prop', 'prop': 'ip'})] inet:ip=104.239.213.7 :type = unicast :version = 4 ``` -------------------------------- ### Get multiple items from a Queue Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_prims.html Retrieves multiple items from a Storm Queue as an iterator, starting from a specified offset. Supports waiting for items and limiting the number of items yielded. Yields tuples of the offset and item. The return type is list. ```python $queue.gets(offs=0, wait=true, size=null) ``` -------------------------------- ### Storm Command Help Output Example Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devguides/power-ups.html Displays the automatic help message for a simple Storm command, showing its description and usage. ```shell storm> acme.hello.sayhi --help Print the hello message. Usage: acme.hello.sayhi [options] Options: --help : Display the command usage. complete. 0 nodes in 4 ms (0/sec). storm> ``` -------------------------------- ### Execute Storm Query and Get Single Return Value (requests) Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/httpapi.html This example demonstrates how to execute a Storm query expecting a single return value using the `requests` library. The Storm query must utilize the `return()` syntax. Ensure the session is configured with the necessary API key. ```python import pprint # Assumes sess was created with the X-API-KEY header (see API Key Support) query = '$valu = "world" $foo = `hello {$valu}` return ($foo)' data = {'query': query} url = 'https://localhost:4443/api/v3/storm/call' resp = sess.get(url, json=data) info = resp.json() pprint.pprint(info) ``` -------------------------------- ### Use flat gen.* commands or GUID-constructor instead of $lib.gen public helpers Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/300breakingchanges.html Public helpers in $lib.gen are removed, and gen.* commands are flattened/renamed. Use the ten flat 'gen.*' commands or a GUID-constructor. ```storm gen.vuln ``` ```storm gen.org ``` -------------------------------- ### Create a GUID Node (Arbitrary) Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_data_mod.html Generate a GUID node using an asterisk to create an arbitrary GUID. This is useful when a specific GUID is not required. ```bash [ risk:threat=* ] ``` -------------------------------- ### Storm Init Message Example Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devguides/storm_api.html Illustrates the structure of an 'init' message from the Storm query runtime, including task ID, query text, hash, and timestamps. ```python ('init', {'task': '8c90c67e37a30101a2f6a7dfb2fa0805', 'text': '.created | limit 3', 'hash': '2d16e12e80be53e0e79e7c7af9bda12b', 'tick': 1539221678859}) ``` -------------------------------- ### Synapse Preboot Script for Certbot HTTPS Certificates Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devopsguide.html This bash script is designed to be placed at `/vertex/boothooks/preboot.sh` and executed before Synapse services start. It uses Certbot to obtain or renew HTTPS certificates, requiring `CERTBOT_HOSTNAME` and `CERTBOT_EMAIL` environment variables. It installs Certbot in a Python virtual environment and copies the generated certificates to locations Synapse expects. ```bash #!/bin/bash # Certbot preboot example # Author: william.gibb@vertex.link # This script is an example of using Let's Encrypt certbot tool to generate # an HTTPS certificate for a Synapse service. # # This creates and stores a Python venv in the # /vertex/storage/preboot/letsencrypt/venv directory, so the certbot # tool is installed once in a separate python environment, and cached in # a mapped volume. # # Once the venv is setup, certbot is used to create and potentially renew # an HTTPS certificate. This certificate and private key are then copied to # the locations in /vertex/storage where Synapse services assume they will # find the HTTPS keys. # # certbot does use a random backoff timer when performing a renewal. There may # be a random delay when starting a service when the certificate needs to be # renewed. # # Required Environment variables: # # CERTBOT_HOSTNAME - the hostname that certbot will generate a certificate for. # CERTBOT_EMAIL - the email address used with certbot. # # Optional Environment variables: # # CERTBOT_ARGS - additional args passed to the "certbot certonly" and # "certbot renew" commands # # set -x # echo commands set -e # exit on nonzero BASEDIR=/vertex/preboot DSTKEY=/vertex/storage/sslkey.pem DSTCRT=/vertex/storage/sslcert.pem if [ -z ${CERTBOT_HOSTNAME} ]; then echo "CERTBOT_HOSTNAME env var is unset" exit 1 fi if [ -z ${CERTBOT_EMAIL} ]; then echo "CERTBOT_EMAIL env var is unset" exit 1 fi LEDIR=$BASEDIR/letsencrypt CONFDIR=$LEDIR/conf LOGSDIR=$LEDIR/logs WORKDIR=$LEDIR/work VENV=$LEDIR/venv mkdir -p $LOGSDIR mkdir -p $CONFDIR mkdir -p $WORKDIR CERTBOT_DIR_ARGS=" --work-dir ${WORKDIR} --logs-dir=${LOGSDIR} --config-dir=${CONFDIR} " KEYFILE="${CONFDIR}/live/${CERTBOT_HOSTNAME}/privkey.pem" CERTFILE="${CONFDIR}/live/${CERTBOT_HOSTNAME}/fullchain.pem" # Create a python venv, activate it, and install certbot and supporting tools. if [ ! -d $VENV ]; then echo "Creating venv and installing certbot" python3 -m venv --without-pip --copies $VENV . $VENV/bin/activate python3 -c "import urllib.request as ur; ur.urlretrieve('https://bootstrap.pypa.io/get-pip.py', '/tmp/get-pip.py')" python3 /tmp/get-pip.py # installs pip, wheel, setuptools python3 -m pip install --no-cache-dir "certbot==2.6.0" else echo "Activating venv" . $VENV/bin/activate fi if [ ! -f ${KEYFILE} ]; then certbot -n ${CERTBOT_DIR_ARGS} certonly --agree-tos --email ${CERTBOT_EMAIL} --standalone -d ${CERTBOT_HOSTNAME} ${CERTBOT_ARGS:-} if [ $? -ne 0 ]; then echo "Error running certbot" exit 1 fi fi certbot -n ${CERTBOT_DIR_ARGS} renew --standalone ${CERTBOT_ARGS:-} if [ $? -ne 0 ]; then echo "Error checking certificate renewal" exit 1 fi echo "Copying certificates" cp ${KEYFILE} ${DSTKEY} cp ${CERTFILE} ${DSTCRT} echo "Done setting up HTTPS certificates" ``` -------------------------------- ### Run a Cortex backup Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_libs.html Use $lib.backup.run to initiate a backup. Optionally, provide a name for the backup and specify whether to wait for its completion. ```python $lib.backup.run(name="my_backup_name", wait=true) ``` -------------------------------- ### Generate a GUID Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/stormtypes_libs.html Generate a random GUID using $lib.guid() or create a GUID from specific arguments by passing them as positional arguments or a single value. ```storm $lib.guid() ``` -------------------------------- ### Generate GUID with Storm Library Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/datamodel-ip-unification.html Use $lib.guid to generate a globally unique identifier (GUID). It can optionally take a value to be associated with the GUID. ```python $lib.guid(*args, valu=$lib.undef) ``` -------------------------------- ### Show storm.pkg.gen Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_storm_pkg_gen.html Use this command to display the usage and available options for the storm.pkg.gen tool. It outlines all possible arguments and their functions. ```bash python -m synapse.tools.storm.pkg.gen -h ``` -------------------------------- ### Create a GUID Node (Predictable) Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_data_mod.html Create a predictable GUID node by providing a list of string values. The order of values can affect the resulting GUID. ```bash [ risk:threat=( apt1, mandiant ) ] ``` -------------------------------- ### Display Synapse Version Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html Use the `--help` option with the `version` command to display its usage and available options. ```bash storm> version --help ``` -------------------------------- ### Display wget Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html Use `--help` to display the command usage and available options for `wget`. ```shell storm> wget --help ``` -------------------------------- ### Parsing GUIDs with Secondary Properties Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_type_specific.html Demonstrates how to reference a GUID node using a human-friendly secondary property like 'name'. This is useful when direct GUID specification is impractical. ```storm storm> ou:org:name=vertex ou:org=7918de6a997e984dbf966f8002df95ad :name = vertex :names = ('The Vertex Project', 'The Vertex Project, LLC') :websites = ('https://vertex.link/',) ``` -------------------------------- ### Migrate from $lib.user to $lib.auth.users.get() Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/300_changes/storm-lib-removed.html Replace usages of the removed $lib.user library with calls to $lib.auth.users.get(). Capturing the user object once is recommended for cleaner code. ```storm // 2.x $name = $lib.user.name if $lib.user.allowed(power-ups.foo.user) { } $v = $lib.user.vars.mykey // 3.x $user = $lib.auth.users.get() $name = $user.name if $user.allowed(power-ups.foo.user) { } $v = $user.vars.mykey ``` -------------------------------- ### Get System Information Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.lib.html Get information about the system in which the cell is running. ```python getSystemInfo() ``` -------------------------------- ### Display Help for layer.push.list Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_cmd.html Shows the usage and options for listing push configurations for a layer. ```shell storm> layer.push.list --help ``` -------------------------------- ### Implement GET and PUT Methods for Extended HTTP API Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/devopsguide.html Assign Storm code blocks to handle GET and PUT HTTP methods for a specific Extended HTTP API. The GET method replies with a custom 'X-Method: GET' header, and the PUT method replies with 'X-Method: PUT'. ```shell $api = $lib.cortex.httpapi.get(586311d3a7a26d6138bdc07169e4cde5) $api.methods.get = ${ $request.reply(200, headers=({"X-Method": "GET"})) $api.methods.put = ${ $request.reply(200, headers=({"X-Method": "PUT"})) ``` -------------------------------- ### Tag Condition Example Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/autodocs/synapse.lib.html A simple example of a tag condition used for filtering or matching. ```synapse #foo.bar ``` -------------------------------- ### Display Synapse service.snapshot Help Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/syn_tools_service_snapshot.html Use this command to display the help message and available options for the service.snapshot tool. ```bash python -m synapse.tools.service.snapshot -h ``` -------------------------------- ### Create Node with Arbitrary GUID and Properties Source: https://docs.vertex.link/docs/synapse/3.0.0b1/synapse/userguides/storm_ref_type_specific.html Specify an asterisk (*) for an arbitrary GUID and set secondary properties simultaneously. Note that running this query multiple times will create new nodes with new arbitrary GUIDs. ```storm [ ou:org=* :name='the vertex project' ] ```