synapse 2.169.0__py311-none-any.whl → 2.171.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/cortex.py +99 -3
- synapse/datamodel.py +5 -0
- synapse/lib/ast.py +70 -12
- synapse/lib/cell.py +76 -7
- synapse/lib/layer.py +75 -6
- synapse/lib/lmdbslab.py +17 -0
- synapse/lib/node.py +7 -0
- synapse/lib/snap.py +22 -4
- synapse/lib/storm.py +1 -1
- synapse/lib/stormlib/cortex.py +1 -1
- synapse/lib/stormlib/model.py +339 -40
- synapse/lib/stormtypes.py +58 -1
- synapse/lib/types.py +36 -1
- synapse/lib/version.py +2 -2
- synapse/lib/view.py +94 -15
- synapse/models/files.py +40 -0
- synapse/models/inet.py +8 -4
- synapse/models/infotech.py +355 -17
- synapse/tests/files/cpedata.json +525034 -0
- synapse/tests/test_cortex.py +108 -0
- synapse/tests/test_lib_ast.py +66 -0
- synapse/tests/test_lib_cell.py +112 -0
- synapse/tests/test_lib_layer.py +52 -1
- synapse/tests/test_lib_lmdbslab.py +36 -0
- synapse/tests/test_lib_scrape.py +72 -71
- synapse/tests/test_lib_snap.py +16 -1
- synapse/tests/test_lib_storm.py +118 -0
- synapse/tests/test_lib_stormlib_cortex.py +15 -0
- synapse/tests/test_lib_stormlib_model.py +427 -0
- synapse/tests/test_lib_stormtypes.py +147 -15
- synapse/tests/test_lib_types.py +21 -0
- synapse/tests/test_lib_view.py +77 -0
- synapse/tests/test_model_files.py +52 -0
- synapse/tests/test_model_inet.py +63 -1
- synapse/tests/test_model_infotech.py +187 -26
- synapse/tests/utils.py +42 -9
- {synapse-2.169.0.dist-info → synapse-2.171.0.dist-info}/METADATA +1 -1
- {synapse-2.169.0.dist-info → synapse-2.171.0.dist-info}/RECORD +41 -40
- {synapse-2.169.0.dist-info → synapse-2.171.0.dist-info}/LICENSE +0 -0
- {synapse-2.169.0.dist-info → synapse-2.171.0.dist-info}/WHEEL +0 -0
- {synapse-2.169.0.dist-info → synapse-2.171.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import hashlib
|
|
2
3
|
|
|
3
4
|
import synapse.exc as s_exc
|
|
4
5
|
import synapse.common as s_common
|
|
5
6
|
|
|
7
|
+
import synapse.lib.scrape as s_scrape
|
|
8
|
+
|
|
6
9
|
import synapse.models.crypto as s_m_crypto
|
|
7
10
|
|
|
11
|
+
import synapse.tests.files as s_t_files
|
|
8
12
|
import synapse.tests.utils as s_t_utils
|
|
13
|
+
import synapse.tests.test_lib_scrape as s_t_scrape
|
|
9
14
|
|
|
10
15
|
class InfotechModelTest(s_t_utils.SynTest):
|
|
11
16
|
|
|
@@ -27,28 +32,6 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
27
32
|
self.eq(nodes[0].get('url'), 'https://cwe.mitre.org/data/definitions/120.html')
|
|
28
33
|
self.eq(nodes[0].get('parents'), ('CWE-119',))
|
|
29
34
|
|
|
30
|
-
self.eq(r'foo\:bar', core.model.type('it:sec:cpe').norm(r'cpe:2.3:a:foo\:bar:*:*:*:*:*:*:*:*:*')[1]['subs']['vendor'])
|
|
31
|
-
|
|
32
|
-
with self.raises(s_exc.BadTypeValu):
|
|
33
|
-
nodes = await core.nodes('[it:sec:cpe=asdf]')
|
|
34
|
-
|
|
35
|
-
with self.raises(s_exc.BadTypeValu):
|
|
36
|
-
nodes = await core.nodes('[it:sec:cpe=cpe:2.3:1:2:3:4:5:6:7:8:9:10:11:12]')
|
|
37
|
-
|
|
38
|
-
nodes = await core.nodes('[ it:sec:cpe=cpe:2.3:vertex:synapse ]')
|
|
39
|
-
self.eq(nodes[0].ndef, ('it:sec:cpe', 'cpe:2.3:vertex:synapse:*:*:*:*:*:*:*:*:*'))
|
|
40
|
-
|
|
41
|
-
nodes = await core.nodes('''[
|
|
42
|
-
it:sec:cpe=cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*
|
|
43
|
-
]''')
|
|
44
|
-
self.len(1, nodes)
|
|
45
|
-
self.eq(nodes[0].ndef, ('it:sec:cpe', 'cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*'))
|
|
46
|
-
self.eq(nodes[0].get('part'), 'a')
|
|
47
|
-
self.eq(nodes[0].get('vendor'), 'microsoft')
|
|
48
|
-
self.eq(nodes[0].get('product'), 'internet_explorer')
|
|
49
|
-
self.eq(nodes[0].get('version'), '8.0.6001')
|
|
50
|
-
self.eq(nodes[0].get('update'), 'beta')
|
|
51
|
-
|
|
52
35
|
nodes = await core.nodes('''[
|
|
53
36
|
it:mitre:attack:group=G0100
|
|
54
37
|
:org={[ ou:org=* :name=visicorp ]}
|
|
@@ -75,6 +58,42 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
75
58
|
self.eq(nodes[0].get('techniques'), ('T0100', 'T0200'))
|
|
76
59
|
self.eq(nodes[0].get('isnow'), 'G0110')
|
|
77
60
|
|
|
61
|
+
desc = 'A database and set of services that allows administrators to manage permissions, access to network '
|
|
62
|
+
desc += 'resources, and stored data objects (user, group, application, or devices)(Citation: Microsoft AD '
|
|
63
|
+
desc += 'DS Getting Started)'
|
|
64
|
+
refs = (
|
|
65
|
+
'https://attack.mitre.org/datasources/DS0026',
|
|
66
|
+
'https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/ad-ds-getting-started',
|
|
67
|
+
)
|
|
68
|
+
q = f'''
|
|
69
|
+
[ it:mitre:attack:datasource=DS0026
|
|
70
|
+
:name="Active Directory"
|
|
71
|
+
:description="{desc}"
|
|
72
|
+
:references=({",".join(refs)})
|
|
73
|
+
]
|
|
74
|
+
'''
|
|
75
|
+
nodes = await core.nodes(q)
|
|
76
|
+
self.len(1, nodes)
|
|
77
|
+
self.eq(nodes[0].ndef, ('it:mitre:attack:datasource', 'DS0026'))
|
|
78
|
+
self.eq(nodes[0].get('name'), 'active directory')
|
|
79
|
+
self.eq(nodes[0].get('description'), desc)
|
|
80
|
+
self.eq(nodes[0].get('references'), refs)
|
|
81
|
+
|
|
82
|
+
q = f'''
|
|
83
|
+
[ it:mitre:attack:data:component=(DS0026, "Active Directory Credential Request")
|
|
84
|
+
:name="Active Directory Credential Request"
|
|
85
|
+
:description="{desc}"
|
|
86
|
+
:datasource=DS0026
|
|
87
|
+
] -+> it:mitre:attack:datasource
|
|
88
|
+
'''
|
|
89
|
+
nodes = await core.nodes(q)
|
|
90
|
+
self.len(2, nodes)
|
|
91
|
+
self.eq(nodes[0].get('name'), 'active directory credential request')
|
|
92
|
+
self.eq(nodes[0].get('description'), desc)
|
|
93
|
+
self.eq(nodes[0].get('datasource'), 'DS0026')
|
|
94
|
+
self.eq(nodes[1].ndef, ('it:mitre:attack:datasource', 'DS0026'))
|
|
95
|
+
dcguid = nodes[0].ndef[1]
|
|
96
|
+
|
|
78
97
|
nodes = await core.nodes('''[
|
|
79
98
|
it:mitre:attack:tactic=TA0100
|
|
80
99
|
:name=tactilneck
|
|
@@ -105,8 +124,10 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
105
124
|
:isnow=T1110
|
|
106
125
|
:tactics=(TA0200,TA0100,TA0100)
|
|
107
126
|
:matrix=enterprise
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
:data:components+={ it:mitre:attack:data:component=(DS0026, "Active Directory Credential Request") }
|
|
128
|
+
] -+> it:mitre:attack:data:component
|
|
129
|
+
''')
|
|
130
|
+
self.len(2, nodes)
|
|
110
131
|
self.eq(nodes[0].ndef, ('it:mitre:attack:technique', 'T0100'))
|
|
111
132
|
self.eq(nodes[0].get('name'), 'lockpicking')
|
|
112
133
|
self.eq(nodes[0].get('desc'), 'speedhackers')
|
|
@@ -118,6 +139,8 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
118
139
|
self.eq(nodes[0].get('status'), 'deprecated')
|
|
119
140
|
self.eq(nodes[0].get('isnow'), 'T1110')
|
|
120
141
|
self.eq(nodes[0].get('matrix'), 'enterprise')
|
|
142
|
+
self.eq(nodes[0].get('data:components'), [dcguid])
|
|
143
|
+
self.eq(nodes[1].ndef, ('it:mitre:attack:data:component', dcguid))
|
|
121
144
|
|
|
122
145
|
nodes = await core.nodes('''[
|
|
123
146
|
it:mitre:attack:software=S0100
|
|
@@ -991,24 +1014,28 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
991
1014
|
async with self.getTestCore() as core:
|
|
992
1015
|
nodes = await core.nodes('''[
|
|
993
1016
|
it:prod:hardware=*
|
|
1017
|
+
:manufacturer={ gen.ou.org dell }
|
|
1018
|
+
:manufacturer:name=dell
|
|
994
1019
|
:make=dell
|
|
995
1020
|
:model=XPS13
|
|
996
1021
|
:version=alpha
|
|
997
1022
|
:type=pc.laptop
|
|
998
1023
|
:desc=WootWoot
|
|
999
1024
|
:released=20220202
|
|
1000
|
-
:cpe=cpe:2.3:h:dell:xps13
|
|
1025
|
+
:cpe=cpe:2.3:h:dell:xps13:*:*:*:*:*:*:*:*
|
|
1001
1026
|
:parts = (*, *)
|
|
1002
1027
|
]''')
|
|
1003
1028
|
self.eq('WootWoot', nodes[0].props['desc'])
|
|
1004
1029
|
self.eq('dell', nodes[0].props['make'])
|
|
1005
1030
|
self.eq('xps13', nodes[0].props['model'])
|
|
1006
1031
|
self.eq('alpha', nodes[0].props['version'])
|
|
1007
|
-
self.eq('cpe:2.3:h:dell:xps13
|
|
1032
|
+
self.eq('cpe:2.3:h:dell:xps13:*:*:*:*:*:*:*:*', nodes[0].props['cpe'])
|
|
1008
1033
|
self.eq(1643760000000, nodes[0].props['released'])
|
|
1009
1034
|
self.len(1, await core.nodes('it:prod:hardware :make -> ou:name'))
|
|
1010
1035
|
self.len(1, await core.nodes('it:prod:hardware :type -> it:prod:hardwaretype'))
|
|
1011
1036
|
self.len(2, await core.nodes('it:prod:hardware:make=dell -> it:prod:hardware'))
|
|
1037
|
+
self.eq('dell', nodes[0].props['manufacturer:name'])
|
|
1038
|
+
self.len(1, await core.nodes('it:prod:hardware -> ou:org +:name=dell'))
|
|
1012
1039
|
|
|
1013
1040
|
nodes = await core.nodes('''[
|
|
1014
1041
|
it:prod:component=*
|
|
@@ -1518,6 +1545,51 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
1518
1545
|
async def test_infotech_cpes(self):
|
|
1519
1546
|
|
|
1520
1547
|
async with self.getTestCore() as core:
|
|
1548
|
+
self.eq(r'foo:bar', core.model.type('it:sec:cpe').norm(r'cpe:2.3:a:foo\:bar:*:*:*:*:*:*:*:*:*')[1]['subs']['vendor'])
|
|
1549
|
+
|
|
1550
|
+
with self.raises(s_exc.BadTypeValu):
|
|
1551
|
+
nodes = await core.nodes('[it:sec:cpe=asdf]')
|
|
1552
|
+
|
|
1553
|
+
with self.raises(s_exc.BadTypeValu):
|
|
1554
|
+
await core.callStorm('[ it:sec:cpe="cpe:2.3:a:vendor001:product-foo" :v2_2="cpe:/a:vendor:product\\foo" ]')
|
|
1555
|
+
|
|
1556
|
+
with self.raises(s_exc.BadTypeValu):
|
|
1557
|
+
await core.callStorm('[ it:sec:cpe="cpe:/a:vend🙃:prod:vers" ]')
|
|
1558
|
+
|
|
1559
|
+
with self.raises(s_exc.BadTypeValu):
|
|
1560
|
+
nodes = await core.nodes('[it:sec:cpe=cpe:2.3:1:2:3:4:5:6:7:8:9:10:11:12]')
|
|
1561
|
+
|
|
1562
|
+
nodes = await core.nodes('[ it:sec:cpe=cpe:2.3:a:vertex:synapse ]')
|
|
1563
|
+
self.eq(nodes[0].ndef, ('it:sec:cpe', 'cpe:2.3:a:vertex:synapse:*:*:*:*:*:*:*:*'))
|
|
1564
|
+
|
|
1565
|
+
nodes = await core.nodes('''[
|
|
1566
|
+
it:sec:cpe=cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*
|
|
1567
|
+
]''')
|
|
1568
|
+
self.len(1, nodes)
|
|
1569
|
+
self.eq(nodes[0].ndef, ('it:sec:cpe', 'cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*'))
|
|
1570
|
+
self.eq(nodes[0].get('part'), 'a')
|
|
1571
|
+
self.eq(nodes[0].get('vendor'), 'microsoft')
|
|
1572
|
+
self.eq(nodes[0].get('product'), 'internet_explorer')
|
|
1573
|
+
self.eq(nodes[0].get('version'), '8.0.6001')
|
|
1574
|
+
self.eq(nodes[0].get('update'), 'beta')
|
|
1575
|
+
|
|
1576
|
+
nodes = await core.nodes("[ it:sec:cpe='cpe:2.3:a:openbsd:openssh:7.4\r\n:*:*:*:*:*:*:*' ]")
|
|
1577
|
+
self.len(1, nodes)
|
|
1578
|
+
self.eq(nodes[0].ndef, ('it:sec:cpe', 'cpe:2.3:a:openbsd:openssh:7.4:*:*:*:*:*:*:*'))
|
|
1579
|
+
self.eq(nodes[0].get('part'), 'a')
|
|
1580
|
+
self.eq(nodes[0].get('product'), 'openssh')
|
|
1581
|
+
self.eq(nodes[0].get('vendor'), 'openbsd')
|
|
1582
|
+
self.eq(nodes[0].get('version'), '7.4')
|
|
1583
|
+
self.eq(nodes[0].get('v2_2'), 'cpe:/a:openbsd:openssh:7.4')
|
|
1584
|
+
|
|
1585
|
+
nodes = await core.nodes(r'[ it:sec:cpe="cpe:2.3:o:cisco:ios:12.1\(22\)ea1a:*:*:*:*:*:*:*" ]')
|
|
1586
|
+
self.len(1, nodes)
|
|
1587
|
+
self.eq(nodes[0].ndef, ('it:sec:cpe', r'cpe:2.3:o:cisco:ios:12.1\(22\)ea1a:*:*:*:*:*:*:*'))
|
|
1588
|
+
self.eq(nodes[0].get('part'), 'o')
|
|
1589
|
+
self.eq(nodes[0].get('product'), 'ios')
|
|
1590
|
+
self.eq(nodes[0].get('vendor'), 'cisco')
|
|
1591
|
+
self.eq(nodes[0].get('version'), '12.1(22)ea1a')
|
|
1592
|
+
self.eq(nodes[0].get('v2_2'), 'cpe:/o:cisco:ios:12.1%2822%29ea1a')
|
|
1521
1593
|
|
|
1522
1594
|
cpe23 = core.model.type('it:sec:cpe')
|
|
1523
1595
|
cpe22 = core.model.type('it:sec:cpe:v2_2')
|
|
@@ -1545,6 +1617,95 @@ class InfotechModelTest(s_t_utils.SynTest):
|
|
|
1545
1617
|
self.len(1, await core.nodes('it:sec:cpe:v2_2=cpe:/a:vertex:synapse'))
|
|
1546
1618
|
self.len(1, await core.nodes('it:sec:cpe:v2_2=cpe:2.3:a:vertex:synapse:*:*:*:*:*:*:*:*'))
|
|
1547
1619
|
|
|
1620
|
+
# Test cpe22 -> cpe23 escaping logic
|
|
1621
|
+
norm, info = cpe23.norm('cpe:/a:%21')
|
|
1622
|
+
self.eq(norm, 'cpe:2.3:a:\\!:*:*:*:*:*:*:*:*:*')
|
|
1623
|
+
|
|
1624
|
+
norm, info = cpe23.norm('cpe:/a:%5c%21')
|
|
1625
|
+
self.eq(norm, 'cpe:2.3:a:\\!:*:*:*:*:*:*:*:*:*')
|
|
1626
|
+
|
|
1627
|
+
norm, info = cpe23.norm('cpe:/a:%5cb')
|
|
1628
|
+
self.eq(norm, 'cpe:2.3:a:\\\\b:*:*:*:*:*:*:*:*:*')
|
|
1629
|
+
|
|
1630
|
+
norm, info = cpe23.norm('cpe:/a:b%5c')
|
|
1631
|
+
self.eq(norm, 'cpe:2.3:a:b\\\\:*:*:*:*:*:*:*:*:*')
|
|
1632
|
+
|
|
1633
|
+
norm, info = cpe23.norm('cpe:/a:b%5c%5c')
|
|
1634
|
+
self.eq(norm, 'cpe:2.3:a:b\\\\:*:*:*:*:*:*:*:*:*')
|
|
1635
|
+
|
|
1636
|
+
norm, info = cpe23.norm('cpe:/a:b%5c%5cb')
|
|
1637
|
+
self.eq(norm, 'cpe:2.3:a:b\\\\b:*:*:*:*:*:*:*:*:*')
|
|
1638
|
+
|
|
1639
|
+
# Examples based on customer reports
|
|
1640
|
+
q = '''
|
|
1641
|
+
[
|
|
1642
|
+
it:sec:cpe="cpe:/a:10web:social_feed_for_instagram:1.0.0::~~premium~wordpress~~"
|
|
1643
|
+
it:sec:cpe="cpe:/a:1c:1c%3aenterprise:-"
|
|
1644
|
+
it:sec:cpe="cpe:/a:acurax:under_construction_%2f_maintenance_mode:-::~~~wordpress~~"
|
|
1645
|
+
it:sec:cpe="cpe:/o:zyxel:nas326_firmware:5.21%28aazf.14%29c0"
|
|
1646
|
+
]
|
|
1647
|
+
'''
|
|
1648
|
+
msgs = await core.stormlist(q)
|
|
1649
|
+
self.stormHasNoWarnErr(msgs)
|
|
1650
|
+
|
|
1651
|
+
# Examples based on customer reports
|
|
1652
|
+
q = '''
|
|
1653
|
+
[
|
|
1654
|
+
it:sec:cpe="cpe:2.3:a:x1c:1c\\:enterprise:-:*:*:*:*:*:*:*"
|
|
1655
|
+
it:sec:cpe="cpe:2.3:a:xacurax:under_construction_\\/_maintenance_mode:-:*:*:*:*:wordpress:*:*"
|
|
1656
|
+
it:sec:cpe="cpe:2.3:o:xzyxel:nas326_firmware:5.21\\(aazf.14\\)c0:*:*:*:*:*:*:*"
|
|
1657
|
+
it:sec:cpe="cpe:2.3:a:vendor:product\\%45:version:update:edition:lng:sw_edition:target_sw:target_hw:other"
|
|
1658
|
+
it:sec:cpe="cpe:2.3:a:vendor2:product\\%23:version:update:edition:lng:sw_edition:target_sw:target_hw:other"
|
|
1659
|
+
]
|
|
1660
|
+
'''
|
|
1661
|
+
msgs = await core.stormlist(q)
|
|
1662
|
+
self.stormHasNoWarnErr(msgs)
|
|
1663
|
+
|
|
1664
|
+
nodes = await core.nodes('it:sec:cpe:vendor=vendor')
|
|
1665
|
+
self.len(1, nodes)
|
|
1666
|
+
self.eq(nodes[0].get('product'), 'product%45')
|
|
1667
|
+
|
|
1668
|
+
nodes = await core.nodes('it:sec:cpe:vendor=vendor2')
|
|
1669
|
+
self.len(1, nodes)
|
|
1670
|
+
self.eq(nodes[0].get('product'), 'product%23')
|
|
1671
|
+
|
|
1672
|
+
# Test 2.2->2.3 and 2.3->2.2 conversions
|
|
1673
|
+
filename = s_t_files.getAssetPath('cpedata.json')
|
|
1674
|
+
with open(filename, 'r') as fp:
|
|
1675
|
+
cpedata = json.load(fp)
|
|
1676
|
+
|
|
1677
|
+
for (_cpe22, _cpe23) in cpedata:
|
|
1678
|
+
# Convert cpe22 -> cpe23
|
|
1679
|
+
norm, info = cpe23.norm(_cpe22)
|
|
1680
|
+
self.eq(norm, _cpe23)
|
|
1681
|
+
|
|
1682
|
+
norm, info = cpe23.norm(_cpe23)
|
|
1683
|
+
self.eq(norm, _cpe23)
|
|
1684
|
+
|
|
1685
|
+
# No escaped characters in the secondary props
|
|
1686
|
+
for name, valu in info.items():
|
|
1687
|
+
if name == 'v2_2':
|
|
1688
|
+
continue
|
|
1689
|
+
|
|
1690
|
+
self.notin('\\', valu)
|
|
1691
|
+
|
|
1692
|
+
# Norm cpe23 and check the cpe22 conversion
|
|
1693
|
+
norm, info = cpe23.norm(_cpe23)
|
|
1694
|
+
v2_2 = info['subs']['v2_2']
|
|
1695
|
+
|
|
1696
|
+
norm, info = cpe22.norm(v2_2)
|
|
1697
|
+
self.eq(norm, _cpe22)
|
|
1698
|
+
|
|
1699
|
+
async def test_cpe_scrape_one_to_one(self):
|
|
1700
|
+
|
|
1701
|
+
async with self.getTestCore() as core:
|
|
1702
|
+
q = '[it:sec:cpe=$valu]'
|
|
1703
|
+
for _, valu in s_scrape.scrape(s_t_scrape.cpedata, ptype='it:sec:cpe'):
|
|
1704
|
+
nodes = await core.nodes(q, opts={'vars': {'valu': valu}})
|
|
1705
|
+
self.len(1, nodes)
|
|
1706
|
+
node = nodes[0]
|
|
1707
|
+
self.eq(node.ndef[1], valu.lower())
|
|
1708
|
+
|
|
1548
1709
|
async def test_infotech_c2config(self):
|
|
1549
1710
|
async with self.getTestCore() as core:
|
|
1550
1711
|
nodes = await core.nodes('''
|
synapse/tests/utils.py
CHANGED
|
@@ -96,6 +96,18 @@ def norm(z):
|
|
|
96
96
|
def deguidify(x):
|
|
97
97
|
return regex.sub('[0-9a-f]{32}', '*' * 32, x)
|
|
98
98
|
|
|
99
|
+
async def waitForBehold(core, events):
|
|
100
|
+
async for mesg in core.behold():
|
|
101
|
+
for event in list(events):
|
|
102
|
+
for key, valu in event.items():
|
|
103
|
+
if mesg.get(key) != valu:
|
|
104
|
+
break
|
|
105
|
+
else:
|
|
106
|
+
events.remove(event)
|
|
107
|
+
|
|
108
|
+
if len(events) == 0:
|
|
109
|
+
break
|
|
110
|
+
|
|
99
111
|
@contextlib.asynccontextmanager
|
|
100
112
|
async def matchContexts(testself):
|
|
101
113
|
origenter = s_base.Base.__aenter__
|
|
@@ -307,6 +319,17 @@ testmodel = {
|
|
|
307
319
|
('test:cycle1', ('str', {}), {}),
|
|
308
320
|
|
|
309
321
|
('test:ndef', ('ndef', {}), {}),
|
|
322
|
+
('test:ndef:formfilter1', ('ndef', {
|
|
323
|
+
'forms': ('inet:ipv4', 'inet:ipv6')
|
|
324
|
+
}), {}),
|
|
325
|
+
('test:ndef:formfilter2', ('ndef', {
|
|
326
|
+
'interfaces': ('meta:taxonomy',)
|
|
327
|
+
}), {}),
|
|
328
|
+
('test:ndef:formfilter3', ('ndef', {
|
|
329
|
+
'forms': ('inet:ipv4',),
|
|
330
|
+
'interfaces': ('file:mime:msoffice',)
|
|
331
|
+
}), {}),
|
|
332
|
+
|
|
310
333
|
('test:runt', ('str', {'lower': True, 'strip': True}), {'doc': 'A Test runt node'}),
|
|
311
334
|
('test:hasiface', ('str', {}), {'interfaces': ('test:interface',)}),
|
|
312
335
|
('test:hasiface2', ('str', {}), {'interfaces': ('test:interface',)}),
|
|
@@ -398,6 +421,7 @@ testmodel = {
|
|
|
398
421
|
('baz', ('nodeprop', {}), {}),
|
|
399
422
|
('tick', ('test:time', {}), {}),
|
|
400
423
|
('hehe', ('str', {}), {}),
|
|
424
|
+
('ndefs', ('array', {'type': 'ndef'}), {}),
|
|
401
425
|
)),
|
|
402
426
|
|
|
403
427
|
('test:migr', {}, (
|
|
@@ -1274,10 +1298,9 @@ class SynTest(unittest.TestCase):
|
|
|
1274
1298
|
s_cortex.Cortex: A Cortex object.
|
|
1275
1299
|
'''
|
|
1276
1300
|
if conf is None:
|
|
1277
|
-
conf = {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
}
|
|
1301
|
+
conf = {
|
|
1302
|
+
'health:sysctl:checks': False,
|
|
1303
|
+
}
|
|
1281
1304
|
|
|
1282
1305
|
conf = copy.deepcopy(conf)
|
|
1283
1306
|
|
|
@@ -1320,7 +1343,9 @@ class SynTest(unittest.TestCase):
|
|
|
1320
1343
|
async def getTestJsonStor(self, dirn=None, conf=None):
|
|
1321
1344
|
|
|
1322
1345
|
if conf is None:
|
|
1323
|
-
conf = {
|
|
1346
|
+
conf = {
|
|
1347
|
+
'health:sysctl:checks': False,
|
|
1348
|
+
}
|
|
1324
1349
|
conf = copy.deepcopy(conf)
|
|
1325
1350
|
|
|
1326
1351
|
with self.withNexusReplay():
|
|
@@ -1343,7 +1368,9 @@ class SynTest(unittest.TestCase):
|
|
|
1343
1368
|
s_cryotank.CryoCell: Test cryocell.
|
|
1344
1369
|
'''
|
|
1345
1370
|
if conf is None:
|
|
1346
|
-
conf = {
|
|
1371
|
+
conf = {
|
|
1372
|
+
'health:sysctl:checks': False,
|
|
1373
|
+
}
|
|
1347
1374
|
conf = copy.deepcopy(conf)
|
|
1348
1375
|
|
|
1349
1376
|
with self.withNexusReplay():
|
|
@@ -1387,7 +1414,9 @@ class SynTest(unittest.TestCase):
|
|
|
1387
1414
|
Get a test Cell.
|
|
1388
1415
|
'''
|
|
1389
1416
|
if conf is None:
|
|
1390
|
-
conf = {
|
|
1417
|
+
conf = {
|
|
1418
|
+
'health:sysctl:checks': False,
|
|
1419
|
+
}
|
|
1391
1420
|
|
|
1392
1421
|
conf = copy.deepcopy(conf)
|
|
1393
1422
|
|
|
@@ -1426,7 +1455,9 @@ class SynTest(unittest.TestCase):
|
|
|
1426
1455
|
async def getTestAha(self, conf=None, dirn=None):
|
|
1427
1456
|
|
|
1428
1457
|
if conf is None:
|
|
1429
|
-
conf = {
|
|
1458
|
+
conf = {
|
|
1459
|
+
'health:sysctl:checks': False,
|
|
1460
|
+
}
|
|
1430
1461
|
conf = copy.deepcopy(conf)
|
|
1431
1462
|
|
|
1432
1463
|
with self.withNexusReplay():
|
|
@@ -1500,7 +1531,9 @@ class SynTest(unittest.TestCase):
|
|
|
1500
1531
|
onetime = await aha.addAhaSvcProv(svcname, provinfo=provinfo)
|
|
1501
1532
|
|
|
1502
1533
|
if conf is None:
|
|
1503
|
-
conf = {
|
|
1534
|
+
conf = {
|
|
1535
|
+
'health:sysctl:checks': False,
|
|
1536
|
+
}
|
|
1504
1537
|
|
|
1505
1538
|
conf['aha:provision'] = onetime
|
|
1506
1539
|
|