Skip to content

Commit e9b3356

Browse files
authored
renamed relation to relationship around the repo (demisto#12562)
* renamed relation to relationship around the repo * fixed ut * fixed relationship * added rn to files * rn after merge * added rn to all apimodules * added rn * removed error
1 parent 30b2a49 commit e9b3356

52 files changed

Lines changed: 539 additions & 452 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Packs/AlienVault_OTX/Integrations/AlienVault_OTX_v2/AlienVault_OTX_v2.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def create_attack_pattern_relationships(client: Client, raw_response: dict, enti
158158
if pulses and isinstance(pulses, list) and 'attack_ids' in pulses[0]:
159159
display_names = [attack_id.get('display_name') for attack_id in pulses[0].get('attack_ids')]
160160
if display_names:
161-
relationships = [EntityRelation(
162-
name=EntityRelation.Relations.INDICATOR_OF,
161+
relationships = [EntityRelationship(
162+
name=EntityRelationship.Relationships.INDICATOR_OF,
163163
entity_a=entity_a,
164164
entity_a_type=entity_a_type,
165165
entity_b=display_name,
@@ -226,7 +226,7 @@ def ip_command(client: Client, ip_address: str, ip_version: str) -> List[Command
226226
geo_country=raw_response.get('country_code'),
227227
geo_latitude=raw_response.get("latitude"),
228228
geo_longitude=raw_response.get("longitude"),
229-
relations=relationships)
229+
relationships=relationships)
230230

231231
context = {
232232
'Reputation': raw_response.get('reputation'),
@@ -243,7 +243,7 @@ def ip_command(client: Client, ip_address: str, ip_version: str) -> List[Command
243243
outputs={'IP': context},
244244
indicator=ip_object,
245245
raw_response=raw_response,
246-
relations=relationships
246+
relationships=relationships
247247
))
248248

249249
if not command_results:
@@ -277,7 +277,7 @@ def domain_command(client: Client, domain: str) -> List[CommandResults]:
277277
integration_name=INTEGRATION_NAME,
278278
score=calculate_dbot_score(client, raw_response.get('pulse_info', {})),
279279
reliability=client.reliability)
280-
domain_object = Common.Domain(domain=domain, dbot_score=dbot_score, relations=relationships)
280+
domain_object = Common.Domain(domain=domain, dbot_score=dbot_score, relationships=relationships)
281281

282282
context = {
283283
'Name': raw_response.get('indicator'),
@@ -294,7 +294,7 @@ def domain_command(client: Client, domain: str) -> List[CommandResults]:
294294
outputs=context,
295295
indicator=domain_object,
296296
raw_response=raw_response,
297-
relations=relationships
297+
relationships=relationships
298298
))
299299

300300
if not command_results:
@@ -339,7 +339,7 @@ def file_command(client: Client, file: str) -> List[CommandResults]:
339339
file_object = Common.File(md5=shortcut.get('md5'), sha1=shortcut.get('sha1'), sha256=shortcut.get('sha256'),
340340
ssdeep=shortcut.get('ssdeep'), size=shortcut.get('filesize'),
341341
file_type=shortcut.get('file_type'), dbot_score=dbot_score,
342-
relations=relationships)
342+
relationships=relationships)
343343

344344
context = {
345345
'MD5': shortcut.get('md5'),
@@ -361,7 +361,7 @@ def file_command(client: Client, file: str) -> List[CommandResults]:
361361
outputs=context,
362362
indicator=file_object,
363363
raw_response=raw_response_general,
364-
relations=relationships
364+
relationships=relationships
365365
))
366366

367367
if not command_results:
@@ -401,16 +401,16 @@ def url_command(client: Client, url: str) -> List[CommandResults]:
401401
client, raw_response=raw_response, entity_a=url, entity_a_type=FeedIndicatorType.URL)
402402
domain = raw_response.get('domain')
403403
if domain:
404-
relationships.extend([EntityRelation(
405-
name=EntityRelation.Relations.HOSTED_ON, entity_a=url, entity_a_type=FeedIndicatorType.URL,
404+
relationships.extend([EntityRelationship(
405+
name=EntityRelationship.Relationships.HOSTED_ON, entity_a=url, entity_a_type=FeedIndicatorType.URL,
406406
entity_b=domain, entity_b_type=FeedIndicatorType.Domain,
407407
source_reliability=client.reliability, brand=INTEGRATION_NAME)])
408408

409409
dbot_score = Common.DBotScore(
410410
indicator=url, indicator_type=DBotScoreType.URL, integration_name=INTEGRATION_NAME,
411411
score=calculate_dbot_score(client, raw_response.get('pulse_info')), reliability=client.reliability)
412412

413-
url_object = Common.URL(url=url, dbot_score=dbot_score, relations=relationships)
413+
url_object = Common.URL(url=url, dbot_score=dbot_score, relationships=relationships)
414414

415415
context = {
416416
'Url': url,
@@ -428,7 +428,7 @@ def url_command(client: Client, url: str) -> List[CommandResults]:
428428
outputs=context,
429429
indicator=url_object,
430430
raw_response=raw_response,
431-
relations=relationships
431+
relationships=relationships
432432
))
433433

434434
if not raws:

Packs/AlienVault_OTX/Integrations/AlienVault_OTX_v2/AlienVault_OTX_v2_test.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
URL_EC = {
117117
'URL(val.Data && val.Data == obj.Data)': [{
118118
'Data': {'url': 'http://www.fotoidea.com/sport/4x4_san_ponso/slides/IMG_0068.html/url_list'},
119-
'Relations': [{
119+
'Relationships': [{
120120
'Relationship': 'hosted-on',
121121
'EntityA': {'url': 'http://www.fotoidea.com/sport/4x4_san_ponso/slides/IMG_0068.html/url_list'},
122122
'EntityAType': 'URL', 'EntityB': 'fotoidea.com', 'EntityBType': 'Domain'}]
@@ -454,16 +454,18 @@
454454
IP_EC_WITH_RELATIONSHIPS = {
455455
'IP(val.Address && val.Address == obj.Address)': [{
456456
'Address': '98.136.103.23', 'ASN': 'AS36647 YAHOO-GQ1', 'Geo': {'Location': '37.751:-97.822', 'Country': 'US'},
457-
'Relations': [{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
458-
'EntityB': 'T1140 - Deobfuscate/Decode Files or Information', 'EntityBType': 'STIX Attack Pattern'},
459-
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
460-
'EntityB': 'T1040 - Network Sniffing', 'EntityBType': 'STIX Attack Pattern'},
461-
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
462-
'EntityB': 'T1053 - Scheduled Task/Job', 'EntityBType': 'STIX Attack Pattern'},
463-
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
464-
'EntityB': 'T1060 - Registry Run Keys / Startup Folder', 'EntityBType': 'STIX Attack Pattern'},
465-
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
466-
'EntityB': 'T1071 - Application Layer Protocol', 'EntityBType': 'STIX Attack Pattern'}]
457+
'Relationships': [{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
458+
'EntityB': 'T1140 - Deobfuscate/Decode Files or Information',
459+
'EntityBType': 'STIX Attack Pattern'},
460+
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
461+
'EntityB': 'T1040 - Network Sniffing', 'EntityBType': 'STIX Attack Pattern'},
462+
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
463+
'EntityB': 'T1053 - Scheduled Task/Job', 'EntityBType': 'STIX Attack Pattern'},
464+
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
465+
'EntityB': 'T1060 - Registry Run Keys / Startup Folder',
466+
'EntityBType': 'STIX Attack Pattern'},
467+
{'Relationship': 'indicator-of', 'EntityA': '98.136.103.23', 'EntityAType': 'IP',
468+
'EntityB': 'T1071 - Application Layer Protocol', 'EntityBType': 'STIX Attack Pattern'}]
467469
}],
468470
'DBotScore(val.Indicator && val.Indicator == obj.Indicator && val.Vendor == obj.Vendor && val.Type == obj.Type)': [{
469471
'Indicator': '98.136.103.23', 'Type': 'ip', 'Vendor': 'AlienVault OTX v2', 'Score': 2,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#### Integrations
3+
##### AlienVault OTX v2
4+
- Maintenance and stability enhancements.

Packs/AlienVault_OTX/pack_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "AlienVault OTX",
33
"description": "Query Indicators of Compromise in AlienVault OTX.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.0",
5+
"currentVersion": "1.1.1",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Packs/ApiModules/Scripts/CSVFeedApiModule/CSVFeedApiModule.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,15 @@ def fetch_indicators_command(client: Client, default_indicator_type: str, auto_d
311311
indicator_type = determine_indicator_type(conf_indicator_type, default_indicator_type, auto_detect,
312312
value)
313313
raw_json['type'] = indicator_type
314-
# if relations param is True and also the url returns relations
315-
if create_relationships and config.get(url, {}).get('relation_name'):
316-
if fields_mapping.get('relation_entity_b'):
317-
relationships_lst = EntityRelation(
318-
name=config.get(url, {}).get('relation_name'),
314+
# if relationships param is True and also the url returns relationships
315+
if create_relationships and config.get(url, {}).get('relationship_name'):
316+
if fields_mapping.get('relationship_entity_b'):
317+
relationships_lst = EntityRelationship(
318+
name=config.get(url, {}).get('relationship_name'),
319319
entity_a=value,
320320
entity_a_type=indicator_type,
321-
entity_b=fields_mapping.get('relation_entity_b'),
322-
entity_b_type=config.get(url, {}).get('relation_entity_b_type'),
321+
entity_b=fields_mapping.get('relationship_entity_b'),
322+
entity_b_type=config.get(url, {}).get('relationship_entity_b_type'),
323323
)
324324
relationships_of_indicator = [relationships_lst.to_indicator()]
325325

Packs/ApiModules/Scripts/CSVFeedApiModule/CSVFeedApiModule_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ def test_get_indicators_with_relations():
280280
'https://ipstack.com': {
281281
'fieldnames': ['value', 'a'],
282282
'indicator_type': 'IP',
283-
'relation_entity_b_type': 'IP',
284-
'relation_name': 'resolved-from',
283+
'relationship_entity_b_type': 'IP',
284+
'relationship_name': 'resolved-from',
285285
'mapping': {
286286
'AAA': 'a',
287-
'relation_entity_b': ('a', r'.*used\s+by\s(.*?)\s', None),
287+
'relationship_entity_b': ('a', r'.*used\s+by\s(.*?)\s', None),
288288
}
289289
}
290290
}
@@ -293,7 +293,7 @@ def test_get_indicators_with_relations():
293293
None: ['2021-04-22 06:03',
294294
'https://test.com/manual/test-iplist.txt'],
295295
'type': 'IP'},
296-
'fields': {'AAA': 'Domain used by Test c&c', 'relation_entity_b': 'Test',
296+
'fields': {'AAA': 'Domain used by Test c&c', 'relationship_entity_b': 'Test',
297297
'tags': []},
298298
'relationships': [
299299
{'name': 'resolved-from', 'reverseName': 'resolves-to', 'type': 'IndicatorToIndicator',
@@ -332,11 +332,11 @@ def test_get_indicators_without_relations():
332332
'https://ipstack.com': {
333333
'fieldnames': ['value', 'a'],
334334
'indicator_type': 'IP',
335-
'relation_entity_b_type': 'IP',
336-
'relation_name': 'resolved-from',
335+
'relationship_entity_b_type': 'IP',
336+
'relationship_name': 'resolved-from',
337337
'mapping': {
338338
'AAA': 'a',
339-
'relation_entity_b': ('a', r'.*used\s+by\s(.*?)\s', None),
339+
'relationship_entity_b': ('a', r'.*used\s+by\s(.*?)\s', None),
340340
}
341341
}
342342
}
@@ -345,7 +345,7 @@ def test_get_indicators_without_relations():
345345
None: ['2021-04-22 06:03',
346346
'https://test.com/manual/test-iplist.txt'],
347347
'type': 'IP'},
348-
'fields': {'AAA': 'Domain used by Test c&c', 'relation_entity_b': 'Test',
348+
'fields': {'AAA': 'Domain used by Test c&c', 'relationship_entity_b': 'Test',
349349
'tags': []}, 'relationships': []}]
350350

351351
ip_ranges = 'test.com,Domain used by Test c&c,2021-04-22 06:03,https://test.com/manual/test-iplist.txt'

Packs/ApiModules/Scripts/HTTPFeedApiModule/HTTPFeedApiModule.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,14 @@ def fetch_indicators_command(client, feed_tags, tlp_color, itype, auto_detect, c
381381
"type": indicator_type,
382382
"rawJSON": attributes,
383383
}
384-
if create_relationships and client.feed_url_to_config.get(url, {}).get('relation_name'):
385-
if attributes.get('relation_entity_b'):
386-
relationships_lst = EntityRelation(
387-
name=client.feed_url_to_config.get(url, {}).get('relation_name'),
384+
if create_relationships and client.feed_url_to_config.get(url, {}).get('relationship_name'):
385+
if attributes.get('relationship_entity_b'):
386+
relationships_lst = EntityRelationship(
387+
name=client.feed_url_to_config.get(url, {}).get('relationship_name'),
388388
entity_a=value,
389389
entity_a_type=indicator_type,
390-
entity_b=attributes.get('relation_entity_b'),
391-
entity_b_type=client.feed_url_to_config.get(url, {}).get('relation_entity_b_type'),
390+
entity_b=attributes.get('relationship_entity_b'),
391+
entity_b_type=client.feed_url_to_config.get(url, {}).get('relationship_entity_b_type'),
392392
)
393393
relationships_of_indicator = [relationships_lst.to_indicator()]
394394
indicator_data['relationships'] = relationships_of_indicator

Packs/ApiModules/Scripts/HTTPFeedApiModule/HTTPFeedApiModule_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ def test_get_indicators_with_relations():
326326
"regex": r"^.+,\"?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\"?",
327327
"transform": "\\1"
328328
},
329-
'relation_name': 'indicator-of',
330-
'relation_entity_b_type': 'STIX Malware',
329+
'relationship_name': 'indicator-of',
330+
'relationship_entity_b_type': 'STIX Malware',
331331
"fields": [{
332332
'firstseenbysource': {
333333
"regex": r"^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})",
@@ -345,15 +345,15 @@ def test_get_indicators_with_relations():
345345
"regex": r"^.+,.+,.+,.+,(.+)",
346346
"transform": "\\1"
347347
},
348-
"relation_entity_b": {
348+
"relationship_entity_b": {
349349
"regex": r"^.+,.+,.+,.+,\"(.+)\"",
350350
"transform": "\\1"
351351
}
352352
}],
353353
}
354354
}
355355
expected_res = [{'value': '127.0.0.1', 'type': 'IP',
356-
'rawJSON': {'malwarefamily': '"Test"', 'relation_entity_b': 'Test', 'value': '127.0.0.1',
356+
'rawJSON': {'malwarefamily': '"Test"', 'relationship_entity_b': 'Test', 'value': '127.0.0.1',
357357
'type': 'IP', 'tags': []},
358358
'relationships': [
359359
{'name': 'indicator-of', 'reverseName': 'indicated-by', 'type': 'IndicatorToIndicator',
@@ -396,8 +396,8 @@ def test_get_indicators_without_relations():
396396
"regex": r"^.+,\"?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\"?",
397397
"transform": "\\1"
398398
},
399-
'relation_name': 'indicator-of',
400-
'relation_entity_b_type': 'STIX Malware',
399+
'relationship_name': 'indicator-of',
400+
'relationship_entity_b_type': 'STIX Malware',
401401
"fields": [{
402402
'firstseenbysource': {
403403
"regex": r"^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})",
@@ -415,15 +415,15 @@ def test_get_indicators_without_relations():
415415
"regex": r"^.+,.+,.+,.+,(.+)",
416416
"transform": "\\1"
417417
},
418-
"relation_entity_b": {
418+
"relationship_entity_b": {
419419
"regex": r"^.+,.+,.+,.+,\"(.+)\"",
420420
"transform": "\\1"
421421
}
422422
}],
423423
}
424424
}
425425
expected_res = [{'value': '127.0.0.1', 'type': 'IP',
426-
'rawJSON': {'malwarefamily': '"Test"', 'relation_entity_b': 'Test', 'value': '127.0.0.1',
426+
'rawJSON': {'malwarefamily': '"Test"', 'relationship_entity_b': 'Test', 'value': '127.0.0.1',
427427
'type': 'IP', 'tags': []},
428428
'fields': {'tags': []}}]
429429

Packs/Base/ReleaseNotes/1_10_21.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#### Scripts
3+
##### CommonServerPython
4+
- Maintenance and stability enhancements.

0 commit comments

Comments
 (0)