synapse 2.165.0__py311-none-any.whl → 2.167.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/axon.py +4 -10
- synapse/cmds/cortex.py +1 -6
- synapse/common.py +6 -0
- synapse/cortex.py +104 -57
- synapse/datamodel.py +32 -0
- synapse/exc.py +1 -0
- synapse/lib/agenda.py +81 -51
- synapse/lib/aha.py +2 -0
- synapse/lib/ast.py +21 -23
- synapse/lib/base.py +11 -10
- synapse/lib/cell.py +24 -24
- synapse/lib/hive.py +11 -0
- synapse/lib/httpapi.py +1 -0
- synapse/lib/nexus.py +3 -2
- synapse/lib/node.py +4 -2
- synapse/lib/schemas.py +3 -1
- synapse/lib/snap.py +50 -0
- synapse/lib/storm.py +19 -17
- synapse/lib/stormlib/aha.py +370 -17
- synapse/lib/stormlib/auth.py +11 -4
- synapse/lib/stormlib/cache.py +202 -0
- synapse/lib/stormlib/cortex.py +69 -7
- synapse/lib/stormlib/macro.py +11 -18
- synapse/lib/stormlib/spooled.py +109 -0
- synapse/lib/stormlib/stix.py +1 -1
- synapse/lib/stormtypes.py +61 -17
- synapse/lib/trigger.py +10 -12
- synapse/lib/types.py +3 -1
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +16 -3
- synapse/models/base.py +8 -0
- synapse/models/files.py +3 -0
- synapse/models/inet.py +74 -2
- synapse/models/orgs.py +52 -8
- synapse/models/person.py +30 -11
- synapse/models/risk.py +44 -3
- synapse/telepath.py +115 -32
- synapse/tests/files/stormpkg/dotstorm/dotstorm.yaml +3 -0
- synapse/tests/test_cortex.py +79 -8
- synapse/tests/test_datamodel.py +22 -0
- synapse/tests/test_lib_agenda.py +8 -1
- synapse/tests/test_lib_aha.py +19 -6
- synapse/tests/test_lib_cell.py +6 -2
- synapse/tests/test_lib_grammar.py +62 -64
- synapse/tests/test_lib_httpapi.py +1 -1
- synapse/tests/test_lib_rstorm.py +4 -4
- synapse/tests/test_lib_storm.py +98 -7
- synapse/tests/test_lib_stormlib_aha.py +196 -0
- synapse/tests/test_lib_stormlib_cache.py +272 -0
- synapse/tests/test_lib_stormlib_compression.py +12 -12
- synapse/tests/test_lib_stormlib_cortex.py +71 -0
- synapse/tests/test_lib_stormlib_macro.py +94 -0
- synapse/tests/test_lib_stormlib_spooled.py +190 -0
- synapse/tests/test_lib_stormtypes.py +71 -37
- synapse/tests/test_lib_view.py +50 -3
- synapse/tests/test_model_files.py +3 -0
- synapse/tests/test_model_inet.py +67 -0
- synapse/tests/test_model_risk.py +6 -0
- synapse/tests/test_telepath.py +30 -7
- synapse/tests/test_tools_genpkg.py +26 -0
- synapse/tests/test_tools_hiveload.py +1 -0
- synapse/tests/test_tools_hivesave.py +1 -0
- synapse/tests/test_tools_modrole.py +81 -0
- synapse/tests/test_tools_moduser.py +105 -0
- synapse/tests/utils.py +22 -3
- synapse/tools/autodoc.py +1 -1
- synapse/tools/hive/load.py +3 -0
- synapse/tools/hive/save.py +3 -0
- synapse/tools/modrole.py +59 -7
- synapse/tools/moduser.py +78 -10
- {synapse-2.165.0.dist-info → synapse-2.167.0.dist-info}/METADATA +3 -3
- {synapse-2.165.0.dist-info → synapse-2.167.0.dist-info}/RECORD +75 -72
- synapse/lib/provenance.py +0 -111
- synapse/tests/test_lib_provenance.py +0 -37
- {synapse-2.165.0.dist-info → synapse-2.167.0.dist-info}/LICENSE +0 -0
- {synapse-2.165.0.dist-info → synapse-2.167.0.dist-info}/WHEEL +0 -0
- {synapse-2.165.0.dist-info → synapse-2.167.0.dist-info}/top_level.txt +0 -0
synapse/tests/test_lib_cell.py
CHANGED
|
@@ -7,6 +7,7 @@ import signal
|
|
|
7
7
|
import socket
|
|
8
8
|
import asyncio
|
|
9
9
|
import tarfile
|
|
10
|
+
import warnings
|
|
10
11
|
import collections
|
|
11
12
|
import multiprocessing
|
|
12
13
|
|
|
@@ -509,8 +510,11 @@ class CellTest(s_t_utils.SynTest):
|
|
|
509
510
|
|
|
510
511
|
s_common.yamlsave(tree, bootpath)
|
|
511
512
|
|
|
512
|
-
|
|
513
|
-
self.
|
|
513
|
+
with warnings.catch_warnings(record=True) as warns:
|
|
514
|
+
async with self.getTestCell(s_cell.Cell, dirn=dirn) as cell:
|
|
515
|
+
self.eq('haha', await cell.hive.get(('hehe',)))
|
|
516
|
+
|
|
517
|
+
self.isin('Initial hive config from hiveboot.yaml', str(warns[0].message))
|
|
514
518
|
|
|
515
519
|
# test that the file does not load again
|
|
516
520
|
tree['kids']['redballoons'] = {'value': 99}
|
|
@@ -94,7 +94,7 @@ Queries = [
|
|
|
94
94
|
'[test:str=foo :tick?=2019 ]',
|
|
95
95
|
'[test:str=a] switch $node.form() { hehe\xa0: {[+#baz]} }',
|
|
96
96
|
'[test:type10=2 :strprop=1] spin | test:type10 +$(:strprop) $foo=1 +$foo',
|
|
97
|
-
'inet:fqdn#xxx.xxxxxx.xxxx.xx for $tag in $node.tags(xxx.xxxxxx.*.xx) { <-
|
|
97
|
+
'inet:fqdn#xxx.xxxxxx.xxxx.xx for $tag in $node.tags(xxx.xxxxxx.*.xx) { <- inet:dns:a +#xx <- meta:note [ +#foo] ->inet:dns:a }',
|
|
98
98
|
' +(syn:tag~=aka.*.mal.*)',
|
|
99
99
|
'+(syn:tag^=aka or syn:tag^=cno or syn:tag^=rep)',
|
|
100
100
|
'[test:str=foo][test:int=42]',
|
|
@@ -113,7 +113,7 @@ Queries = [
|
|
|
113
113
|
'#test.bar +test:pivcomp -> *',
|
|
114
114
|
'#test.bar +test:str <+- *',
|
|
115
115
|
'#test.bar +test:str <- *',
|
|
116
|
-
'test:migr <-
|
|
116
|
+
'test:migr <- meta:note',
|
|
117
117
|
'#test.bar -#test -+> *',
|
|
118
118
|
'#test.bar -#test -> *',
|
|
119
119
|
'#test.bar -#test <+- *',
|
|
@@ -130,7 +130,7 @@ Queries = [
|
|
|
130
130
|
'.created="{created}"',
|
|
131
131
|
'.seen [ -.seen ]',
|
|
132
132
|
'.seen~="^r"',
|
|
133
|
-
"[
|
|
133
|
+
"[meta:note='*' :type=m1]",
|
|
134
134
|
'[ geo:place="*" :latlong=(-30.0,20.22) ]',
|
|
135
135
|
'[ inet:asn=200 :name=visi ]',
|
|
136
136
|
'[ inet:dns:a = ( woot.com , 12.34.56.78 ) ]',
|
|
@@ -192,11 +192,11 @@ Queries = [
|
|
|
192
192
|
'[ test:str=woot .seen=(2014,2015) ]',
|
|
193
193
|
'[ test:str=woot .seen=20 ]',
|
|
194
194
|
'[-#foo]',
|
|
195
|
-
'[
|
|
196
|
-
'[
|
|
197
|
-
'[
|
|
198
|
-
'[
|
|
199
|
-
'[
|
|
195
|
+
'[meta:seen=((test:str, foobar), (test:str, foo))]',
|
|
196
|
+
'[meta:seen=((test:comp, (2048, horton)), (test:comp, (4096, whoville)))]',
|
|
197
|
+
'[meta:seen=((test:comp, (9001, "A mean one")), (test:comp, (40000, greeneggs)))]',
|
|
198
|
+
'[meta:seen=((test:int, 16), (test:comp, (9999, greenham)))]',
|
|
199
|
+
'[meta:seen=((test:str, 123), (test:int, 123))]',
|
|
200
200
|
'[inet:dns:query=(tcp://1.2.3.4, "", 1)]',
|
|
201
201
|
'[inet:dns:query=(tcp://1.2.3.4, "foo*.haha.com", 1)]',
|
|
202
202
|
'[inet:ipv4=1.2.3.1-1.2.3.3]',
|
|
@@ -220,9 +220,8 @@ Queries = [
|
|
|
220
220
|
'[test:str=foo :tick=201808021201]',
|
|
221
221
|
'[test:str=hehe] | iden abcd | count',
|
|
222
222
|
'[test:str=hello]',
|
|
223
|
-
'
|
|
224
|
-
'
|
|
225
|
-
'edge:wentto',
|
|
223
|
+
'meta:seen +:node*range=((test:comp, (1000, green)), (test:comp, (3000, ham)))',
|
|
224
|
+
'meta:seen',
|
|
226
225
|
'file:bytes:size=4',
|
|
227
226
|
'for $fqdn in $fqdns { [ inet:fqdn=$fqdn ] }',
|
|
228
227
|
'for ($fqdn, $ipv4) in $dnsa { [ inet:dns:a=($fqdn,$ipv4) ] }',
|
|
@@ -233,10 +232,10 @@ Queries = [
|
|
|
233
232
|
'geo:place:latlong*near=(("34.118560", "-118.300370"), 50m)',
|
|
234
233
|
'geo:place:latlong*near=((0, 0), 50m)',
|
|
235
234
|
'geo:place:latlong*near=((34.1, -118.3), 10km)',
|
|
236
|
-
'geo:place=$place <-
|
|
237
|
-
'geo:place=$place <-
|
|
235
|
+
'geo:place=$place <- meta:seen <- *',
|
|
236
|
+
'geo:place=$place <- meta:seen <- ps:person',
|
|
238
237
|
'geo:place=abcd $latlong=:latlong $radius=:radius | spin | tel:mob:telem:latlong*near=($latlong, 3km)',
|
|
239
|
-
'
|
|
238
|
+
'meta:note=abcd | noderefs -d 2 --join',
|
|
240
239
|
'help',
|
|
241
240
|
'iden 2cdd997872b10a65407ad5fadfa28e0d',
|
|
242
241
|
'iden deadb33f',
|
|
@@ -291,11 +290,11 @@ Queries = [
|
|
|
291
290
|
'meta:source=8f1401de15918358d5247e21ca29a814',
|
|
292
291
|
'movetag a.b a.m',
|
|
293
292
|
'movetag hehe woot',
|
|
294
|
-
'ps:person=$pers ->
|
|
295
|
-
'ps:person=$pers ->
|
|
296
|
-
'ps:person=$pers ->
|
|
297
|
-
'ps:person=$pers ->
|
|
298
|
-
'ps:person=$pers ->
|
|
293
|
+
'ps:person=$pers -> meta:seen -> *',
|
|
294
|
+
'ps:person=$pers -> meta:seen -> geo:place',
|
|
295
|
+
'ps:person=$pers -> meta:seen +:time@=(2014,2017) -> geo:place',
|
|
296
|
+
'ps:person=$pers -> meta:seen -> *',
|
|
297
|
+
'ps:person=$pers -> meta:seen :node -> *',
|
|
299
298
|
'reindex --form-counts',
|
|
300
299
|
'sudo | [ inet:ipv4=1.2.3.4 ]',
|
|
301
300
|
'sudo | [ test:cycle0=foo :test:cycle1=bar ]',
|
|
@@ -445,12 +444,12 @@ Queries = [
|
|
|
445
444
|
'test:str=bar <- *',
|
|
446
445
|
'test:str=bar test:pivcomp=(foo,bar) [+#test.bar]',
|
|
447
446
|
'test:str=foo +#lol@=2016',
|
|
448
|
-
'test:str=foo <+-
|
|
449
|
-
'test:str=foo <-
|
|
447
|
+
'test:str=foo <+- meta:seen',
|
|
448
|
+
'test:str=foo <- meta:seen',
|
|
450
449
|
'test:str=foo | delnode',
|
|
451
|
-
'test:str=foobar -+>
|
|
452
|
-
'test:str=foobar ->
|
|
453
|
-
'test:str=foobar ->
|
|
450
|
+
'test:str=foobar -+> meta:seen',
|
|
451
|
+
'test:str=foobar -> meta:seen <+- test:str',
|
|
452
|
+
'test:str=foobar -> meta:seen <- test:str',
|
|
454
453
|
'test:str=hello [:tick="2001"]',
|
|
455
454
|
'test:str=hello [:tick="2002"]',
|
|
456
455
|
'test:str=pennywise | noderefs --join -d 9 --traverse-edge',
|
|
@@ -515,7 +514,7 @@ Queries = [
|
|
|
515
514
|
|
|
516
515
|
{[ inet:email:message:attachment=($node, "*") ] -inet:email:message [ :name=sploit.exe ]}
|
|
517
516
|
|
|
518
|
-
{[
|
|
517
|
+
{[ meta:seen=($node, ('inet:email:header', ('to', 'Visi Kensho <visi@vertex.link>'))) ]}
|
|
519
518
|
''',
|
|
520
519
|
'$x = $(1 / 3)',
|
|
521
520
|
'$x = $(1 * 3)',
|
|
@@ -687,18 +686,18 @@ Queries = [
|
|
|
687
686
|
'reverse(*$form=$valu)',
|
|
688
687
|
'test:str=foobar -> inet:dns*',
|
|
689
688
|
'test:str=foobar -> inet:dns:*',
|
|
690
|
-
'test:str=foobar -> (
|
|
691
|
-
'test:str=foobar -> (
|
|
689
|
+
'test:str=foobar -> (meta:seen, inet:dns:a)',
|
|
690
|
+
'test:str=foobar -> (meta:seen, inet:dns*)',
|
|
692
691
|
'test:str=foobar -> $foo',
|
|
693
692
|
'test:str=foobar -+> inet:dns*',
|
|
694
693
|
'test:str=foobar -+> inet:dns:*',
|
|
695
|
-
'test:str=foobar -+> (
|
|
696
|
-
'test:str=foobar -+> (
|
|
694
|
+
'test:str=foobar -+> (meta:seen, inet:dns:a)',
|
|
695
|
+
'test:str=foobar -+> (meta:seen, inet:dns*)',
|
|
697
696
|
'test:str=foobar -+> $foo',
|
|
698
697
|
'test:str=foobar -(refs)> inet:dns:*',
|
|
699
|
-
'inet:fqdn=foo.com :zone -> (
|
|
698
|
+
'inet:fqdn=foo.com :zone -> (meta:seen, inet:dns:a)',
|
|
700
699
|
'inet:fqdn=foo.com :zone -> $foo',
|
|
701
|
-
'inet:fqdn=foo.com :zone -+> (
|
|
700
|
+
'inet:fqdn=foo.com :zone -+> (meta:seen, inet:dns:a)',
|
|
702
701
|
'inet:fqdn=foo.com :zone -+> $foo',
|
|
703
702
|
'test:*#foo',
|
|
704
703
|
'test:*#foo@=2016',
|
|
@@ -809,7 +808,7 @@ _ParseResults = [
|
|
|
809
808
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditPropSet: [RelProp: [Const: tick], Const: ?=, Const: 2019]]',
|
|
810
809
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: a], SwitchCase: [FuncCall: [VarDeref: [VarValue: [Const: node], Const: form], CallArgs: [], CallKwargs: []], CaseEntry: [Const: hehe, SubQuery: [Query: [EditTagAdd: [TagName: [Const: baz]]]]]]]',
|
|
811
810
|
'Query: [EditNodeAdd: [FormName: [Const: test:type10], Const: =, Const: 2], EditPropSet: [RelProp: [Const: strprop], Const: =, Const: 1], CmdOper: [Const: spin, Const: ()], LiftProp: [Const: test:type10], FiltOper: [Const: +, DollarExpr: [RelPropValue: [Const: strprop]]], SetVarOper: [Const: foo, Const: 1], FiltOper: [Const: +, VarValue: [Const: foo]]]',
|
|
812
|
-
'Query: [LiftFormTag: [Const: inet:fqdn, TagName: [Const: xxx, Const: xxxxxx, Const: xxxx, Const: xx]], ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: xxx.xxxxxx.*.xx], CallKwargs: []], SubQuery: [Query: [PivotInFrom: [Const:
|
|
811
|
+
'Query: [LiftFormTag: [Const: inet:fqdn, TagName: [Const: xxx, Const: xxxxxx, Const: xxxx, Const: xx]], ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: xxx.xxxxxx.*.xx], CallKwargs: []], SubQuery: [Query: [PivotInFrom: [Const: inet:dns:a], isjoin=False, FiltOper: [Const: +, TagCond: [TagMatch: [Const: xx]]], PivotInFrom: [Const: meta:note], isjoin=False, EditTagAdd: [TagName: [Const: foo]], FormPivot: [Const: inet:dns:a], isjoin=False]]]]',
|
|
813
812
|
'Query: [FiltOper: [Const: +, AbsPropCond: [Const: syn:tag, Const: ~=, Const: aka.*.mal.*]]]',
|
|
814
813
|
'Query: [FiltOper: [Const: +, OrCond: [OrCond: [AbsPropCond: [Const: syn:tag, Const: ^=, Const: aka], AbsPropCond: [Const: syn:tag, Const: ^=, Const: cno]], AbsPropCond: [Const: syn:tag, Const: ^=, Const: rep]]]]',
|
|
815
814
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditNodeAdd: [FormName: [Const: test:int], Const: =, Const: 42]]',
|
|
@@ -828,7 +827,7 @@ _ParseResults = [
|
|
|
828
827
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:pivcomp]], PivotOut: [], isjoin=False]',
|
|
829
828
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:str]], PivotIn: [], isjoin=True]',
|
|
830
829
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: +, HasAbsPropCond: [Const: test:str]], PivotIn: [], isjoin=False]',
|
|
831
|
-
'Query: [LiftProp: [Const: test:migr], PivotInFrom: [Const:
|
|
830
|
+
'Query: [LiftProp: [Const: test:migr], PivotInFrom: [Const: meta:note], isjoin=False]',
|
|
832
831
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotOut: [], isjoin=True]',
|
|
833
832
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotOut: [], isjoin=False]',
|
|
834
833
|
'Query: [LiftTag: [TagName: [Const: test, Const: bar]], FiltOper: [Const: -, TagCond: [TagMatch: [Const: test]]], PivotIn: [], isjoin=True]',
|
|
@@ -845,7 +844,7 @@ _ParseResults = [
|
|
|
845
844
|
'Query: [LiftPropBy: [Const: .created, Const: =, Const: {created}]]',
|
|
846
845
|
'Query: [LiftProp: [Const: .seen], EditUnivDel: [UnivProp: [Const: .seen]]]',
|
|
847
846
|
'Query: [LiftPropBy: [Const: .seen, Const: ~=, Const: ^r]]',
|
|
848
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
847
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:note], Const: =, Const: *], EditPropSet: [RelProp: [Const: type], Const: =, Const: m1]]',
|
|
849
848
|
'Query: [EditNodeAdd: [FormName: [Const: geo:place], Const: =, Const: *], EditPropSet: [RelProp: [Const: latlong], Const: =, List: [Const: -30.0, Const: 20.22]]]',
|
|
850
849
|
'Query: [EditNodeAdd: [FormName: [Const: inet:asn], Const: =, Const: 200], EditPropSet: [RelProp: [Const: name], Const: =, Const: visi]]',
|
|
851
850
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [Const: woot.com, Const: 12.34.56.78]]]',
|
|
@@ -907,11 +906,11 @@ _ParseResults = [
|
|
|
907
906
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: woot], EditPropSet: [UnivProp: [Const: .seen], Const: =, List: [Const: 2014, Const: 2015]]]',
|
|
908
907
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: woot], EditPropSet: [UnivProp: [Const: .seen], Const: =, Const: 20]]',
|
|
909
908
|
'Query: [EditTagDel: [TagName: [Const: foo]]]',
|
|
910
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
911
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
912
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
913
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
914
|
-
'Query: [EditNodeAdd: [FormName: [Const:
|
|
909
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:str, Const: foobar], List: [Const: test:str, Const: foo]]]]',
|
|
910
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:comp, List: [Const: 2048, Const: horton]], List: [Const: test:comp, List: [Const: 4096, Const: whoville]]]]]',
|
|
911
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:comp, List: [Const: 9001, Const: A mean one]], List: [Const: test:comp, List: [Const: 40000, Const: greeneggs]]]]]',
|
|
912
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:int, Const: 16], List: [Const: test:comp, List: [Const: 9999, Const: greenham]]]]]',
|
|
913
|
+
'Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [List: [Const: test:str, Const: 123], List: [Const: test:int, Const: 123]]]]',
|
|
915
914
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:query], Const: =, List: [Const: tcp://1.2.3.4, Const: , Const: 1]]]',
|
|
916
915
|
'Query: [EditNodeAdd: [FormName: [Const: inet:dns:query], Const: =, List: [Const: tcp://1.2.3.4, Const: foo*.haha.com, Const: 1]]]',
|
|
917
916
|
'Query: [EditNodeAdd: [FormName: [Const: inet:ipv4], Const: =, Const: 1.2.3.1-1.2.3.3]]',
|
|
@@ -935,9 +934,8 @@ _ParseResults = [
|
|
|
935
934
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: foo], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 201808021201]]',
|
|
936
935
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: hehe], CmdOper: [Const: iden, List: [Const: abcd]], CmdOper: [Const: count, Const: ()]]',
|
|
937
936
|
'Query: [EditNodeAdd: [FormName: [Const: test:str], Const: =, Const: hello]]',
|
|
938
|
-
'Query: [LiftProp: [Const:
|
|
939
|
-
'Query: [LiftProp: [Const:
|
|
940
|
-
'Query: [LiftProp: [Const: edge:wentto]]',
|
|
937
|
+
'Query: [LiftProp: [Const: meta:seen], FiltOper: [Const: +, RelPropCond: [RelPropValue: [RelProp: [Const: node]], Const: range=, List: [List: [Const: test:comp, List: [Const: 1000, Const: green]], List: [Const: test:comp, List: [Const: 3000, Const: ham]]]]]]',
|
|
938
|
+
'Query: [LiftProp: [Const: meta:seen]]',
|
|
941
939
|
'Query: [LiftPropBy: [Const: file:bytes:size, Const: =, Const: 4]]',
|
|
942
940
|
'Query: [ForLoop: [Const: fqdn, VarValue: [Const: fqdns], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:fqdn], Const: =, VarValue: [Const: fqdn]]]]]]',
|
|
943
941
|
"Query: [ForLoop: [VarList: ['fqdn', 'ipv4'], VarValue: [Const: dnsa], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [VarValue: [Const: fqdn], VarValue: [Const: ipv4]]]]]]]",
|
|
@@ -948,10 +946,10 @@ _ParseResults = [
|
|
|
948
946
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 34.118560, Const: -118.300370], Const: 50m]]]',
|
|
949
947
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 0, Const: 0], Const: 50m]]]',
|
|
950
948
|
'Query: [LiftPropBy: [Const: geo:place:latlong, Const: near=, List: [List: [Const: 34.1, Const: -118.3], Const: 10km]]]',
|
|
951
|
-
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const:
|
|
952
|
-
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const:
|
|
949
|
+
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const: meta:seen], isjoin=False, PivotIn: [], isjoin=False]',
|
|
950
|
+
'Query: [LiftPropBy: [Const: geo:place, Const: =, VarValue: [Const: place]], PivotInFrom: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: ps:person], isjoin=False]',
|
|
953
951
|
'Query: [LiftPropBy: [Const: geo:place, Const: =, Const: abcd], SetVarOper: [Const: latlong, RelPropValue: [Const: latlong]], SetVarOper: [Const: radius, RelPropValue: [Const: radius]], CmdOper: [Const: spin, Const: ()], LiftPropBy: [Const: tel:mob:telem:latlong, Const: near=, List: [VarValue: [Const: latlong], Const: 3km]]]',
|
|
954
|
-
'Query: [LiftPropBy: [Const:
|
|
952
|
+
'Query: [LiftPropBy: [Const: meta:note, Const: =, Const: abcd], CmdOper: [Const: noderefs, List: [Const: -d, Const: 2, Const: --join]]]',
|
|
955
953
|
'Query: [CmdOper: [Const: help, Const: ()]]',
|
|
956
954
|
'Query: [CmdOper: [Const: iden, List: [Const: 2cdd997872b10a65407ad5fadfa28e0d]]]',
|
|
957
955
|
'Query: [CmdOper: [Const: iden, List: [Const: deadb33f]]]',
|
|
@@ -1006,11 +1004,11 @@ _ParseResults = [
|
|
|
1006
1004
|
'Query: [LiftPropBy: [Const: meta:source, Const: =, Const: 8f1401de15918358d5247e21ca29a814]]',
|
|
1007
1005
|
'Query: [CmdOper: [Const: movetag, List: [Const: a.b, Const: a.m]]]',
|
|
1008
1006
|
'Query: [CmdOper: [Const: movetag, List: [Const: hehe, Const: woot]]]',
|
|
1009
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1010
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1011
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1012
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1013
|
-
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const:
|
|
1007
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PivotOut: [], isjoin=False]',
|
|
1008
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, FormPivot: [Const: geo:place], isjoin=False]',
|
|
1009
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, FiltOper: [Const: +, RelPropCond: [RelPropValue: [RelProp: [Const: time]], Const: @=, List: [Const: 2014, Const: 2017]]], FormPivot: [Const: geo:place], isjoin=False]',
|
|
1010
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PivotOut: [], isjoin=False]',
|
|
1011
|
+
'Query: [LiftPropBy: [Const: ps:person, Const: =, VarValue: [Const: pers]], FormPivot: [Const: meta:seen], isjoin=False, PropPivotOut: [RelProp: [Const: node]], isjoin=False]',
|
|
1014
1012
|
'Query: [CmdOper: [Const: reindex, List: [Const: --form-counts]]]',
|
|
1015
1013
|
'Query: [CmdOper: [Const: sudo, Const: ()], EditNodeAdd: [FormName: [Const: inet:ipv4], Const: =, Const: 1.2.3.4]]',
|
|
1016
1014
|
'Query: [CmdOper: [Const: sudo, Const: ()], EditNodeAdd: [FormName: [Const: test:cycle0], Const: =, Const: foo], EditPropSet: [RelProp: [Const: test:cycle1], Const: =, Const: bar]]',
|
|
@@ -1160,12 +1158,12 @@ _ParseResults = [
|
|
|
1160
1158
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: bar], PivotIn: [], isjoin=False]',
|
|
1161
1159
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: bar], LiftPropBy: [Const: test:pivcomp, Const: =, List: [Const: foo, Const: bar]], EditTagAdd: [TagName: [Const: test, Const: bar]]]',
|
|
1162
1160
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], FiltOper: [Const: +, TagValuCond: [TagMatch: [Const: lol], Const: @=, Const: 2016]]]',
|
|
1163
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const:
|
|
1164
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const:
|
|
1161
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const: meta:seen], isjoin=True]',
|
|
1162
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], PivotInFrom: [Const: meta:seen], isjoin=False]',
|
|
1165
1163
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foo], CmdOper: [Const: delnode, Const: ()]]',
|
|
1166
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1167
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1168
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const:
|
|
1164
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=True]',
|
|
1165
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: test:str], isjoin=True]',
|
|
1166
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: meta:seen], isjoin=False, PivotInFrom: [Const: test:str], isjoin=False]',
|
|
1169
1167
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: hello], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 2001]]',
|
|
1170
1168
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: hello], EditPropSet: [RelProp: [Const: tick], Const: =, Const: 2002]]',
|
|
1171
1169
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: pennywise], CmdOper: [Const: noderefs, List: [Const: --join, Const: -d, Const: 9, Const: --traverse-edge]]]',
|
|
@@ -1185,7 +1183,7 @@ _ParseResults = [
|
|
|
1185
1183
|
"Query: [ForLoop: [Const: foo, VarValue: [Const: foos], SubQuery: [Query: [VarListSetOper: [VarList: ['fqdn', 'ipv4'], FuncCall: [VarDeref: [VarValue: [Const: foo], Const: split], CallArgs: [Const: |], CallKwargs: []]], EditNodeAdd: [FormName: [Const: inet:dns:a], Const: =, List: [VarValue: [Const: fqdn], VarValue: [Const: ipv4]]]]]]]",
|
|
1186
1184
|
'Query: [ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [], CallKwargs: []], SubQuery: [Query: [FormPivot: [Const: test:int], isjoin=False, EditTagAdd: [TagName: [VarValue: [Const: tag]]]]]]]',
|
|
1187
1185
|
'Query: [ForLoop: [Const: tag, FuncCall: [VarDeref: [VarValue: [Const: node], Const: tags], CallArgs: [Const: fo*], CallKwargs: []], SubQuery: [Query: [FormPivot: [Const: test:int], isjoin=False, EditTagDel: [TagName: [VarValue: [Const: tag]]]]]]]',
|
|
1188
|
-
'Query: [EditNodeAdd: [FormName: [Const: inet:email:message], Const: =, Const: *], EditPropSet: [RelProp: [Const: to], Const: =, Const: woot@woot.com], EditPropSet: [RelProp: [Const: from], Const: =, Const: visi@vertex.link], EditPropSet: [RelProp: [Const: replyto], Const: =, Const: root@root.com], EditPropSet: [RelProp: [Const: subject], Const: =, Const: hi there], EditPropSet: [RelProp: [Const: date], Const: =, Const: 2015], EditPropSet: [RelProp: [Const: body], Const: =, Const: there are mad sploitz here!], EditPropSet: [RelProp: [Const: bytes], Const: =, Const: *], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:link], Const: =, List: [VarValue: [Const: node], Const: https://www.vertex.link]]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:attachment], Const: =, List: [VarValue: [Const: node], Const: *]], FiltOper: [Const: -, HasAbsPropCond: [Const: inet:email:message]], EditPropSet: [RelProp: [Const: name], Const: =, Const: sploit.exe]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const:
|
|
1186
|
+
'Query: [EditNodeAdd: [FormName: [Const: inet:email:message], Const: =, Const: *], EditPropSet: [RelProp: [Const: to], Const: =, Const: woot@woot.com], EditPropSet: [RelProp: [Const: from], Const: =, Const: visi@vertex.link], EditPropSet: [RelProp: [Const: replyto], Const: =, Const: root@root.com], EditPropSet: [RelProp: [Const: subject], Const: =, Const: hi there], EditPropSet: [RelProp: [Const: date], Const: =, Const: 2015], EditPropSet: [RelProp: [Const: body], Const: =, Const: there are mad sploitz here!], EditPropSet: [RelProp: [Const: bytes], Const: =, Const: *], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:link], Const: =, List: [VarValue: [Const: node], Const: https://www.vertex.link]]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: inet:email:message:attachment], Const: =, List: [VarValue: [Const: node], Const: *]], FiltOper: [Const: -, HasAbsPropCond: [Const: inet:email:message]], EditPropSet: [RelProp: [Const: name], Const: =, Const: sploit.exe]]], SubQuery: [Query: [EditNodeAdd: [FormName: [Const: meta:seen], Const: =, List: [VarValue: [Const: node], List: [Const: inet:email:header, List: [Const: to, Const: Visi Kensho <visi@vertex.link>]]]]]]]',
|
|
1189
1187
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [Const: 1, Const: /, Const: 3]]]]',
|
|
1190
1188
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [Const: 1, Const: *, Const: 3]]]]',
|
|
1191
1189
|
'Query: [SetVarOper: [Const: x, DollarExpr: [ExprNode: [ExprNode: [Const: 1, Const: *, Const: 3], Const: +, Const: 2]]]]',
|
|
@@ -1313,18 +1311,18 @@ _ParseResults = [
|
|
|
1313
1311
|
'Query: [LiftPropBy: [VarValue: [Const: form], Const: =, VarValue: [Const: valu]]]',
|
|
1314
1312
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns*], isjoin=False]',
|
|
1315
1313
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns:*], isjoin=False]',
|
|
1316
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1317
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1314
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns:a]], isjoin=False]',
|
|
1315
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns*]], isjoin=False]',
|
|
1318
1316
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [VarValue: [Const: foo]], isjoin=False]',
|
|
1319
1317
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns*], isjoin=True]',
|
|
1320
1318
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [Const: inet:dns:*], isjoin=True]',
|
|
1321
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1322
|
-
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const:
|
|
1319
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns:a]], isjoin=True]',
|
|
1320
|
+
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [List: [Const: meta:seen, Const: inet:dns*]], isjoin=True]',
|
|
1323
1321
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], FormPivot: [VarValue: [Const: foo]], isjoin=True]',
|
|
1324
1322
|
'Query: [LiftPropBy: [Const: test:str, Const: =, Const: foobar], N1Walk: [Const: refs, Const: inet:dns:*], isjoin=False]',
|
|
1325
|
-
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const:
|
|
1323
|
+
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const: meta:seen, Const: inet:dns:a]], isjoin=False]',
|
|
1326
1324
|
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], VarValue: [Const: foo]], isjoin=False]',
|
|
1327
|
-
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const:
|
|
1325
|
+
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], List: [Const: meta:seen, Const: inet:dns:a]], isjoin=True]',
|
|
1328
1326
|
'Query: [LiftPropBy: [Const: inet:fqdn, Const: =, Const: foo.com], PropPivot: [RelPropValue: [RelProp: [Const: zone]], VarValue: [Const: foo]], isjoin=True]',
|
|
1329
1327
|
'Query: [LiftFormTag: [Const: test:*, TagName: [Const: foo]]]',
|
|
1330
1328
|
'Query: [LiftFormTag: [Const: test:*, TagName: [Const: foo], Const: @=, Const: 2016]]',
|
|
@@ -1385,13 +1383,13 @@ class GrammarTest(s_t_utils.SynTest):
|
|
|
1385
1383
|
self.eq(str(tree), _ParseResults[i])
|
|
1386
1384
|
|
|
1387
1385
|
def test_cmdrargs(self):
|
|
1388
|
-
q = '''add {inet:fqdn | graph 2 --filter { -#nope } } inet:f-M +1 { [
|
|
1386
|
+
q = '''add {inet:fqdn | graph 2 --filter { -#nope } } inet:f-M +1 { [ meta:note='*' :type=m1]}'''
|
|
1389
1387
|
correct = (
|
|
1390
1388
|
'add',
|
|
1391
1389
|
'inet:fqdn | graph 2 --filter { -#nope }',
|
|
1392
1390
|
'inet:f-M',
|
|
1393
1391
|
'+1',
|
|
1394
|
-
"[
|
|
1392
|
+
"[ meta:note='*' :type=m1]"
|
|
1395
1393
|
)
|
|
1396
1394
|
parser = s_parser.Parser(q)
|
|
1397
1395
|
args = parser.cmdrargs()
|
|
@@ -902,7 +902,7 @@ class HttpApiTest(s_tests.SynTest):
|
|
|
902
902
|
self.eq(info['creator'], root.iden)
|
|
903
903
|
self.eq(info['iden'], view)
|
|
904
904
|
|
|
905
|
-
cdef = await core.callStorm('return($lib.cron.add(query="{
|
|
905
|
+
cdef = await core.callStorm('return($lib.cron.add(query="{meta:note=*}", hourly=30).pack())')
|
|
906
906
|
layr = await core.callStorm('return($lib.layer.add().iden)')
|
|
907
907
|
|
|
908
908
|
opts = {'vars': {'view': view, 'cron': cdef['iden'], 'layr': layr}}
|
synapse/tests/test_lib_rstorm.py
CHANGED
|
@@ -206,7 +206,7 @@ multiline00_input = '''
|
|
|
206
206
|
A multiline secondary property.
|
|
207
207
|
.. storm-cortex:: default
|
|
208
208
|
.. storm-opts:: {"vars": {"name": "Node\\nWith a\\nweird name"}}
|
|
209
|
-
.. storm:: [
|
|
209
|
+
.. storm:: [meta:note=(n1,) :text=$name]
|
|
210
210
|
Bye!
|
|
211
211
|
'''
|
|
212
212
|
|
|
@@ -214,9 +214,9 @@ multiline00_output = '''
|
|
|
214
214
|
A multiline secondary property.
|
|
215
215
|
::
|
|
216
216
|
|
|
217
|
-
> [
|
|
218
|
-
|
|
219
|
-
:
|
|
217
|
+
> [meta:note=(n1,) :text=$name]
|
|
218
|
+
meta:note=85d3511b97098d7fd9e07be21f6390de
|
|
219
|
+
:text = Node
|
|
220
220
|
With a
|
|
221
221
|
weird name
|
|
222
222
|
|
synapse/tests/test_lib_storm.py
CHANGED
|
@@ -1262,7 +1262,7 @@ class StormTest(s_t_utils.SynTest):
|
|
|
1262
1262
|
query = await core.getStormQuery('')
|
|
1263
1263
|
async with snap.getStormRuntime(query) as runt:
|
|
1264
1264
|
with self.raises(s_exc.AuthDeny):
|
|
1265
|
-
runt.reqAdmin(gateiden=
|
|
1265
|
+
runt.reqAdmin(gateiden=layr)
|
|
1266
1266
|
|
|
1267
1267
|
await core.stormlist('[ inet:fqdn=vertex.link ]')
|
|
1268
1268
|
fork = await core.callStorm('return($lib.view.get().fork().iden)')
|
|
@@ -1772,13 +1772,92 @@ class StormTest(s_t_utils.SynTest):
|
|
|
1772
1772
|
self.eq('796d67b92a6ffe9b88fa19d115b46ab6712d673a06ae602d41de84b1464782f2', node[1]['embeds']['asn']['*'])
|
|
1773
1773
|
|
|
1774
1774
|
opts = {'embeds': {'ou:org': {'hq::email': ('user',)}}}
|
|
1775
|
-
msgs = await core.stormlist('[ ou:org=* :hq=* ] { -> ps:contact [ :email=visi@vertex.link ] }', opts=opts)
|
|
1775
|
+
msgs = await core.stormlist('[ ou:org=* :country=* :hq=* ] { -> ps:contact [ :email=visi@vertex.link ] }', opts=opts)
|
|
1776
1776
|
nodes = [m[1] for m in msgs if m[0] == 'node']
|
|
1777
|
-
|
|
1778
1777
|
node = nodes[0]
|
|
1778
|
+
|
|
1779
1779
|
self.eq('visi', node[1]['embeds']['hq::email']['user'])
|
|
1780
1780
|
self.eq('2346d7bed4b0fae05e00a413bbf8716c9e08857eb71a1ecf303b8972823f2899', node[1]['embeds']['hq::email']['*'])
|
|
1781
1781
|
|
|
1782
|
+
fork = await core.callStorm('return($lib.view.get().fork().iden)')
|
|
1783
|
+
|
|
1784
|
+
opts['vars'] = {
|
|
1785
|
+
'md5': '12345a5758eea935f817dd1490a322a5',
|
|
1786
|
+
'sha1': '40b8e76cff472e593bd0ba148c09fec66ae72362'
|
|
1787
|
+
}
|
|
1788
|
+
opts['view'] = fork
|
|
1789
|
+
opts['show:storage'] = True
|
|
1790
|
+
opts['embeds']['ou:org']['lol::nope'] = ('notreal',)
|
|
1791
|
+
opts['embeds']['ou:org']['country::flag'] = ('md5', 'sha1')
|
|
1792
|
+
opts['embeds']['ou:org']['country::tld'] = ('domain',)
|
|
1793
|
+
|
|
1794
|
+
await core.stormlist('pol:country [ :flag={[ file:bytes=* :md5=fa818a259cbed7ce8bc2a22d35a464fc ]} ]')
|
|
1795
|
+
|
|
1796
|
+
msgs = await core.stormlist('''
|
|
1797
|
+
ou:org {
|
|
1798
|
+
-> pol:country
|
|
1799
|
+
[ :tld=co.uk ]
|
|
1800
|
+
{
|
|
1801
|
+
:flag -> file:bytes [ :md5=$md5 :sha1=$sha1 ]
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
''', opts=opts)
|
|
1805
|
+
nodes = [m[1] for m in msgs if m[0] == 'node']
|
|
1806
|
+
node = nodes[0]
|
|
1807
|
+
|
|
1808
|
+
storage = node[1]['storage']
|
|
1809
|
+
self.len(2, storage)
|
|
1810
|
+
top = storage[0].get('embeds')
|
|
1811
|
+
bot = storage[1].get('embeds')
|
|
1812
|
+
self.nn(top)
|
|
1813
|
+
self.nn(bot)
|
|
1814
|
+
|
|
1815
|
+
self.nn(top.get('country::flag::md5'))
|
|
1816
|
+
self.eq(top['country::flag::md5'][0], '12345a5758eea935f817dd1490a322a5')
|
|
1817
|
+
|
|
1818
|
+
self.nn(top.get('country::flag::sha1'))
|
|
1819
|
+
self.eq(top['country::flag::sha1'][0], '40b8e76cff472e593bd0ba148c09fec66ae72362')
|
|
1820
|
+
|
|
1821
|
+
self.nn(top.get('country::tld::domain'))
|
|
1822
|
+
self.eq(top['country::tld::domain'][0], 'uk')
|
|
1823
|
+
|
|
1824
|
+
self.nn(bot.get('hq::email::user'))
|
|
1825
|
+
self.eq(bot['hq::email::user'][0], 'visi')
|
|
1826
|
+
|
|
1827
|
+
self.nn(bot.get('country::flag::md5'))
|
|
1828
|
+
self.eq(bot['country::flag::md5'][0], 'fa818a259cbed7ce8bc2a22d35a464fc')
|
|
1829
|
+
|
|
1830
|
+
empty = await core.callStorm('return($lib.view.get().fork().iden)', opts=opts)
|
|
1831
|
+
opts['view'] = empty
|
|
1832
|
+
|
|
1833
|
+
msgs = await core.stormlist('ou:org', opts=opts)
|
|
1834
|
+
nodes = [m[1] for m in msgs if m[0] == 'node']
|
|
1835
|
+
node = nodes[0]
|
|
1836
|
+
storage = node[1]['storage']
|
|
1837
|
+
self.len(3, storage)
|
|
1838
|
+
top = storage[0].get('embeds')
|
|
1839
|
+
mid = storage[1].get('embeds')
|
|
1840
|
+
bot = storage[2].get('embeds')
|
|
1841
|
+
self.none(top)
|
|
1842
|
+
|
|
1843
|
+
self.nn(mid)
|
|
1844
|
+
self.nn(bot)
|
|
1845
|
+
|
|
1846
|
+
self.nn(mid.get('country::flag::md5'))
|
|
1847
|
+
self.eq(mid['country::flag::md5'][0], '12345a5758eea935f817dd1490a322a5')
|
|
1848
|
+
|
|
1849
|
+
self.nn(mid.get('country::flag::sha1'))
|
|
1850
|
+
self.eq(mid['country::flag::sha1'][0], '40b8e76cff472e593bd0ba148c09fec66ae72362')
|
|
1851
|
+
|
|
1852
|
+
self.nn(mid.get('country::tld::domain'))
|
|
1853
|
+
self.eq(mid['country::tld::domain'][0], 'uk')
|
|
1854
|
+
|
|
1855
|
+
self.nn(bot.get('hq::email::user'))
|
|
1856
|
+
self.eq(bot['hq::email::user'][0], 'visi')
|
|
1857
|
+
|
|
1858
|
+
self.nn(bot.get('country::flag::md5'))
|
|
1859
|
+
self.eq(bot['country::flag::md5'][0], 'fa818a259cbed7ce8bc2a22d35a464fc')
|
|
1860
|
+
|
|
1782
1861
|
async def test_storm_wget(self):
|
|
1783
1862
|
|
|
1784
1863
|
async def _getRespFromSha(core, mesgs):
|
|
@@ -2151,7 +2230,7 @@ class StormTest(s_t_utils.SynTest):
|
|
|
2151
2230
|
|
|
2152
2231
|
# Max recursion fail
|
|
2153
2232
|
q = '[ inet:fqdn=www.vertex.link ] | tree { inet:fqdn=www.vertex.link }'
|
|
2154
|
-
await self.asyncraises(s_exc.
|
|
2233
|
+
await self.asyncraises(s_exc.RecursionLimitHit, core.nodes(q))
|
|
2155
2234
|
|
|
2156
2235
|
# Runtsafety test
|
|
2157
2236
|
q = '[ inet:fqdn=www.vertex.link ] $q=:domain | tree $q'
|
|
@@ -2359,6 +2438,18 @@ class StormTest(s_t_utils.SynTest):
|
|
|
2359
2438
|
with self.raises(s_exc.BadOperArg):
|
|
2360
2439
|
await core.nodes('movetag this is')
|
|
2361
2440
|
|
|
2441
|
+
async with self.getTestCore() as core:
|
|
2442
|
+
await core.nodes('[ syn:tag=hehe :isnow=haha ]')
|
|
2443
|
+
nodes = await core.nodes('[ ou:org=* +#hehe.qwer ]')
|
|
2444
|
+
self.len(1, nodes)
|
|
2445
|
+
self.nn(nodes[0].getTag('haha.qwer'))
|
|
2446
|
+
self.none(nodes[0].getTag('hehe.qwer'))
|
|
2447
|
+
self.len(1, await core.nodes('syn:tag=haha.qwer'))
|
|
2448
|
+
|
|
2449
|
+
# this should hit the already existing redirected tag now...
|
|
2450
|
+
nodes = await core.nodes('[ ou:org=* +#hehe.qwer ]')
|
|
2451
|
+
self.len(1, nodes)
|
|
2452
|
+
|
|
2362
2453
|
# Sad path
|
|
2363
2454
|
async with self.getTestCore() as core:
|
|
2364
2455
|
# Test moving a tag to itself
|
|
@@ -2414,9 +2505,9 @@ class StormTest(s_t_utils.SynTest):
|
|
|
2414
2505
|
nodes = await core.nodes('test:comp $valu=({"foo": :hehe}) | uniq $valu')
|
|
2415
2506
|
self.len(1, nodes)
|
|
2416
2507
|
q = '''
|
|
2417
|
-
[(
|
|
2418
|
-
(
|
|
2419
|
-
(
|
|
2508
|
+
[(tel:mob:telem=(n1,) :data=(({'hehe': 'haha', 'foo': 'bar'}),))
|
|
2509
|
+
(tel:mob:telem=(n2,) :data=(({'hehe': 'haha', 'foo': 'baz'}),))
|
|
2510
|
+
(tel:mob:telem=(n3,) :data=(({'foo': 'bar', 'hehe': 'haha'}),))]
|
|
2420
2511
|
uniq :data
|
|
2421
2512
|
'''
|
|
2422
2513
|
nodes = await core.nodes(q)
|