Extending NeuralUI from a Storm package#

Any Storm package can add to the NeuralUI web UI: right-click actions on nodes, and how meta:note nodes of its own :type are edited and shown. It does so with a neuralui: key in its package definition, next to commands: and modules:. Synapse’s package tools (genpkg, synapse.tools.storm.pkg.gen) pass the key through as it is, and the Cortex keeps it.

NeuralUI also offers a package’s commands and its Optic actions on right-click without any neuralui: key (see Commands and Optic actions).

This is package format 1, stable for NeuralUI 1.x (see STABILITY.md). Its JSON Schema is neuralui/schema/neuralui.schema.json.

Check a package#

python -m neuralui.checkpkg path/to/acme.yaml      # a package prototype, or a built pkgdef .json

It checks the neuralui: key against the schema, builds the actions as NeuralUI would, and lists the entries it could not use and its warnings (unknown keys, actions without an id). It exits 1 if there is anything to fix. A Cortex admin sees the same errors and warnings for every loaded package under Admin › Actions.

An example#

name: acme-enrich
version: 1.0.0
neuralui:
  version: 1
  actions:
    - id: pdns
      name: Passive DNS
      group: Enrich
      forms: [inet:fqdn, inet:ipv4]
      type: storm                # runs on the Cortex with the selected nodes as its inbound nodes
      storm: acme.pdns           # nodes it yields are updated in the results
    - id: whois.newtab
      name: Whois (new tab)
      forms: [inet:fqdn]
      type: newtab               # opens "<lift of the selected nodes> | -> inet:whois:rec"
      storm: -> inet:whois:rec
    - id: has.tag
      name: Has tag...
      group: Filter
      type: filter               # appends "| +#<tag>" to the tab's query
      storm: "+#{{arg:tag}}"
      args: [{name: tag, label: Tag, type: tag}]
    - id: open.acme
      name: Acme Intel
      group: Open in             # next to VirusTotal, urlscan.io and Shodan
      type: link                 # opens a web page for the node in a new browser tab
      url:
        inet:fqdn: https://intel.acme.example/domain/{{valu}}
        file:bytes: [https://intel.acme.example/file/{{prop:sha256}}]
  notetypes:
    - type: acme.report          # a meta:note :type (the longest taxonomy prefix wins)
      title: Acme report
      render: markdown

The neuralui: key#

Key

What it is

version

The package format it was written for: 1. A package which says a newer one is told it needs a newer NeuralUI (in Admin › Actions), and its neuralui: actions and note types are not offered. Default 1.

actions

Right-click actions, below.

notetypes

Note types, below.

hide

The package’s commands not to offer on right-click: [cmd:acme.debug].

commands

false: offer none of the package’s commands on right-click. Default true.

NeuralUI ignores keys it does not know, so a package written for a later 1.x release still loads in an earlier one; Admin › Actions and checkpkg list them as warnings, where a typo shows up. The schema is stricter and rejects them.

Actions#

Every action needs a name (the menu label), and should have an id.

Key

What it is

id

Stable within the package: letters, digits, ., - and _, up to 128. An action is named <package>:<id> wherever NeuralUI keeps a choice about it (a user’s pins, an admin’s settings), so the choice survives the package reordering its list. Without one it is named by its place in the list (<package>:<index>).

name

The menu label.

type

What it does, below. Default command when command is set, else query.

forms

The forms it is offered on: names or globs (inet:*, *). Default *; a command action’s default is the command’s input forms, a link’s the forms its url names.

group

The submenu it goes in. Default Actions (a command action’s Enrich › ).

menu

Where it goes at the top of the menu: pivot, filter, enrich, edit, open or actions. Its group, if it has one, becomes the submenu inside.

storm

The Storm it runs (query, newtab, filter and storm actions).

url

A link action’s page (below).

command

The package command a command action runs.

values

A command action’s preset arguments ({days: 7}): its dialog starts with them.

args

Values to ask for before it runs (below).

descr

Help text: its tooltip, and in the action palette.

multi

false: only for a single node. Default true.

confirm

A question asked before it runs.

perms

Permission paths ([[acme, user]]): only offered to a user with one of them. A command action’s default is the command’s perms.

max

The most nodes a storm or command action runs on, up to 100000. Default 500; more are refused.

batch

Nodes per Storm run, up to 100000. Default 100. Past 50 nodes the user is asked first.

yields

inbound (the nodes it yields update the results), new (they open in a new tab, so new forms do not mix into the results) or none. A command’s default is new when its forms: output: names forms it does not take.

background

false: a storm or command action runs at once in the tab, without the run dialog (for quick edits such as the built-in Set .seen).

Types#

Type

What runs

Where the results go

query

{{lift}} | <storm>

Replaces the tab’s query and runs it

newtab

The same

A new query tab

filter

| <storm> appended to the tab’s query

The tab’s query

storm

The Storm on the Cortex, with the selected nodes as its inbound nodes and args as $vars

The run dialog (below)

command

One of the package’s commands, with a dialog for its arguments

The run dialog (below)

link

Nothing in the Cortex: opens a web page for the node in a new browser tab

The browser

A command action takes its forms, arguments, permissions and description from the command, and replaces the command’s own entry under Enrich (to give it a better name, place or preset values).

storm and command actions open a run dialog: the arguments, whether to run on the selected nodes or on all the results in the tab the action fits, and where: in the background as a job the NeuralUI service runs (the default), in a new tab, or in this tab. When only some of the selected nodes fit an action, it runs on those, and its menu item says how many: acme.enrich… (1 of 2).

Templates in Storm text#

In query, newtab and filter actions:

Template

Becomes

{{lift}}

A Storm lift of the selected nodes (put first when the text has none)

{{match}}

A filter expression matching the selected nodes

{{form}}

The form of the first selected node

{{valu}}

The quoted primary value of the first selected node

{{arg:<name>}}

An argument’s value as a Storm literal, so it can not change the query around it: a quoted string, a number, (true) / (false), a list of quoted strings, or for a tag field a checked tag name (it goes after #). Write +:name={{arg:name}}, not +:name="{{arg:name}}".

Arguments#

args is a list of fields asked for before the action runs. A storm action gets each value as the Storm variable $<name>; query, newtab and filter actions put it in their text with {{arg:<name>}}.

Key

What it is

name

The variable name.

label

The field’s label. Default its name.

type

str (default), tag, int, text (several lines), select, password, bool (a checkbox) or list (a value per line).

default

The starting value.

options

A select field’s choices: [[value, label], ...].

help

Shown under the field.

required

true: it must be filled in.

Note types#

How the UI edits and shows meta:note nodes of a :type. The longest taxonomy prefix wins, so acme.report covers acme.report.weekly too.

Key

What it is

type

The :type taxonomy.

title

Its name in the UI.

render

markdown (live rendered markdown, the default) or text (plain text). Anything else is shown as text, with a warning.

descr

A description, shown next to the editor.

Commands without a neuralui: key#

Every command which says what forms it takes (cmdinputs, or the older forms: input:) is offered on those forms under Enrich › , with a dialog built from its cmdargs:

  • a store_true / store_false flag is a checkbox, and goes on the command line bare, only when it is set,

  • choices is a list to pick from,

  • action: append, or nargs of *, + or more than 1, is a value per line,

  • type: int is a number, anything else text; positional arguments are required.

It is only offered to users with one of its perms, its first paragraph of descr is its tooltip, and the values go to the command as Storm variables. A package hides one with hide: [cmd:<name>], all of them with commands: false, or replaces one with a type: command action of its own. An admin can turn off these actions for every package (Admin › Actions › Package commands); they are on by default. Their idens are <package>:cmd:<command>.

Optic actions#

Rapid Power-Ups written for Optic need no changes: their Optic actions (optic: actions:, each a name, storm, descr and forms) show under Actions › , as in Optic, and run their Storm with the selected nodes as input, like storm actions. A neuralui: action with the same name replaces the package’s Optic action in NeuralUI. Their idens are <package>:optic:<name>.

An example package#

tests/pkgs/neuralui-demo has one of each: an Optic action, a link (crt.sh), a batched storm action and three commands (demo.echo, demo.dns, whose output is another form, and demo.admin, which needs a permission the demo analyst does not have). scripts/devstack.py --demo loads it.