synapse.lib.stormlib package
Submodules
synapse.lib.stormlib.aha module
- class synapse.lib.stormlib.aha.AhaLib(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with AHA.
synapse.lib.stormlib.auth module
- class synapse.lib.stormlib.auth.Gate(runt, valu, path=None)[source]
Bases:
Prim
Implements the Storm API for an AuthGate.
- class synapse.lib.stormlib.auth.LibAuth(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Auth in the Cortex.
- class synapse.lib.stormlib.auth.LibGates(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Auth Gates in the Cortex.
- class synapse.lib.stormlib.auth.LibRoles(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Auth Roles in the Cortex.
- class synapse.lib.stormlib.auth.LibUser(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with data about the current user.
- class synapse.lib.stormlib.auth.LibUsers(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Auth Users in the Cortex.
- class synapse.lib.stormlib.auth.Role(runt, valu, path=None)[source]
Bases:
Prim
Implements the Storm API for a Role.
- class synapse.lib.stormlib.auth.StormUserProfileDict(runt, valu, path=None)[source]
Bases:
Prim
A Storm Primitive that maps the HiveDict interface to a user profile dictionary.
- class synapse.lib.stormlib.auth.StormUserVarsDict(runt, valu, path=None)[source]
Bases:
Prim
A Storm Primitive that maps the HiveDict interface to a user vars dictionary.
- class synapse.lib.stormlib.auth.User(runt, valu, path=None)[source]
Bases:
Prim
Implements the Storm API for a User.
- class synapse.lib.stormlib.auth.UserJson(runt, valu)[source]
Bases:
Prim
Implements per-user JSON storage.
- class synapse.lib.stormlib.auth.UserProfile(runt, valu, path=None)[source]
Bases:
Prim
The Storm deref/setitem/iter convention on top of User profile information.
synapse.lib.stormlib.backup module
synapse.lib.stormlib.basex module
synapse.lib.stormlib.cache module
- class synapse.lib.stormlib.cache.FixedCache(runt, query, size=10000)[source]
Bases:
StormType
A StormLib API instance of a Storm Fixed Cache.
synapse.lib.stormlib.cell module
synapse.lib.stormlib.compression module
- class synapse.lib.stormlib.compression.Bzip2Lib(runt, name=())[source]
Bases:
Lib
A Storm library which implements helpers for bzip2 compression.
- class synapse.lib.stormlib.compression.GzipLib(runt, name=())[source]
Bases:
Lib
A Storm library which implements helpers for gzip compression.
- class synapse.lib.stormlib.compression.ZlibLib(runt, name=())[source]
Bases:
Lib
A Storm library which implements helpers for zlib compression.
synapse.lib.stormlib.cortex module
- class synapse.lib.stormlib.cortex.CortexHttpApi(runt, name=())[source]
Bases:
Lib
Library for interacting with the Extended HTTP API.
- async addHttpApi(path, name='', desc='', runas='owner', authenticated=True, readonly=False, iden=None)[source]
- class synapse.lib.stormlib.cortex.HttpApi(runt, info)[source]
Bases:
StormType
Extended HTTP API object.
This object represents an extended HTTP API that has been configured on the Cortex.
- class synapse.lib.stormlib.cortex.HttpApiMethods(httpapi: HttpApi)[source]
Bases:
Prim
Accessor dictionary for getting and setting Extended HTTP API methods.
- Notes:
The Storm code used to run these methods will have a $request object injected into them. This allows the method to send data back to the caller when it is run.
- Examples:
Setting a simple GET method:
$api.methods.get = ${ $data = ({"someKey": "someValue}) $headers = ({"someHeader": "someOtherValue"}) $request.reply(200, headers=$headers, body=$data) }
Removing a PUT method:
$api.methods.put = $lib.undef
Crafting a custom text response:
$api.methods.get = ${ // Create the body $data = 'some value' // Encode the response as bytes $data = $data.encode() // Set the headers $headers = ({"Content-Type": "text/plain", "Content-Length": $lib.len($data}) $request.reply(200, headers=$headers, body=$data) }
Streaming multiple chunks of data as JSON lines. This sends the code, headers and body separately:
$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}))}
- `
$request.sendbody($body.encode())
}
}
- class synapse.lib.stormlib.cortex.HttpApiVars(httpapi, path=None)[source]
Bases:
Dict
Accessor dictionary for getting and setting Extended HTTP API variables.
This can be used to set, unset or iterate over the runtime variables that are set for an Extended HTTP API endpoint. These variables are set in the Storm runtime for all of the HTTP methods configured to be executed by the endpoint.
Example
Set a few variables on a given API:
$api.vars.foo = 'the foo string' $api.vars.bar = (1234)
Remove a variable:
$api.vars.foo = $lib.undef
Iterate over the variables set for the endpoint:
for ($key, $valu) in $api.vars { $lib.print(`{$key) -> {$valu}`) }
Overwrite all of the variables for a given API with a new dictionary:
$api.vars = ({"foo": "a new string", "bar": (137)})
- class synapse.lib.stormlib.cortex.HttpHeaderDict(valu, path=None)[source]
Bases:
Dict
Immutable lowercase key access dictionary for HTTP request headers.
Example
Request headers can be accessed in a case insensitive manner:
$valu = $request.headers.Cookie // or the lower case value $valu = $request.headers.cookie
- class synapse.lib.stormlib.cortex.HttpPermsList(httpapi, path=None)[source]
Bases:
List
Accessor list for getting and setting http:api permissions.
- class synapse.lib.stormlib.cortex.HttpReq(runt, rnfo)[source]
Bases:
StormType
Extended HTTP API Request object.
- class synapse.lib.stormlib.cortex.StormPoolDelCmd(runt, runtsafe)[source]
Bases:
Cmd
Remove a Storm query offload mirror pool configuration.
Notes
This will result in tearing down any Storm queries currently being serviced by the Storm pool. This may result in this command raising an exception if it was offloaded to a pool member. That would be an expected behavior.
- name = 'cortex.storm.pool.del'
synapse.lib.stormlib.easyperm module
synapse.lib.stormlib.env module
synapse.lib.stormlib.ethereum module
synapse.lib.stormlib.gen module
synapse.lib.stormlib.gis module
synapse.lib.stormlib.graph module
synapse.lib.stormlib.hashes module
synapse.lib.stormlib.hex module
- class synapse.lib.stormlib.hex.HexLib(runt, name=())[source]
Bases:
Lib
A Storm library which implements helpers for hexadecimal encoded strings.
synapse.lib.stormlib.imap module
- class synapse.lib.stormlib.imap.ImapLib(runt, name=())[source]
Bases:
Lib
A Storm library to connect to an IMAP server.
- class synapse.lib.stormlib.imap.ImapServer(runt, imap_cli, path=None)[source]
Bases:
StormType
An IMAP server for retrieving email messages.
synapse.lib.stormlib.infosec module
- synapse.lib.stormlib.infosec.CVSS3_0_round(x)[source]
Round up to the nearest one decimal place. From the JS reference implementation: https://www.first.org/cvss/calculator/cvsscalc30.js
- synapse.lib.stormlib.infosec.CVSS3_1_round(x)[source]
Round up to the nearest one decimal place. From the JS reference implementation: https://www.first.org/cvss/calculator/cvsscalc31.js
- class synapse.lib.stormlib.infosec.CvssLib(runt, name=())[source]
Bases:
Lib
A Storm library which implements CVSS score calculations.
synapse.lib.stormlib.ipv6 module
synapse.lib.stormlib.iters module
synapse.lib.stormlib.json module
- class synapse.lib.stormlib.json.JsonLib(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Json data.
- class synapse.lib.stormlib.json.JsonSchema(runt, schema, use_default=True)[source]
Bases:
StormType
A JsonSchema validation object for use in validating data structures in Storm.
synapse.lib.stormlib.log module
synapse.lib.stormlib.macro module
synapse.lib.stormlib.math module
synapse.lib.stormlib.mime module
synapse.lib.stormlib.model module
- class synapse.lib.stormlib.model.LibModel(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with the Data Model in the Cortex.
- class synapse.lib.stormlib.model.LibModelDeprecated(runt, name=())[source]
Bases:
Lib
A storm library for interacting with the model deprecation mechanism.
- class synapse.lib.stormlib.model.LibModelEdge(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with light edges and manipulating their key-value attributes. This Library is deprecated.
- getObjLocals()[source]
Get the default list of key-value pairs which may be added to the object
.locls
dictionary.- Returns:
A key/value pairs.
- Return type:
dict
- hivepath = ('cortex', 'model', 'edges')
- validedgekeys = ('doc',)
- class synapse.lib.stormlib.model.LibModelMigration(runt, name=())[source]
Bases:
Lib
,MigrationEditorMixin
A Storm library containing migration tools.
- class synapse.lib.stormlib.model.LibModelMigrations(runt, name=())[source]
Bases:
Lib
,MigrationEditorMixin
A Storm library for selectively migrating nodes in the current view.
- class synapse.lib.stormlib.model.LibModelMigrations_0_2_31(runt, name=())[source]
Bases:
Lib
A Storm library with helper functions for the 0.2.31 model it:sec:cpe migration.
- class synapse.lib.stormlib.model.LibModelTags(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with tag specifications in the Cortex Data Model.
- class synapse.lib.stormlib.model.MigrationEditorMixin[source]
Bases:
object
Mixin helpers for migrating data within an editor context.
- class synapse.lib.stormlib.model.ModelForm(form, path=None)[source]
Bases:
Prim
Implements the Storm API for a Form.
- class synapse.lib.stormlib.model.ModelProp(prop, path=None)[source]
Bases:
Prim
Implements the Storm API for a Property.
- class synapse.lib.stormlib.model.ModelTagProp(tagprop, path=None)[source]
Bases:
Prim
Implements the Storm API for a Tag Property.
synapse.lib.stormlib.modelext module
synapse.lib.stormlib.notifications module
- class synapse.lib.stormlib.notifications.NotifyLib(runt, name=())[source]
Bases:
Lib
A Storm library for a user interacting with their notifications.
synapse.lib.stormlib.oauth module
- class synapse.lib.stormlib.oauth.OAuthV1Client(runt, ckey, csecret, atoken, asecret, sigtype, path=None)[source]
Bases:
StormType
A client for doing OAuth V1 Authentication from Storm.
synapse.lib.stormlib.pack module
synapse.lib.stormlib.project module
- class synapse.lib.stormlib.project.LibProjects(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Projects in the Cortex.
- class synapse.lib.stormlib.project.Project(runt, node, path=None)[source]
Bases:
Prim
Implements the Storm API for Project objects, which are used for managing a scrum style project in the Cortex
- class synapse.lib.stormlib.project.ProjectEpic(proj, node)[source]
Bases:
Prim
Implements the Storm API for a ProjectEpic
- class synapse.lib.stormlib.project.ProjectEpics(proj)[source]
Bases:
Prim
Implements the Storm API for ProjectEpics objects, which are collections of ProjectEpic objects associated with a particular Project
- class synapse.lib.stormlib.project.ProjectSprint(proj, node)[source]
Bases:
Prim
Implements the Storm API for a ProjectSprint
- class synapse.lib.stormlib.project.ProjectSprints(proj)[source]
Bases:
Prim
Implements the Storm API for ProjectSprints objects, which are collections of sprints associated with a single project
- class synapse.lib.stormlib.project.ProjectTicket(proj, node)[source]
Bases:
Prim
Implements the Storm API for a ProjectTicket.
- class synapse.lib.stormlib.project.ProjectTicketComment(ticket, node)[source]
Bases:
Prim
Implements the Storm API for a ProjectTicketComment
- class synapse.lib.stormlib.project.ProjectTicketComments(ticket)[source]
Bases:
Prim
Implements the Storm API for ProjectTicketComments objects, which are collections of comments associated with a ticket.
- class synapse.lib.stormlib.project.ProjectTickets(proj)[source]
Bases:
Prim
Implements the Storm API for ProjectTickets objects, which are collections of tickets associated with a project
synapse.lib.stormlib.random module
- class synapse.lib.stormlib.random.LibRandom(runt, name=())[source]
Bases:
Lib
A Storm library for generating random values.
synapse.lib.stormlib.scrape module
synapse.lib.stormlib.smtp module
synapse.lib.stormlib.spooled module
synapse.lib.stormlib.stats module
- class synapse.lib.stormlib.stats.LibStats(runt, name=())[source]
Bases:
Lib
A Storm Library for statistics related functionality.
- class synapse.lib.stormlib.stats.StatTally(path=None)[source]
Bases:
Prim
A tally object.
An example of using it:
$tally = $lib.stats.tally() $tally.inc(foo) for $name, $total in $tally { $doStuff($name, $total) }
- class synapse.lib.stormlib.stats.StatsCountByCmd(runt, runtsafe)[source]
Bases:
Cmd
Tally occurrences of values and display a bar chart of the results.
Examples
// Show counts of geo:name values referenced by media:news nodes. media:news -(refs)> geo:name | stats.countby
// Show counts of ASN values in a set of IPs. inet:ipv4#myips | stats.countby :asn
// Show counts of attacker names for risk:compromise nodes. risk:compromise | stats.countby :attacker::name
- name = 'stats.countby'
- readonly = True
synapse.lib.stormlib.stix module
- class synapse.lib.stormlib.stix.LibStix(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with Stix Version 2.1 CS02.
- class synapse.lib.stormlib.stix.LibStixExport(runt, name=())[source]
Bases:
Lib
A Storm Library for exporting to STIX version 2.1 CS02.
- class synapse.lib.stormlib.stix.LibStixImport(runt, name=())[source]
Bases:
Lib
A Storm Library for importing Stix Version 2.1 data.
- class synapse.lib.stormlib.stix.StixBundle(libstix, runt, config, path=None)[source]
Bases:
Prim
Implements the Storm API for creating and packing a STIX bundle for v2.1
synapse.lib.stormlib.storm module
- class synapse.lib.stormlib.storm.LibStorm(runt, name=())[source]
Bases:
Lib
A Storm library for evaluating dynamic storm expressions.
- class synapse.lib.stormlib.storm.StormExecCmd(runt, runtsafe)[source]
Bases:
Cmd
Execute text or an embedded query object as Storm in the current pipeline.
NOTE: It is recommended to avoid using this where possible to avoid potential query injection risks. If you must use this, take care to ensure any values being executed have been properly sanitized.
Examples
// Add nodes using text in a variable $query = ‘[ inet:fqdn=foo.com inet:fqdn=bar.net ]’ storm.exec $query
// Filter nodes in the pipeline using text in a variable $filter = ‘-:asn=10’ inet:ipv4:asn storm.exec $filter
// Pivot using an embedded query $pivot = ${ -> inet:asn } inet:ipv4:asn storm.exec $pivot
- name = 'storm.exec'
synapse.lib.stormlib.tabular module
synapse.lib.stormlib.vault module
- class synapse.lib.stormlib.vault.LibVault(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with vaults.
- class synapse.lib.stormlib.vault.Vault(runt, valu, path=None)[source]
Bases:
Prim
Implements the Storm API for a Vault.
Callers (instantiation) of this class must have already checked that the user has at least PERM_READ to the vault.
- class synapse.lib.stormlib.vault.VaultConfigs(runt, valu, path=None)[source]
Bases:
Prim
Implements the Storm API for Vault data. This is used for both vault configs and vault secrets.
- class synapse.lib.stormlib.vault.VaultSecrets(runt, valu, path=None)[source]
Bases:
VaultConfigs
synapse.lib.stormlib.version module
- class synapse.lib.stormlib.version.VersionLib(runt, name=())[source]
Bases:
Lib
A Storm Library for interacting with version information.