synapse 2.192.0__py311-none-any.whl → 2.194.0__py311-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of synapse might be problematic. Click here for more details.
- synapse/common.py +15 -0
- synapse/cortex.py +19 -25
- synapse/datamodel.py +6 -3
- synapse/exc.py +6 -1
- synapse/lib/agenda.py +17 -6
- synapse/lib/ast.py +242 -97
- synapse/lib/auth.py +1 -0
- synapse/lib/cell.py +31 -85
- synapse/lib/cli.py +20 -11
- synapse/lib/parser.py +5 -1
- synapse/lib/snap.py +44 -15
- synapse/lib/storm.lark +16 -1
- synapse/lib/storm.py +40 -21
- synapse/lib/storm_format.py +1 -0
- synapse/lib/stormctrl.py +88 -6
- synapse/lib/stormlib/cache.py +6 -2
- synapse/lib/stormlib/json.py +5 -2
- synapse/lib/stormlib/scrape.py +1 -1
- synapse/lib/stormlib/stix.py +8 -8
- synapse/lib/stormtypes.py +32 -5
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +20 -3
- synapse/models/geopol.py +1 -0
- synapse/models/geospace.py +1 -0
- synapse/models/inet.py +20 -1
- synapse/models/infotech.py +24 -6
- synapse/models/orgs.py +7 -2
- synapse/models/person.py +15 -4
- synapse/models/risk.py +19 -2
- synapse/models/telco.py +10 -3
- synapse/tests/test_axon.py +6 -6
- synapse/tests/test_cortex.py +133 -14
- synapse/tests/test_exc.py +4 -0
- synapse/tests/test_lib_agenda.py +282 -2
- synapse/tests/test_lib_aha.py +13 -6
- synapse/tests/test_lib_ast.py +301 -10
- synapse/tests/test_lib_auth.py +6 -7
- synapse/tests/test_lib_cell.py +71 -1
- synapse/tests/test_lib_grammar.py +14 -0
- synapse/tests/test_lib_layer.py +1 -1
- synapse/tests/test_lib_lmdbslab.py +3 -3
- synapse/tests/test_lib_storm.py +273 -55
- synapse/tests/test_lib_stormctrl.py +65 -0
- synapse/tests/test_lib_stormhttp.py +5 -5
- synapse/tests/test_lib_stormlib_auth.py +5 -5
- synapse/tests/test_lib_stormlib_cache.py +38 -6
- synapse/tests/test_lib_stormlib_json.py +20 -0
- synapse/tests/test_lib_stormlib_modelext.py +3 -3
- synapse/tests/test_lib_stormlib_scrape.py +6 -6
- synapse/tests/test_lib_stormlib_spooled.py +1 -1
- synapse/tests/test_lib_stormlib_xml.py +5 -5
- synapse/tests/test_lib_stormtypes.py +54 -57
- synapse/tests/test_lib_view.py +1 -1
- synapse/tests/test_model_base.py +1 -2
- synapse/tests/test_model_geopol.py +4 -0
- synapse/tests/test_model_geospace.py +6 -0
- synapse/tests/test_model_inet.py +43 -5
- synapse/tests/test_model_infotech.py +10 -1
- synapse/tests/test_model_orgs.py +17 -2
- synapse/tests/test_model_person.py +23 -1
- synapse/tests/test_model_risk.py +13 -0
- synapse/tests/test_tools_healthcheck.py +4 -4
- synapse/tests/test_tools_storm.py +95 -0
- synapse/tests/test_utils.py +17 -18
- synapse/tests/test_utils_getrefs.py +1 -1
- synapse/tests/utils.py +0 -35
- synapse/tools/changelog.py +6 -4
- synapse/tools/storm.py +1 -1
- synapse/utils/getrefs.py +14 -3
- synapse/vendor/cpython/lib/http/__init__.py +0 -0
- synapse/vendor/cpython/lib/http/cookies.py +59 -0
- synapse/vendor/cpython/lib/test/test_http_cookies.py +49 -0
- {synapse-2.192.0.dist-info → synapse-2.194.0.dist-info}/METADATA +6 -6
- {synapse-2.192.0.dist-info → synapse-2.194.0.dist-info}/RECORD +77 -73
- {synapse-2.192.0.dist-info → synapse-2.194.0.dist-info}/WHEEL +1 -1
- {synapse-2.192.0.dist-info → synapse-2.194.0.dist-info}/LICENSE +0 -0
- {synapse-2.192.0.dist-info → synapse-2.194.0.dist-info}/top_level.txt +0 -0
synapse/tools/changelog.py
CHANGED
|
@@ -227,12 +227,11 @@ class ModelDiffer:
|
|
|
227
227
|
|
|
228
228
|
if nkeys - okeys:
|
|
229
229
|
# We've added a key to the prop def.
|
|
230
|
-
|
|
230
|
+
updated_props[prop] = {'type': 'addkey', 'keys': list(nkeys - okeys)}
|
|
231
231
|
|
|
232
232
|
if okeys - nkeys:
|
|
233
233
|
# We've removed a key from the prop def.
|
|
234
234
|
updated_props[prop] = {'type': 'delkey', 'keys': list(okeys - nkeys)}
|
|
235
|
-
continue
|
|
236
235
|
|
|
237
236
|
# Check if type change happened, we'll want to document that.
|
|
238
237
|
ctyp = cpinfo.get('type')
|
|
@@ -334,12 +333,11 @@ class ModelDiffer:
|
|
|
334
333
|
|
|
335
334
|
if nkeys - okeys:
|
|
336
335
|
# We've added a key to the prop def.
|
|
337
|
-
|
|
336
|
+
updated_props[prop] = {'type': 'addkey', 'keys': list(nkeys - okeys)}
|
|
338
337
|
|
|
339
338
|
if okeys - nkeys:
|
|
340
339
|
# We've removed a key from the prop def.
|
|
341
340
|
updated_props[prop] = {'type': 'delkey', 'keys': list(okeys - nkeys)}
|
|
342
|
-
continue
|
|
343
341
|
|
|
344
342
|
# Check if type change happened, we'll want to document that.
|
|
345
343
|
ctyp = cpinfo.get('type')
|
|
@@ -660,6 +658,8 @@ def _gen_model_rst(version, model_ref, changes, current_model, outp: s_output.Ou
|
|
|
660
658
|
f' to {pnfo.get("new_type")}.'
|
|
661
659
|
elif ptyp == 'delkey':
|
|
662
660
|
mesg = f'The property ``{prop}`` had the ``{pnfo.get("keys")}`` keys removed from its definition.'
|
|
661
|
+
elif ptyp == 'addkey':
|
|
662
|
+
mesg = f'The property ``{prop}`` had the ``{pnfo.get("keys")}`` keys added to its definition.'
|
|
663
663
|
else:
|
|
664
664
|
raise s_exc.NoSuchImpl(mesg=f'pnfo.type={ptyp} not supported.')
|
|
665
665
|
lines = [
|
|
@@ -677,6 +677,8 @@ def _gen_model_rst(version, model_ref, changes, current_model, outp: s_output.Ou
|
|
|
677
677
|
f' to {pnfo.get("new_type")}.'
|
|
678
678
|
elif ptyp == 'delkey':
|
|
679
679
|
mesg = f'The property ``{prop}`` had the ``{pnfo.get("keys")}`` keys removed from its definition.'
|
|
680
|
+
elif ptyp == 'addkey':
|
|
681
|
+
mesg = f'The property ``{prop}`` had the ``{pnfo.get("keys")}`` keys added to its definition.'
|
|
680
682
|
else:
|
|
681
683
|
raise s_exc.NoSuchImpl(mesg=f'pnfo.type={ptyp} not supported.')
|
|
682
684
|
|
synapse/tools/storm.py
CHANGED
|
@@ -345,7 +345,7 @@ class StormCompleter(prompt_toolkit.completion.Completer):
|
|
|
345
345
|
depth = prefix.count('.') + 1
|
|
346
346
|
|
|
347
347
|
q = '''
|
|
348
|
-
$rslt =
|
|
348
|
+
$rslt = ()
|
|
349
349
|
if ($prefix != '') { syn:tag=$lib.regex.replace("\\.$", '', $prefix) }
|
|
350
350
|
syn:tag^=$prefix
|
|
351
351
|
+:depth<=$depth
|
synapse/utils/getrefs.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import json
|
|
3
3
|
import urllib
|
|
4
|
+
import asyncio
|
|
4
5
|
import logging
|
|
5
6
|
import pathlib
|
|
6
7
|
import argparse
|
|
7
8
|
|
|
8
|
-
import
|
|
9
|
+
import aiohttp
|
|
9
10
|
|
|
10
11
|
import synapse.exc as s_exc
|
|
11
12
|
import synapse.data as s_data
|
|
@@ -20,7 +21,13 @@ def download_refs_handler(uri):
|
|
|
20
21
|
This function downloads the JSON schema at the given URI, parses the given
|
|
21
22
|
URI to get the path component, and then saves the referenced schema to the
|
|
22
23
|
'jsonschemas' directory of synapse.data.
|
|
24
|
+
|
|
25
|
+
This function runs its own asyncio loop for each URI being requested.
|
|
23
26
|
'''
|
|
27
|
+
ret = asyncio.run(_download_refs_handler(uri))
|
|
28
|
+
return ret
|
|
29
|
+
|
|
30
|
+
async def _download_refs_handler(uri):
|
|
24
31
|
|
|
25
32
|
try:
|
|
26
33
|
parts = urllib.parse.urlparse(uri)
|
|
@@ -45,8 +52,12 @@ def download_refs_handler(uri):
|
|
|
45
52
|
|
|
46
53
|
# Get the data from the interwebs
|
|
47
54
|
logger.info(f'Downloading schema from {uri}.')
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
async with aiohttp.ClientSession() as session:
|
|
56
|
+
async with session.get(uri) as resp:
|
|
57
|
+
resp.raise_for_status()
|
|
58
|
+
buf = await resp.read()
|
|
59
|
+
|
|
60
|
+
data = json.loads(buf.decode())
|
|
50
61
|
|
|
51
62
|
# Save the json schema to disk
|
|
52
63
|
with filepath.open('w') as fp:
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Taken from the cpython 3.11 source branch after the 3.11.10 release.
|
|
3
|
+
##############################################################################
|
|
4
|
+
####
|
|
5
|
+
# Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
|
|
6
|
+
#
|
|
7
|
+
# All Rights Reserved
|
|
8
|
+
#
|
|
9
|
+
# Permission to use, copy, modify, and distribute this software
|
|
10
|
+
# and its documentation for any purpose and without fee is hereby
|
|
11
|
+
# granted, provided that the above copyright notice appear in all
|
|
12
|
+
# copies and that both that copyright notice and this permission
|
|
13
|
+
# notice appear in supporting documentation, and that the name of
|
|
14
|
+
# Timothy O'Malley not be used in advertising or publicity
|
|
15
|
+
# pertaining to distribution of the software without specific, written
|
|
16
|
+
# prior permission.
|
|
17
|
+
#
|
|
18
|
+
# Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
19
|
+
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
# AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR
|
|
21
|
+
# ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
22
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
23
|
+
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
24
|
+
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
+
# PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
+
#
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# Import our required modules
|
|
30
|
+
#
|
|
31
|
+
import re
|
|
32
|
+
|
|
33
|
+
_unquote_sub = re.compile(r'\\(?:([0-3][0-7][0-7])|(.))').sub
|
|
34
|
+
|
|
35
|
+
def _unquote_replace(m):
|
|
36
|
+
if m[1]:
|
|
37
|
+
return chr(int(m[1], 8))
|
|
38
|
+
else:
|
|
39
|
+
return m[2]
|
|
40
|
+
|
|
41
|
+
def _unquote(str):
|
|
42
|
+
# If there aren't any doublequotes,
|
|
43
|
+
# then there can't be any special characters. See RFC 2109.
|
|
44
|
+
if str is None or len(str) < 2:
|
|
45
|
+
return str
|
|
46
|
+
if str[0] != '"' or str[-1] != '"':
|
|
47
|
+
return str
|
|
48
|
+
|
|
49
|
+
# We have to assume that we must decode this string.
|
|
50
|
+
# Down to work.
|
|
51
|
+
|
|
52
|
+
# Remove the "s
|
|
53
|
+
str = str[1:-1]
|
|
54
|
+
|
|
55
|
+
# Check for special sequences. Examples:
|
|
56
|
+
# \012 --> \n
|
|
57
|
+
# \" --> "
|
|
58
|
+
#
|
|
59
|
+
return _unquote_sub(_unquote_replace, str)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
##############################################################################
|
|
2
|
+
# Taken from the cpython 3.11 source branch after the 3.11.10 release.
|
|
3
|
+
# It has been modified for vendored imports and vendored test harness.
|
|
4
|
+
##############################################################################
|
|
5
|
+
|
|
6
|
+
# Simple test suite for http/cookies.py
|
|
7
|
+
|
|
8
|
+
from http import cookies
|
|
9
|
+
|
|
10
|
+
# s_v_utils runs the monkeypatch
|
|
11
|
+
import synapse.vendor.utils as s_v_utils
|
|
12
|
+
|
|
13
|
+
class CookieTests(s_v_utils.VendorTest):
|
|
14
|
+
|
|
15
|
+
def test_unquote(self):
|
|
16
|
+
cases = [
|
|
17
|
+
(r'a="b=\""', 'b="'),
|
|
18
|
+
(r'a="b=\\"', 'b=\\'),
|
|
19
|
+
(r'a="b=\="', 'b=='),
|
|
20
|
+
(r'a="b=\n"', 'b=n'),
|
|
21
|
+
(r'a="b=\042"', 'b="'),
|
|
22
|
+
(r'a="b=\134"', 'b=\\'),
|
|
23
|
+
(r'a="b=\377"', 'b=\xff'),
|
|
24
|
+
(r'a="b=\400"', 'b=400'),
|
|
25
|
+
(r'a="b=\42"', 'b=42'),
|
|
26
|
+
(r'a="b=\\042"', 'b=\\042'),
|
|
27
|
+
(r'a="b=\\134"', 'b=\\134'),
|
|
28
|
+
(r'a="b=\\\""', 'b=\\"'),
|
|
29
|
+
(r'a="b=\\\042"', 'b=\\"'),
|
|
30
|
+
(r'a="b=\134\""', 'b=\\"'),
|
|
31
|
+
(r'a="b=\134\042"', 'b=\\"'),
|
|
32
|
+
]
|
|
33
|
+
for encoded, decoded in cases:
|
|
34
|
+
with self.subTest(encoded):
|
|
35
|
+
C = cookies.SimpleCookie()
|
|
36
|
+
C.load(encoded)
|
|
37
|
+
self.assertEqual(C['a'].value, decoded)
|
|
38
|
+
|
|
39
|
+
def test_unquote_large(self):
|
|
40
|
+
n = 10**6
|
|
41
|
+
for encoded in r'\\', r'\134':
|
|
42
|
+
with self.subTest(encoded):
|
|
43
|
+
data = 'a="b=' + encoded * n + ';"'
|
|
44
|
+
C = cookies.SimpleCookie()
|
|
45
|
+
C.load(data)
|
|
46
|
+
value = C['a'].value
|
|
47
|
+
self.assertEqual(value[:3], 'b=\\')
|
|
48
|
+
self.assertEqual(value[-2:], '\\;')
|
|
49
|
+
self.assertEqual(len(value), n + 3)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: synapse
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.194.0
|
|
4
4
|
Summary: Synapse Intelligence Analysis Framework
|
|
5
5
|
Author-email: The Vertex Project LLC <root@vertex.link>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -28,10 +28,10 @@ Requires-Dist: tornado<7.0.0,>=6.2.0
|
|
|
28
28
|
Requires-Dist: regex>=2022.9.11
|
|
29
29
|
Requires-Dist: PyYAML<6.1.0,>=5.4
|
|
30
30
|
Requires-Dist: aiohttp<4.0,>=3.10.0
|
|
31
|
-
Requires-Dist: aiohttp-socks<0.
|
|
31
|
+
Requires-Dist: aiohttp-socks<0.11.0,>=0.9.0
|
|
32
32
|
Requires-Dist: aioimaplib<1.2.0,>=1.1.0
|
|
33
33
|
Requires-Dist: aiosmtplib<3.1.0,>=3.0.0
|
|
34
|
-
Requires-Dist:
|
|
34
|
+
Requires-Dist: prompt_toolkit<3.1.0,>=3.0.29
|
|
35
35
|
Requires-Dist: lark==1.2.2
|
|
36
36
|
Requires-Dist: Pygments<2.18.0,>=2.7.4
|
|
37
37
|
Requires-Dist: packaging<25.0,>=20.0
|
|
@@ -75,7 +75,7 @@ Learn More About Synapse
|
|
|
75
75
|
------------------------
|
|
76
76
|
|
|
77
77
|
* Visit our website_ to learn more about Synapse.
|
|
78
|
-
* Watch `Synapse
|
|
78
|
+
* Watch the `Synapse Guided Tour`_!
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
Installation & Documentation
|
|
@@ -106,7 +106,7 @@ Connect With Us
|
|
|
106
106
|
|
|
107
107
|
.. _website: https://v.vtx.lk/vertex
|
|
108
108
|
|
|
109
|
-
.. _Synapse
|
|
109
|
+
.. _Synapse Guided Tour: https://v.vtx.lk/synapse-tour
|
|
110
110
|
|
|
111
111
|
.. _pypi: https://v.vtx.lk/synapse-pypi
|
|
112
112
|
|