Skip to content
5 changes: 5 additions & 0 deletions changes/302e6db2488f498de9471bf36bf1c716.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Deprecate ``$lib.str.concat()``, ``$lib.str.format()``, and ``$lib.str.join()``.
prs: []
type: deprecation
...
7 changes: 7 additions & 0 deletions changes/3fbb6fdc77579ce771bdd8ad32649f11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
desc: Deprecated ``gen.it.av.scan.result``, ``gen.ps.contact.email``, ``gen.ou.org.hq``,
``gen.ou.id.type``, and ``gen.ou.id.number``.
desc:literal: false
prs: []
type: deprecation
...
6 changes: 6 additions & 0 deletions changes/59b29a495a8dcd4f6980bcc90fa5cbe2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Deprecated the synchronous use of ``synapse.telepath.openurl()`` and the ability
to make Telepath RPC calls from synchronous Python code.
prs: []
type: deprecation
...
5 changes: 5 additions & 0 deletions changes/69a809b0a24b0d4778c03e016be17bee.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Deprecate ``inet:web:*`` forms and the ``inet:search:query:acct`` property.
prs: []
type: deprecation
...
5 changes: 5 additions & 0 deletions changes/a85cf6e33ca144dc7c2b5f4954b4c609.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Deprecated ``synapse.glob.sync()`` and ``synapse.glob.synchelp()`` APIs.
prs: []
type: deprecation
...
5 changes: 5 additions & 0 deletions changes/ad1f8b6ce1e797a664dfdac59e942793.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
desc: Deprecated ``synapse.coro.genrhelp()`` and ``synapse.glob.GenrHelp()`` APIs.
prs: []
type: deprecation
...
6 changes: 6 additions & 0 deletions changes/df2f34f2ae5fc2dff8c46d1037531d6a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
desc: Deprecated ``$lib.gen.*`` functions.
desc:literal: false
prs: []
type: deprecation
...
6 changes: 3 additions & 3 deletions docs/synapse/userguides/storm_adv_vars.rstorm
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ You can assign an explicit, unchanging value to a variable.

You can assign the value of a particular node property (secondary or universal) to a variable.

- **Secondary property:** Assign the ``:user`` property from an Internet-based account (``inet:web:acct``) to
- **Secondary property:** Assign the ``:user`` property from an Service based account (``inet:service:account``) to
the variable ``$user``:

.. storm-pre:: [inet:web:acct=(twitter.com,hacks4cats) :email=ron@protonmail.com]
.. storm-cli:: inet:web:acct=(twitter.com,hacks4cats) $user=:user $lib.print($user)
.. storm-pre:: $twitter={[inet:service:platform=({'name': 'twitter'})]} [inet:service:account=({'platform': $twitter.value(), 'user': 'hacks4cats', 'email': 'ron@protonmail.com'})]
.. storm-cli:: inet:service:account:user=hacks4cats $user=:user $lib.print($user)


- **Universal property:** Assign the ``.seen`` universal property from a DNS A node to the variable ``$time``:
Expand Down
8 changes: 4 additions & 4 deletions docs/synapse/userguides/storm_ref_type_specific.rstorm
Original file line number Diff line number Diff line change
Expand Up @@ -1468,11 +1468,11 @@ Lift all organizations whose name starts with the word "Acme ":

.. storm-cli:: ou:org:name^='acme '

Filter a set of Internet accounts to those with usernames starting with 'matrix':

.. storm-pre:: [ inet:web:acct=(twitter.com,matrixmaster) inet:web:acct=(twitter.com,matrixneo) ]
.. storm-cli:: inet:web:acct:site=twitter.com +:user^=matrix
Filter a set of Service accounts to those with usernames starting with 'matrix':

.. storm-pre:: $twitter={[inet:service:platform=({'name': 'twitter'})]} [ inet:service:account=({'platform': $twitter.value(), 'user': 'matrixmaster'}) inet:service:account=({'platform': $twitter.value(), 'user': 'matrixneo'}) ]
e:account=({'platform': $twitter.value(), 'user': 'matrixneo'}) ]
.. storm-cli:: inet:service:account:platform=({'name': 'twitter'}) +:user^=matrix

Strings and string-derived types can also be lifted or filtered using the regular expression extended comparator
( ``~=``) (see :ref:`lift-regex` and :ref:`filter-regex`).
Expand Down
8 changes: 8 additions & 0 deletions synapse/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import signal
import asyncio
import logging
import warnings
import threading
import faulthandler

