synapse 2.199.0__py311-none-any.whl → 2.201.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 +0 -6
- synapse/datamodel.py +10 -4
- synapse/lib/agenda.py +24 -5
- synapse/lib/ast.py +7 -10
- synapse/lib/hive.py +1 -265
- synapse/lib/schemas.py +1 -0
- synapse/lib/snap.py +2 -8
- synapse/lib/storm.py +20 -10
- synapse/lib/version.py +2 -2
- synapse/models/dns.py +1 -1
- synapse/models/economic.py +23 -23
- synapse/models/files.py +2 -2
- synapse/models/inet.py +2 -2
- synapse/models/infotech.py +7 -7
- synapse/models/person.py +1 -1
- synapse/models/proj.py +3 -2
- synapse/models/risk.py +1 -1
- synapse/models/transport.py +3 -3
- synapse/tests/test_cortex.py +3 -6
- synapse/tests/test_datamodel.py +2 -0
- synapse/tests/test_lib_agenda.py +41 -0
- synapse/tests/test_lib_ast.py +3 -0
- synapse/tests/test_lib_cell.py +4 -4
- synapse/tests/test_lib_hive.py +0 -38
- synapse/tests/test_lib_storm.py +11 -1
- synapse/tests/test_model_risk.py +4 -0
- synapse/tests/test_tools_autodoc.py +5 -0
- synapse/tests/test_tools_hiveload.py +19 -23
- synapse/tests/test_tools_hivesave.py +5 -7
- synapse/tests/utils.py +7 -26
- synapse/tools/autodoc.py +16 -1
- synapse/tools/hive/load.py +3 -9
- {synapse-2.199.0.dist-info → synapse-2.201.0.dist-info}/METADATA +2 -2
- {synapse-2.199.0.dist-info → synapse-2.201.0.dist-info}/RECORD +37 -38
- {synapse-2.199.0.dist-info → synapse-2.201.0.dist-info}/WHEEL +1 -1
- synapse/lib/hiveauth.py +0 -1336
- {synapse-2.199.0.dist-info → synapse-2.201.0.dist-info}/LICENSE +0 -0
- {synapse-2.199.0.dist-info → synapse-2.201.0.dist-info}/top_level.txt +0 -0
synapse/models/economic.py
CHANGED
|
@@ -67,10 +67,10 @@ class EconModule(s_module.CoreModule):
|
|
|
67
67
|
'doc': 'A financial security which is typically traded on an exchange.'}),
|
|
68
68
|
|
|
69
69
|
('econ:fin:bar', ('guid', {}), {
|
|
70
|
-
'doc': 'A sample of the open, close, high, low prices of a security in a specific time window'}),
|
|
70
|
+
'doc': 'A sample of the open, close, high, low prices of a security in a specific time window.'}),
|
|
71
71
|
|
|
72
72
|
('econ:fin:tick', ('guid', {}), {
|
|
73
|
-
'doc': 'A sample of the price of a security at a single moment in time'}),
|
|
73
|
+
'doc': 'A sample of the price of a security at a single moment in time.'}),
|
|
74
74
|
|
|
75
75
|
('econ:bank:account:type:taxonomy', ('taxonomy', {}), {
|
|
76
76
|
'doc': 'A bank account type taxonomy.'}),
|
|
@@ -192,10 +192,10 @@ class EconModule(s_module.CoreModule):
|
|
|
192
192
|
'doc': 'The campaign that the purchase was in support of.'}),
|
|
193
193
|
|
|
194
194
|
('price', ('econ:price', {}), {
|
|
195
|
-
'doc': 'The econ:price of the purchase'}),
|
|
195
|
+
'doc': 'The econ:price of the purchase.'}),
|
|
196
196
|
|
|
197
197
|
('currency', ('econ:currency', {}), {
|
|
198
|
-
'doc': 'The econ:price of the purchase'}),
|
|
198
|
+
'doc': 'The econ:price of the purchase.'}),
|
|
199
199
|
|
|
200
200
|
('listing', ('biz:listing', {}), {
|
|
201
201
|
'doc': 'The purchase was made based on the given listing.'}),
|
|
@@ -283,10 +283,10 @@ class EconModule(s_module.CoreModule):
|
|
|
283
283
|
'doc': 'The purchase which the payment was paying for.'}),
|
|
284
284
|
|
|
285
285
|
('amount', ('econ:price', {}), {
|
|
286
|
-
'doc': 'The amount of money transferred in the payment'}),
|
|
286
|
+
'doc': 'The amount of money transferred in the payment.'}),
|
|
287
287
|
|
|
288
288
|
('currency', ('econ:currency', {}), {
|
|
289
|
-
'doc': 'The currency of the payment'}),
|
|
289
|
+
'doc': 'The currency of the payment.'}),
|
|
290
290
|
|
|
291
291
|
('memo', ('str', {}), {
|
|
292
292
|
'doc': 'A small note specified by the payer common in financial transactions.'}),
|
|
@@ -339,66 +339,66 @@ class EconModule(s_module.CoreModule):
|
|
|
339
339
|
('econ:fin:exchange', {}, (
|
|
340
340
|
|
|
341
341
|
('name', ('str', {'lower': True, 'strip': True}), {
|
|
342
|
-
'doc': 'A simple name for the exchange',
|
|
342
|
+
'doc': 'A simple name for the exchange.',
|
|
343
343
|
'ex': 'nasdaq'}),
|
|
344
344
|
|
|
345
345
|
('org', ('ou:org', {}), {
|
|
346
|
-
'doc': 'The organization that operates the exchange'}),
|
|
346
|
+
'doc': 'The organization that operates the exchange.'}),
|
|
347
347
|
|
|
348
348
|
('currency', ('econ:currency', {}), {
|
|
349
|
-
'doc': 'The currency used for all transactions in the exchange',
|
|
349
|
+
'doc': 'The currency used for all transactions in the exchange.',
|
|
350
350
|
'ex': 'usd'}),
|
|
351
351
|
)),
|
|
352
352
|
|
|
353
353
|
('econ:fin:security', {}, (
|
|
354
354
|
|
|
355
355
|
('exchange', ('econ:fin:exchange', {}), {
|
|
356
|
-
'doc': 'The exchange on which the security is traded'}),
|
|
356
|
+
'doc': 'The exchange on which the security is traded.'}),
|
|
357
357
|
|
|
358
358
|
('ticker', ('str', {'lower': True, 'strip': True}), {
|
|
359
|
-
'doc': 'The identifier for this security within the exchange'}),
|
|
359
|
+
'doc': 'The identifier for this security within the exchange.'}),
|
|
360
360
|
|
|
361
361
|
('type', ('str', {'lower': True, 'strip': True}), {
|
|
362
|
-
'doc': 'A user defined type such as stock, bond, option, future, or forex'}),
|
|
362
|
+
'doc': 'A user defined type such as stock, bond, option, future, or forex.'}),
|
|
363
363
|
|
|
364
364
|
('price', ('econ:price', {}), {
|
|
365
|
-
'doc': 'The last known/available price of the security'}),
|
|
365
|
+
'doc': 'The last known/available price of the security.'}),
|
|
366
366
|
|
|
367
367
|
('time', ('time', {}), {
|
|
368
|
-
'doc': 'The time of the last know price sample'}),
|
|
368
|
+
'doc': 'The time of the last know price sample.'}),
|
|
369
369
|
)),
|
|
370
370
|
|
|
371
371
|
('econ:fin:tick', {}, (
|
|
372
372
|
|
|
373
373
|
('security', ('econ:fin:security', {}), {
|
|
374
|
-
'doc': 'The security measured by the tick'}),
|
|
374
|
+
'doc': 'The security measured by the tick.'}),
|
|
375
375
|
|
|
376
376
|
('time', ('time', {}), {
|
|
377
|
-
'doc': 'The time the price was sampled'}),
|
|
377
|
+
'doc': 'The time the price was sampled.'}),
|
|
378
378
|
|
|
379
379
|
('price', ('econ:price', {}), {
|
|
380
|
-
'doc': 'The price of the security at the time'}),
|
|
380
|
+
'doc': 'The price of the security at the time.'}),
|
|
381
381
|
)),
|
|
382
382
|
|
|
383
383
|
('econ:fin:bar', {}, (
|
|
384
384
|
|
|
385
385
|
('security', ('econ:fin:security', {}), {
|
|
386
|
-
'doc': 'The security measured by the bar'}),
|
|
386
|
+
'doc': 'The security measured by the bar.'}),
|
|
387
387
|
|
|
388
388
|
('ival', ('ival', {}), {
|
|
389
|
-
'doc': 'The interval of measurement'}),
|
|
389
|
+
'doc': 'The interval of measurement.'}),
|
|
390
390
|
|
|
391
391
|
('price:open', ('econ:price', {}), {
|
|
392
|
-
'doc': 'The opening price of the security'}),
|
|
392
|
+
'doc': 'The opening price of the security.'}),
|
|
393
393
|
|
|
394
394
|
('price:close', ('econ:price', {}), {
|
|
395
|
-
'doc': 'The closing price of the security'}),
|
|
395
|
+
'doc': 'The closing price of the security.'}),
|
|
396
396
|
|
|
397
397
|
('price:low', ('econ:price', {}), {
|
|
398
|
-
'doc': 'The low price of the security'}),
|
|
398
|
+
'doc': 'The low price of the security.'}),
|
|
399
399
|
|
|
400
400
|
('price:high', ('econ:price', {}), {
|
|
401
|
-
'doc': 'The high price of the security'}),
|
|
401
|
+
'doc': 'The high price of the security.'}),
|
|
402
402
|
)),
|
|
403
403
|
|
|
404
404
|
('econ:acct:invoice', {}, (
|
synapse/models/files.py
CHANGED
|
@@ -270,7 +270,7 @@ class FileModule(s_module.CoreModule):
|
|
|
270
270
|
('file', ('file:bytes', {}), {
|
|
271
271
|
'doc': 'The Mach-O file containing the load command.'}),
|
|
272
272
|
('type', ('int', {'enums': s_l_macho.getLoadCmdTypes()}), {
|
|
273
|
-
'doc': 'The type of the load command'}),
|
|
273
|
+
'doc': 'The type of the load command.'}),
|
|
274
274
|
('size', ('int', {}), {
|
|
275
275
|
'doc': 'The size of the load command structure in bytes.'}),
|
|
276
276
|
),
|
|
@@ -724,7 +724,7 @@ class FileModule(s_module.CoreModule):
|
|
|
724
724
|
('sha256', ('hash:sha256', {}), {
|
|
725
725
|
'doc': 'The sha256 hash of the bytes of the Mach-O section.'}),
|
|
726
726
|
('offset', ('int', {}), {
|
|
727
|
-
'doc': 'The file offset to the beginning of the section'}),
|
|
727
|
+
'doc': 'The file offset to the beginning of the section.'}),
|
|
728
728
|
)),
|
|
729
729
|
|
|
730
730
|
('file:mime:lnk', {}, (
|
synapse/models/inet.py
CHANGED
|
@@ -1332,7 +1332,7 @@ class InetModule(s_module.CoreModule):
|
|
|
1332
1332
|
|
|
1333
1333
|
('inet:ssl:cert', ('comp', {'fields': (('server', 'inet:server'), ('file', 'file:bytes'))}), {
|
|
1334
1334
|
'deprecated': True,
|
|
1335
|
-
'doc': 'Deprecated. Please use inet:tls:servercert or inet:tls:clientcert',
|
|
1335
|
+
'doc': 'Deprecated. Please use inet:tls:servercert or inet:tls:clientcert.',
|
|
1336
1336
|
}),
|
|
1337
1337
|
|
|
1338
1338
|
('inet:port', ('int', {'min': 0, 'max': 0xffff}), {
|
|
@@ -3802,7 +3802,7 @@ class InetModule(s_module.CoreModule):
|
|
|
3802
3802
|
|
|
3803
3803
|
('client:address', ('inet:client', {}), {
|
|
3804
3804
|
'deprecated': True,
|
|
3805
|
-
'doc': 'Deprecated. Please use :client'}),
|
|
3805
|
+
'doc': 'Deprecated. Please use :client.'}),
|
|
3806
3806
|
|
|
3807
3807
|
('client:software', ('it:prod:softver', {}), {
|
|
3808
3808
|
'doc': 'The client software version used to send the message.'}),
|
synapse/models/infotech.py
CHANGED
|
@@ -641,10 +641,10 @@ class ItModule(s_module.CoreModule):
|
|
|
641
641
|
'doc': 'Semantic Version type.',
|
|
642
642
|
}),
|
|
643
643
|
('it:sec:cpe', 'synapse.models.infotech.Cpe23Str', {}, {
|
|
644
|
-
'doc': 'A NIST CPE 2.3 Formatted String',
|
|
644
|
+
'doc': 'A NIST CPE 2.3 Formatted String.',
|
|
645
645
|
}),
|
|
646
646
|
('it:sec:cpe:v2_2', 'synapse.models.infotech.Cpe22Str', {}, {
|
|
647
|
-
'doc': 'A NIST CPE 2.2 Formatted String',
|
|
647
|
+
'doc': 'A NIST CPE 2.2 Formatted String.',
|
|
648
648
|
}),
|
|
649
649
|
),
|
|
650
650
|
'types': (
|
|
@@ -697,7 +697,7 @@ class ItModule(s_module.CoreModule):
|
|
|
697
697
|
'ex': 'cve-2012-0158'
|
|
698
698
|
}),
|
|
699
699
|
('it:sec:cwe', ('str', {'regex': r'^CWE-[0-9]{1,8}$'}), {
|
|
700
|
-
'doc': 'NIST NVD Common Weaknesses Enumeration Specification',
|
|
700
|
+
'doc': 'NIST NVD Common Weaknesses Enumeration Specification.',
|
|
701
701
|
'ex': 'CWE-120',
|
|
702
702
|
}),
|
|
703
703
|
|
|
@@ -1297,7 +1297,7 @@ class ItModule(s_module.CoreModule):
|
|
|
1297
1297
|
)),
|
|
1298
1298
|
('it:account', {}, (
|
|
1299
1299
|
('user', ('inet:user', {}), {
|
|
1300
|
-
'doc': 'The username associated with the account',
|
|
1300
|
+
'doc': 'The username associated with the account.',
|
|
1301
1301
|
}),
|
|
1302
1302
|
('contact', ('ps:contact', {}), {
|
|
1303
1303
|
'doc': 'Additional contact information associated with this account.',
|
|
@@ -1977,7 +1977,7 @@ class ItModule(s_module.CoreModule):
|
|
|
1977
1977
|
'doc': 'The commit that produced this diff.'}),
|
|
1978
1978
|
|
|
1979
1979
|
('file', ('file:bytes', {}), {
|
|
1980
|
-
'doc': 'The file after the commit has been applied'}),
|
|
1980
|
+
'doc': 'The file after the commit has been applied.'}),
|
|
1981
1981
|
|
|
1982
1982
|
('path', ('file:path', {}), {
|
|
1983
1983
|
'doc': 'The path to the file in the repo that the diff is being applied to.'}),
|
|
@@ -2272,7 +2272,7 @@ class ItModule(s_module.CoreModule):
|
|
|
2272
2272
|
'disp': {'hint': 'text'},
|
|
2273
2273
|
}),
|
|
2274
2274
|
('cpe', ('it:sec:cpe', {}), {
|
|
2275
|
-
'doc': 'The NIST CPE 2.3 string specifying this software version',
|
|
2275
|
+
'doc': 'The NIST CPE 2.3 string specifying this software version.',
|
|
2276
2276
|
}),
|
|
2277
2277
|
('cves', ('array', {'type': 'it:sec:cve', 'uniq': True, 'sorted': True}), {
|
|
2278
2278
|
'doc': 'A list of CVEs that apply to this software version.',
|
|
@@ -2420,7 +2420,7 @@ class ItModule(s_module.CoreModule):
|
|
|
2420
2420
|
'doc': 'Set if this result was part of running multiple scanners.'}),
|
|
2421
2421
|
|
|
2422
2422
|
('multi:count', ('int', {'min': 0}), {
|
|
2423
|
-
'doc': 'The total number of scanners which were run by a multi-scanner'}),
|
|
2423
|
+
'doc': 'The total number of scanners which were run by a multi-scanner.'}),
|
|
2424
2424
|
|
|
2425
2425
|
('multi:count:benign', ('int', {'min': 0}), {
|
|
2426
2426
|
'doc': 'The number of scanners which returned a benign verdict.'}),
|
synapse/models/person.py
CHANGED
|
@@ -198,7 +198,7 @@ class PsModule(s_module.CoreModule):
|
|
|
198
198
|
'doc': 'The last date the student attended a class.',
|
|
199
199
|
}),
|
|
200
200
|
('classes', ('array', {'type': 'edu:class', 'uniq': True, 'sorted': True}), {
|
|
201
|
-
'doc': 'The classes attended by the student',
|
|
201
|
+
'doc': 'The classes attended by the student.',
|
|
202
202
|
}),
|
|
203
203
|
('achievement', ('ps:achievement', {}), {
|
|
204
204
|
'doc': 'The achievement awarded to the individual.',
|
synapse/models/proj.py
CHANGED
|
@@ -173,7 +173,7 @@ class ProjectModule(s_module.CoreModule):
|
|
|
173
173
|
'doc': 'The ticket the comment was added to.'}),
|
|
174
174
|
|
|
175
175
|
('text', ('str', {}), {
|
|
176
|
-
'doc': 'The text of the comment'}),
|
|
176
|
+
'doc': 'The text of the comment.'}),
|
|
177
177
|
# -(refs)> thing comment is about
|
|
178
178
|
)),
|
|
179
179
|
|
|
@@ -244,7 +244,8 @@ class ProjectModule(s_module.CoreModule):
|
|
|
244
244
|
'doc': 'The sprint that contains the ticket.'}),
|
|
245
245
|
|
|
246
246
|
('type', ('str', {'lower': True, 'strip': True}), {
|
|
247
|
-
'doc': 'The type of ticket.
|
|
247
|
+
'doc': 'The type of ticket.',
|
|
248
|
+
'ex': 'bug'}),
|
|
248
249
|
)),
|
|
249
250
|
),
|
|
250
251
|
}),
|
synapse/models/risk.py
CHANGED
|
@@ -97,7 +97,7 @@ class RiskModule(s_module.CoreModule):
|
|
|
97
97
|
},
|
|
98
98
|
}),
|
|
99
99
|
('risk:mitigation:type:taxonomy', ('taxonomy', {}), {
|
|
100
|
-
'
|
|
100
|
+
'interfaces': ('meta:taxonomy',),
|
|
101
101
|
'doc': 'A taxonomy of mitigation types.',
|
|
102
102
|
}),
|
|
103
103
|
('risk:mitigation', ('guid', {}), {
|
synapse/models/transport.py
CHANGED
|
@@ -102,7 +102,7 @@ class TransportModule(s_module.CoreModule):
|
|
|
102
102
|
'doc': 'An individual sea vessel.'}),
|
|
103
103
|
|
|
104
104
|
('transport:sea:mmsi', ('str', {'regex': '[0-9]{9}'}), {
|
|
105
|
-
'doc': 'A Maritime Mobile Service Identifier'}),
|
|
105
|
+
'doc': 'A Maritime Mobile Service Identifier.'}),
|
|
106
106
|
|
|
107
107
|
('transport:sea:imo', ('str', {'lower': True, 'strip': True, 'replace': ((' ', ''),), 'regex': '^imo[0-9]{7}$'}), {
|
|
108
108
|
'doc': 'An International Maritime Organization registration number.'}),
|
|
@@ -349,7 +349,7 @@ class TransportModule(s_module.CoreModule):
|
|
|
349
349
|
)),
|
|
350
350
|
('transport:air:port', {}, (
|
|
351
351
|
('name', ('str', {'lower': True, 'onespace': True}), {
|
|
352
|
-
'doc': 'The name of the airport'}),
|
|
352
|
+
'doc': 'The name of the airport.'}),
|
|
353
353
|
('place', ('geo:place', {}), {
|
|
354
354
|
'doc': 'The place where the IATA airport code is assigned.'}),
|
|
355
355
|
)),
|
|
@@ -462,7 +462,7 @@ class TransportModule(s_module.CoreModule):
|
|
|
462
462
|
'doc': 'Deprecated. Please use :phys:length.'}),
|
|
463
463
|
|
|
464
464
|
('beam', ('geo:dist', {}), {
|
|
465
|
-
'doc': 'The official overall vessel beam'}),
|
|
465
|
+
'doc': 'The official overall vessel beam.'}),
|
|
466
466
|
|
|
467
467
|
('flag', ('iso:3166:cc', {}), {
|
|
468
468
|
'doc': 'The country the vessel is flagged to.'}),
|
synapse/tests/test_cortex.py
CHANGED
|
@@ -4629,12 +4629,6 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
4629
4629
|
self.len(2, await core.nodes('[ inet:dns:a=(vertex.link,1.2.3.4) inet:dns:a=(woot.com,5.6.7.8)]'))
|
|
4630
4630
|
self.len(4, await core.nodes('inet:dns:a inet:fqdn=:fqdn'))
|
|
4631
4631
|
|
|
4632
|
-
async def test_cortex_hive(self):
|
|
4633
|
-
async with self.getTestCore() as core:
|
|
4634
|
-
await core.hive.set(('visi',), 200)
|
|
4635
|
-
async with core.getLocalProxy(share='cortex/hive') as hive:
|
|
4636
|
-
self.eq(200, await hive.get(('visi',)))
|
|
4637
|
-
|
|
4638
4632
|
async def test_cortex_delnode_perms(self):
|
|
4639
4633
|
|
|
4640
4634
|
async with self.getTestCore() as core:
|
|
@@ -7403,6 +7397,9 @@ class CortexBasicTest(s_t_utils.SynTest):
|
|
|
7403
7397
|
self.len(1, await core.nodes('media:news -(refs)> *', opts={'view': altview}))
|
|
7404
7398
|
self.eq(2, await proxy.feedFromAxon(sha256))
|
|
7405
7399
|
|
|
7400
|
+
opts['limit'] = 1
|
|
7401
|
+
self.len(1, await alist(proxy.exportStorm('media:news inet:email', opts=opts)))
|
|
7402
|
+
|
|
7406
7403
|
async with self.getHttpSess(port=port) as sess:
|
|
7407
7404
|
resp = await sess.post(f'https://localhost:{port}/api/v1/storm/export')
|
|
7408
7405
|
self.eq(401, resp.status)
|
synapse/tests/test_datamodel.py
CHANGED
|
@@ -44,6 +44,8 @@ class DataModelTest(s_t_utils.SynTest):
|
|
|
44
44
|
|
|
45
45
|
async def test_datamodel_basics(self):
|
|
46
46
|
async with self.getTestCore() as core:
|
|
47
|
+
iface = core.model.ifaces.get('phys:object')
|
|
48
|
+
self.eq('object', iface['template']['phys:object'])
|
|
47
49
|
core.model.addType('woot:one', 'guid', {}, {
|
|
48
50
|
'display': {
|
|
49
51
|
'columns': (
|
synapse/tests/test_lib_agenda.py
CHANGED
|
@@ -1098,6 +1098,15 @@ class AgendaTest(s_t_utils.SynTest):
|
|
|
1098
1098
|
self.gt(cdef00['laststarttime'], 0)
|
|
1099
1099
|
self.eq(cdef00['laststarttime'], cdef01['laststarttime'])
|
|
1100
1100
|
|
|
1101
|
+
async def test_agenda_warnings(self):
|
|
1102
|
+
|
|
1103
|
+
async with self.getTestCore() as core:
|
|
1104
|
+
with self.getAsyncLoggerStream('synapse.lib.agenda', 'issued warning: oh hai') as stream:
|
|
1105
|
+
q = '$lib.warn("oh hai")'
|
|
1106
|
+
msgs = await core.stormlist('cron.at --now $q', opts={'vars': {'q': q}})
|
|
1107
|
+
self.stormHasNoWarnErr(msgs)
|
|
1108
|
+
self.true(await stream.wait(timeout=6))
|
|
1109
|
+
|
|
1101
1110
|
async def test_agenda_graceful_promotion_with_running_cron(self):
|
|
1102
1111
|
|
|
1103
1112
|
async with self.getTestAha() as aha:
|
|
@@ -1221,3 +1230,35 @@ class AgendaTest(s_t_utils.SynTest):
|
|
|
1221
1230
|
|
|
1222
1231
|
crons = await core.callStorm('return($lib.cron.list())')
|
|
1223
1232
|
self.len(1, crons)
|
|
1233
|
+
|
|
1234
|
+
async def test_agenda_lasterrs(self):
|
|
1235
|
+
|
|
1236
|
+
async with self.getTestCore() as core:
|
|
1237
|
+
|
|
1238
|
+
cdef = {
|
|
1239
|
+
'iden': 'test',
|
|
1240
|
+
'creator': core.auth.rootuser.iden,
|
|
1241
|
+
'storm': '[ test:str=foo ]',
|
|
1242
|
+
'reqs': {},
|
|
1243
|
+
'incunit': s_tu.MINUTE,
|
|
1244
|
+
'incvals': 1
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
await core.agenda.add(cdef)
|
|
1248
|
+
appt = await core.agenda.get('test')
|
|
1249
|
+
|
|
1250
|
+
self.true(isinstance(appt.lasterrs, list))
|
|
1251
|
+
self.eq(appt.lasterrs, [])
|
|
1252
|
+
|
|
1253
|
+
edits = {
|
|
1254
|
+
'lasterrs': ('error1', 'error2'),
|
|
1255
|
+
}
|
|
1256
|
+
await appt.edits(edits)
|
|
1257
|
+
|
|
1258
|
+
self.true(isinstance(appt.lasterrs, list))
|
|
1259
|
+
self.eq(appt.lasterrs, ['error1', 'error2'])
|
|
1260
|
+
|
|
1261
|
+
await core.agenda._load_all()
|
|
1262
|
+
appt = await core.agenda.get('test')
|
|
1263
|
+
self.true(isinstance(appt.lasterrs, list))
|
|
1264
|
+
self.eq(appt.lasterrs, ['error1', 'error2'])
|
synapse/tests/test_lib_ast.py
CHANGED
|
@@ -1077,6 +1077,9 @@ class AstTest(s_test.SynTest):
|
|
|
1077
1077
|
self.len(1, await core.nodes('inet:proto:request:sandbox:file'))
|
|
1078
1078
|
self.len(1, await core.nodes('it:host:activity:sandbox:file'))
|
|
1079
1079
|
|
|
1080
|
+
self.len(1, await core.nodes('[ it:exec:reg:get=* :host=(host,) ]'))
|
|
1081
|
+
self.len(4, await core.nodes('it:host:activity:host=(host,)'))
|
|
1082
|
+
|
|
1080
1083
|
async def test_ast_edge_walknjoin(self):
|
|
1081
1084
|
|
|
1082
1085
|
async with self.getTestCore() as core:
|
synapse/tests/test_lib_cell.py
CHANGED
|
@@ -1203,12 +1203,12 @@ class CellTest(s_t_utils.SynTest):
|
|
|
1203
1203
|
|
|
1204
1204
|
async def test_cell_hiveapi(self):
|
|
1205
1205
|
|
|
1206
|
-
async with self.
|
|
1206
|
+
async with self.getTestCell() as cell:
|
|
1207
1207
|
|
|
1208
|
-
await
|
|
1209
|
-
await
|
|
1208
|
+
await cell.setHiveKey(('foo', 'bar'), 10)
|
|
1209
|
+
await cell.setHiveKey(('foo', 'baz'), 30)
|
|
1210
1210
|
|
|
1211
|
-
async with
|
|
1211
|
+
async with cell.getLocalProxy() as proxy:
|
|
1212
1212
|
self.eq((), await proxy.getHiveKeys(('lulz',)))
|
|
1213
1213
|
self.eq((('bar', 10), ('baz', 30)), await proxy.getHiveKeys(('foo',)))
|
|
1214
1214
|
|
synapse/tests/test_lib_hive.py
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
|
|
3
1
|
import synapse.exc as s_exc
|
|
4
2
|
import synapse.common as s_common
|
|
5
3
|
|
|
6
4
|
import synapse.tests.utils as s_test
|
|
7
5
|
|
|
8
|
-
import synapse.lib.hive as s_hive
|
|
9
|
-
|
|
10
6
|
tree0 = {
|
|
11
7
|
'kids': {
|
|
12
8
|
'hehe': {'value': 'haha'},
|
|
@@ -73,40 +69,6 @@ class HiveTest(s_test.SynTest):
|
|
|
73
69
|
|
|
74
70
|
self.none(await hive.get(('foo', 'bar', 'lulz')))
|
|
75
71
|
|
|
76
|
-
async def test_hive_telepath(self):
|
|
77
|
-
|
|
78
|
-
# confirm that the primitives used by higher level APIs
|
|
79
|
-
# work using telepath remotes and property synchronize.
|
|
80
|
-
|
|
81
|
-
async with self.getTestHiveDmon() as dmon:
|
|
82
|
-
|
|
83
|
-
turl = self.getTestUrl(dmon, 'hive')
|
|
84
|
-
|
|
85
|
-
async with await s_hive.openurl(turl) as hive0:
|
|
86
|
-
|
|
87
|
-
path = ('foo', 'bar')
|
|
88
|
-
|
|
89
|
-
evnt = asyncio.Event()
|
|
90
|
-
|
|
91
|
-
def onedit(mesg):
|
|
92
|
-
evnt.set()
|
|
93
|
-
|
|
94
|
-
node0 = await hive0.open(path)
|
|
95
|
-
node0.on('hive:set', onedit)
|
|
96
|
-
|
|
97
|
-
async with await s_hive.openurl(turl) as hive1:
|
|
98
|
-
|
|
99
|
-
node1 = await hive1.open(path)
|
|
100
|
-
await node1.set(200)
|
|
101
|
-
|
|
102
|
-
await evnt.wait()
|
|
103
|
-
|
|
104
|
-
self.eq(200, node0.valu)
|
|
105
|
-
|
|
106
|
-
self.eq(201, await node0.add(1))
|
|
107
|
-
self.eq(202, await node1.add(1))
|
|
108
|
-
self.eq(203, await node0.add(1))
|
|
109
|
-
|
|
110
72
|
async def test_hive_dir(self):
|
|
111
73
|
|
|
112
74
|
async with self.getTestHive() as hive:
|
synapse/tests/test_lib_storm.py
CHANGED
|
@@ -163,6 +163,10 @@ class StormTest(s_t_utils.SynTest):
|
|
|
163
163
|
with self.raises(s_exc.BadTypeValu):
|
|
164
164
|
await core.nodes('inet:flow:from=({"name": "vertex", "type": "newp"})')
|
|
165
165
|
|
|
166
|
+
await core.nodes('[ ou:org=({"name": "origname"}) ]')
|
|
167
|
+
self.len(1, await core.nodes('ou:org=({"name": "origname"}) [ :name=newname ]'))
|
|
168
|
+
self.len(0, await core.nodes('ou:org=({"name": "origname"})'))
|
|
169
|
+
|
|
166
170
|
async def test_lib_storm_jsonexpr(self):
|
|
167
171
|
async with self.getTestCore() as core:
|
|
168
172
|
|
|
@@ -4121,6 +4125,9 @@ class StormTest(s_t_utils.SynTest):
|
|
|
4121
4125
|
{'name': 'woot', 'cmdinputs': (
|
|
4122
4126
|
{'form': 'hehe:haha'},
|
|
4123
4127
|
{'form': 'hoho:lol', 'help': 'We know whats up'}
|
|
4128
|
+
), 'endpoints': (
|
|
4129
|
+
{'path': '/v1/test/one', 'desc': 'My multi-line endpoint description which spans multiple lines and has a second line. This is the second line of the description.'},
|
|
4130
|
+
{'path': '/v1/test/two', 'host': 'vertex.link', 'desc': 'Single line endpoint description.'},
|
|
4124
4131
|
)},
|
|
4125
4132
|
),
|
|
4126
4133
|
}
|
|
@@ -4128,6 +4135,9 @@ class StormTest(s_t_utils.SynTest):
|
|
|
4128
4135
|
msgs = await core.stormlist('woot --help')
|
|
4129
4136
|
helptext = '\n'.join([m[1].get('mesg') for m in msgs if m[0] == 'print'])
|
|
4130
4137
|
self.isin('Inputs:\n\n hehe:haha\n hoho:lol - We know whats up', helptext)
|
|
4138
|
+
self.isin('Endpoints:\n\n /v1/test/one : My multi-line endpoint description which spans multiple lines and has a second line.', helptext)
|
|
4139
|
+
self.isin('This is the second line of the description.', helptext)
|
|
4140
|
+
self.isin('/v1/test/two : Single line endpoint description.', helptext)
|
|
4131
4141
|
|
|
4132
4142
|
async def test_storm_help_cmd(self):
|
|
4133
4143
|
|
|
@@ -5028,7 +5038,7 @@ class StormTest(s_t_utils.SynTest):
|
|
|
5028
5038
|
q = '''
|
|
5029
5039
|
for $i in $lib.range(12) {[ test:str=$i ]}
|
|
5030
5040
|
|
|
5031
|
-
batch $lib.true --size 5 {
|
|
5041
|
+
batch $lib.true --size 5 ${
|
|
5032
5042
|
$vals=([])
|
|
5033
5043
|
for $n in $nodes { $vals.append($n.repr()) }
|
|
5034
5044
|
$lib.print($lib.str.join(',', $vals))
|
synapse/tests/test_model_risk.py
CHANGED
|
@@ -610,6 +610,10 @@ class RiskModelTest(s_t_utils.SynTest):
|
|
|
610
610
|
self.len(1, await core.nodes('risk:mitigation -> it:mitre:attack:mitigation'))
|
|
611
611
|
self.len(1, await core.nodes('risk:mitigation -> risk:mitigation:type:taxonomy'))
|
|
612
612
|
|
|
613
|
+
nodes = await core.nodes('risk:mitigation:type:taxonomy=foo.bar [ :desc="foo that bars"]')
|
|
614
|
+
self.len(1, nodes)
|
|
615
|
+
self.eq('foo that bars', nodes[0].get('desc'))
|
|
616
|
+
|
|
613
617
|
async def test_model_risk_tool_software(self):
|
|
614
618
|
|
|
615
619
|
async with self.getTestCore() as core:
|
|
@@ -40,6 +40,11 @@ class TestAutoDoc(s_t_utils.SynTest):
|
|
|
40
40
|
self.isin('+==========+', s)
|
|
41
41
|
self.isin('+deprecated+', s)
|
|
42
42
|
|
|
43
|
+
self.isin('''This type implements the following interfaces:
|
|
44
|
+
|
|
45
|
+
* ``inet:service:object``
|
|
46
|
+
* ``phys:object``''', s)
|
|
47
|
+
|
|
43
48
|
with s_common.genfile(path, 'datamodel_forms.rst') as fd:
|
|
44
49
|
buf = fd.read()
|
|
45
50
|
|
|
@@ -37,8 +37,8 @@ class HiveLoadTest(s_test.SynTest):
|
|
|
37
37
|
hivepath0 = os.path.join(dirn, 'hivesave0.mpk')
|
|
38
38
|
s_msgpack.dumpfile(htree0, hivepath0)
|
|
39
39
|
|
|
40
|
-
async with self.
|
|
41
|
-
hurl =
|
|
40
|
+
async with self.getTestCell() as cell:
|
|
41
|
+
hurl = cell.getLocalUrl()
|
|
42
42
|
|
|
43
43
|
argv = [hurl, hivepath0]
|
|
44
44
|
|
|
@@ -64,43 +64,39 @@ class HiveLoadTest(s_test.SynTest):
|
|
|
64
64
|
s_msgpack.dumpfile(htree1, hivepath1)
|
|
65
65
|
s_common.yamlsave(htree0, yamlpath0)
|
|
66
66
|
|
|
67
|
-
async with self.
|
|
68
|
-
|
|
69
|
-
hive = dmon.shared.get('hive')
|
|
70
|
-
hurl = self.getTestUrl(dmon, 'hive')
|
|
67
|
+
async with self.getTestCell() as cell:
|
|
68
|
+
hurl = cell.getLocalUrl()
|
|
71
69
|
|
|
72
70
|
retn = await s_hiveload.main([hurl, hivepath0])
|
|
73
71
|
self.eq(0, retn)
|
|
74
72
|
|
|
75
|
-
self.eq(20, await hive.get(('hehe',)))
|
|
76
|
-
self.eq(30, await hive.get(('haha',)))
|
|
77
|
-
self.eq('bar', await hive.get(('haha', 'foo')))
|
|
78
|
-
self.eq('faz', await hive.get(('haha', 'baz')))
|
|
73
|
+
self.eq(20, await cell.hive.get(('hehe',)))
|
|
74
|
+
self.eq(30, await cell.hive.get(('haha',)))
|
|
75
|
+
self.eq('bar', await cell.hive.get(('haha', 'foo')))
|
|
76
|
+
self.eq('faz', await cell.hive.get(('haha', 'baz')))
|
|
79
77
|
|
|
80
78
|
retn = await s_hiveload.main([hurl, hivepath1])
|
|
81
79
|
self.eq(0, retn)
|
|
82
80
|
|
|
83
|
-
self.eq(20, await hive.get(('hehe',)))
|
|
84
|
-
self.eq(30, await hive.get(('haha',)))
|
|
85
|
-
self.eq('bar', await hive.get(('haha', 'foo')))
|
|
86
|
-
self.eq('faz', await hive.get(('haha', 'baz')))
|
|
81
|
+
self.eq(20, await cell.hive.get(('hehe',)))
|
|
82
|
+
self.eq(30, await cell.hive.get(('haha',)))
|
|
83
|
+
self.eq('bar', await cell.hive.get(('haha', 'foo')))
|
|
84
|
+
self.eq('faz', await cell.hive.get(('haha', 'baz')))
|
|
87
85
|
|
|
88
86
|
retn = await s_hiveload.main(['--trim', hurl, hivepath1])
|
|
89
87
|
self.eq(0, retn)
|
|
90
88
|
|
|
91
|
-
self.eq(20, await hive.get(('hehe',)))
|
|
92
|
-
self.eq(30, await hive.get(('haha',)))
|
|
93
|
-
self.eq('faz', await hive.get(('haha', 'baz')))
|
|
94
|
-
|
|
95
|
-
self.none(await hive.get(('haha', 'foo')))
|
|
89
|
+
self.eq(20, await cell.hive.get(('hehe',)))
|
|
90
|
+
self.eq(30, await cell.hive.get(('haha',)))
|
|
91
|
+
self.eq('faz', await cell.hive.get(('haha', 'baz')))
|
|
96
92
|
|
|
97
|
-
|
|
93
|
+
self.none(await cell.hive.get(('haha', 'foo')))
|
|
98
94
|
|
|
99
|
-
|
|
100
|
-
hurl =
|
|
95
|
+
async with self.getTestCell() as cell:
|
|
96
|
+
hurl = cell.getLocalUrl()
|
|
101
97
|
|
|
102
98
|
await s_hiveload.main(['--path', 'v/i/s/i', '--yaml', hurl, yamlpath0])
|
|
103
|
-
self.eq('bar', await hive.get(('v', 'i', 's', 'i', 'haha', 'foo')))
|
|
99
|
+
self.eq('bar', await cell.hive.get(('v', 'i', 's', 'i', 'haha', 'foo')))
|
|
104
100
|
|
|
105
101
|
path = os.path.join(dirn, 'cell')
|
|
106
102
|
async with await s_cell.Cell.anit(path) as cell:
|
|
@@ -17,8 +17,8 @@ class HiveSaveTest(s_test.SynTest):
|
|
|
17
17
|
|
|
18
18
|
hivepath0 = os.path.join(dirn, 'hivesave0.mpk')
|
|
19
19
|
|
|
20
|
-
async with self.
|
|
21
|
-
hurl =
|
|
20
|
+
async with self.getTestCell() as cell:
|
|
21
|
+
hurl = cell.getLocalUrl()
|
|
22
22
|
|
|
23
23
|
argv = [hurl, hivepath0]
|
|
24
24
|
|
|
@@ -39,12 +39,10 @@ class HiveSaveTest(s_test.SynTest):
|
|
|
39
39
|
hivepath0 = os.path.join(dirn, 'hivesave0.mpk')
|
|
40
40
|
yamlpath0 = os.path.join(dirn, 'hivesave0.yaml')
|
|
41
41
|
|
|
42
|
-
async with self.
|
|
42
|
+
async with self.getTestCell() as cell:
|
|
43
|
+
hurl = cell.getLocalUrl()
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
await hive.set(('baz', 'faz'), 'visi')
|
|
46
|
-
|
|
47
|
-
hurl = self.getTestUrl(dmon, 'hive')
|
|
45
|
+
await cell.hive.set(('baz', 'faz'), 'visi')
|
|
48
46
|
|
|
49
47
|
retn = await s_hivesave.main([hurl, hivepath0])
|
|
50
48
|
self.eq(0, retn)
|