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 |
|---|---|
|
The package format it was written for: |
|
Right-click actions, below. |
|
Note types, below. |
|
The package’s commands not to offer on right-click: |
|
|
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 |
|---|---|
|
Stable within the package: letters, digits, |
|
The menu label. |
|
What it does, below. Default |
|
The forms it is offered on: names or globs ( |
|
The submenu it goes in. Default Actions (a command action’s Enrich › |
|
Where it goes at the top of the menu: |
|
The Storm it runs ( |
|
A link action’s page (below). |
|
The package command a |
|
A command action’s preset arguments ( |
|
Values to ask for before it runs (below). |
|
Help text: its tooltip, and in the action palette. |
|
|
|
A question asked before it runs. |
|
Permission paths ( |
|
The most nodes a |
|
Nodes per Storm run, up to 100000. Default 100. Past 50 nodes the user is asked first. |
|
|
|
|
Types#
Type |
What runs |
Where the results go |
|---|---|---|
|
|
Replaces the tab’s query and runs it |
|
The same |
A new query tab |
|
|
The tab’s query |
|
The Storm on the Cortex, with the selected nodes as its inbound nodes and |
The run dialog (below) |
|
One of the package’s commands, with a dialog for its arguments |
The run dialog (below) |
|
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 |
|---|---|
|
A Storm lift of the selected nodes (put first when the text has none) |
|
A filter expression matching the selected nodes |
|
The form of the first selected node |
|
The quoted primary value of the first selected node |
|
An argument’s value as a Storm literal, so it can not change the query around it: a quoted string, a number, |
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 |
|---|---|
|
The variable name. |
|
The field’s label. Default its name. |
|
|
|
The starting value. |
|
A |
|
Shown under the field. |
|
|
Links#
A link action has a url instead of storm: a template, or a map of form (or glob) to a template, or
to a list of templates where the first one the node can fill wins. Each template must start with
https:// or http://.
Placeholder |
Becomes |
|---|---|
|
The node’s primary value as shown (an IPv4 as |
|
One of its properties, URL-encoded (a |
|
Its form |
|
After a placeholder: in double quotes (with |
|
After a placeholder: encoded twice (for sites which decode their path once) |
A link is offered on one node at a time, and only on a node it can fill every placeholder for. The built-in
VirusTotal, urlscan.io and Shodan entries are the neuralui package’s own link actions.
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 |
|---|---|
|
The |
|
Its name in the UI. |
|
|
|
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 › cmdargs:
a
store_true/store_falseflag is a checkbox, and goes on the command line bare, only when it is set,choicesis a list to pick from,action: append, ornargsof*,+or more than 1, is a value per line,type: intis 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 › 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.