Expand All @@ -10,6 +11,11 @@
_glob_loop = None
_glob_thrd = None

# TODO Remove me in 3xx - this is just to avoid a circular import on synapse.common
def _deprecated(name, curv='2.x', eolv='3.0.0'):
mesg = f'"{name}" is deprecated in {curv} and will be removed in {eolv}'
warnings.warn(mesg, DeprecationWarning)
return mesg

def _asynciostacks(*args, **kwargs): # pragma: no cover
'''
Expand Down Expand Up @@ -83,6 +89,7 @@ def sync(coro, timeout=None):
Notes:
This API is thread safe and should only be called by non-loop threads.
'''
_deprecated('synapse.glob.sync - synchronous wrapping of coroutines is not supported: {f.__name__}')
loop = initloop()
return asyncio.run_coroutine_threadsafe(coro, loop).result(timeout)

Expand Down Expand Up @@ -115,6 +122,7 @@ def wrap(*args, **kwargs):
coro = f(*args, **kwargs)

if not iAmLoop():
_deprecated('synapse.glob.synchelp - synchronous wrapping of coroutines is not supported: {f.__name__}')
return sync(coro)

return coro
Expand Down
4 changes: 3 additions & 1 deletion synapse/lib/coro.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def timewait(self, timeout=None):

async def event_wait(event: asyncio.Event, timeout=None):
'''
Wait on an an asyncio event with an optional timeout
Wait on an asyncio event with an optional timeout

Returns:
true if the event got set, False if timed out
Expand Down Expand Up @@ -189,6 +189,7 @@ async def await_bg_tasks(timeout=None):
class GenrHelp:

def __init__(self, genr):
s_common.deprecated('synapse.coro.GenrHelp()')
assert genr is not None
self.genr = genr

Expand Down Expand Up @@ -220,6 +221,7 @@ async def list(self):
return [x async for x in self.genr]

def genrhelp(f):
s_common.deprecated('synapse.coro.genrhelp()')
@functools.wraps(f)
def func(*args, **kwargs):
return GenrHelp(f(*args, **kwargs))
Expand Down
24 changes: 24 additions & 0 deletions synapse/lib/stormlib/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ class LibGen(s_stormtypes.Lib):
'''
_storm_locals = (
{'name': 'orgByName', 'desc': 'Returns an ou:org by name, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the org.'},
),
'returns': {'type': 'node', 'desc': 'An ou:org node with the given name.'}}},
{'name': 'orgHqByName', 'desc': 'Returns a ps:contact node for the ou:org, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the org.'},
),
'returns': {'type': 'node', 'desc': 'A ps:contact node for the ou:org with the given name.'}}},
{'name': 'orgByFqdn', 'desc': 'Returns an ou:org node by FQDN, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'fqdn', 'type': 'str', 'desc': 'The FQDN of the org.'},
Expand All @@ -27,12 +30,14 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'An ou:org node with the given FQDN.'}}},
{'name': 'industryByName', 'desc': 'Returns an ou:industry by name, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the industry.'},
),
'returns': {'type': 'node', 'desc': 'An ou:industry node with the given name.'}}},
{'name': 'newsByUrl', 'desc': 'Returns a media:news node by URL, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'url', 'type': 'inet:url', 'desc': 'The URL where the news is published.'},
Expand All @@ -41,12 +46,14 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'A media:news node with the given URL.'}}},
{'name': 'softByName', 'desc': 'Returns it:prod:soft node by name, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the software.'},
),
'returns': {'type': 'node', 'desc': 'An it:prod:soft node with the given name.'}}},
{'name': 'vulnByCve', 'desc': 'Returns risk:vuln node by CVE and reporter, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'cve', 'type': 'str', 'desc': 'The CVE id.'},
Expand All @@ -58,6 +65,7 @@ class LibGen(s_stormtypes.Lib):
'returns': {'type': 'node', 'desc': 'A risk:vuln node with the given CVE.'}}},

{'name': 'riskThreat',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns a risk:threat node based on the threat and reporter names, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -67,6 +75,7 @@ class LibGen(s_stormtypes.Lib):
'returns': {'type': 'node', 'desc': 'A risk:threat node.'}}},

{'name': 'riskToolSoftware',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns a risk:tool:software node based on the tool and reporter names, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -76,6 +85,7 @@ class LibGen(s_stormtypes.Lib):
'returns': {'type': 'node', 'desc': 'A risk:tool:software node.'}}},

{'name': 'psContactByEmail', 'desc': 'Returns a ps:contact by deconflicting the type and email address.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'type', 'type': 'str', 'desc': 'The ps:contact:type property.'},
Expand All @@ -86,6 +96,7 @@ class LibGen(s_stormtypes.Lib):
'returns': {'type': 'node', 'desc': 'A ps:contact node.'}}},

{'name': 'polCountryByIso2', 'desc': 'Returns a pol:country node by deconflicting the :iso2 property.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'iso2', 'type': 'str', 'desc': 'The pol:country:iso2 property.'},
Expand All @@ -94,12 +105,14 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'A pol:country node.'}}},
{'name': 'langByName', 'desc': 'Returns a lang:language node by name, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the language.'},
),
'returns': {'type': 'node', 'desc': 'A lang:language node with the given name.'}}},
{'name': 'langByCode', 'desc': 'Returns a lang:language node by language code, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The language code for the language.'},
Expand All @@ -108,6 +121,7 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'A lang:language node with the given code.'}}},
{'name': 'campaign',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns an ou:campaign node based on the campaign and reporter names, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -116,6 +130,7 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'An ou:campaign node.'}}},
{'name': 'itAvScanResultByTarget',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns an it:av:scan:result node by deconflicting with a target and signature name, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -131,12 +146,14 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'An it:av:scan:result node.'}}},
{'name': 'geoPlaceByName', 'desc': 'Returns a geo:place node by name, adding the node if it does not exist.',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
{'name': 'name', 'type': 'str', 'desc': 'The name of the place.'},
),
'returns': {'type': 'node', 'desc': 'A geo:place node with the given name.'}}},
{'name': 'fileBytesBySha256',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns a file:bytes node by SHA256, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -146,6 +163,7 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'A file:bytes node with the given SHA256.'}}},
{'name': 'cryptoX509CertBySha256',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns a crypto:x509:cert node by SHA256, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand All @@ -155,6 +173,7 @@ class LibGen(s_stormtypes.Lib):
),
'returns': {'type': 'node', 'desc': 'A crypto:x509:cert node with the given SHA256.'}}},
{'name': 'inetTlsServerCertByServerAndSha256',
'deprecated': {'eolvers': '3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'desc': 'Returns an inet:tls:servercert node by server and SHA256, adding the node if it does not exist.',
'type': {'type': 'function', '_funcname': '_storm_query',
'args': (
Expand Down Expand Up @@ -511,6 +530,7 @@ class LibGen(s_stormtypes.Lib):

{
'name': 'gen.ou.id.number',
'deprecated': {'eolvers': 'v3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'descr': 'Lift (or create) an ou:id:number node based on the organization ID type and value.',
'cmdargs': (
('type', {'help': 'The type of the organization ID.'}),
Expand All @@ -520,6 +540,7 @@ class LibGen(s_stormtypes.Lib):
},
{
'name': 'gen.ou.id.type',
'deprecated': {'eolvers': 'v3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'descr': 'Lift (or create) an ou:id:type node based on the name of the type.',
'cmdargs': (
('name', {'help': 'The friendly name of the organization ID type.'}),
Expand All @@ -536,6 +557,7 @@ class LibGen(s_stormtypes.Lib):
},
{
'name': 'gen.ou.org.hq',
'deprecated': {'eolvers': 'v3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'descr': 'Lift (or create) the primary ps:contact node for the ou:org based on the organization name.',
'cmdargs': (
('name', {'help': 'The name of the organization.'}),
Expand Down Expand Up @@ -655,6 +677,7 @@ class LibGen(s_stormtypes.Lib):
},
{
'name': 'gen.ps.contact.email',
'deprecated': {'eolvers': 'v3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'descr': '''
Lift (or create) the ps:contact node by deconflicting the email and type.

Expand Down Expand Up @@ -682,6 +705,7 @@ class LibGen(s_stormtypes.Lib):
# todo: remove it:av:filehit example in 3.x.x
{
'name': 'gen.it.av.scan.result',
'deprecated': {'eolvers': 'v3.0.0', 'mesg': 'Use dictionary constructor syntax instead.'},
'descr': '''
Lift (or create) the it:av:scan:result node by deconflicting the target and signature name.

Expand Down
Loading