Skip to content

Commit 18b2c67

Browse files
authored
Merge pull request #151 from splunk/dependabot/pip/setuptools-gte-69.5.1-and-lt-71.0.0
Update setuptools requirement from ^69.5.1 to >=69.5.1,<71.0.0
2 parents 5ed7858 + abe2246 commit 18b2c67

File tree

12 files changed

+32
-26
lines changed

12 files changed

+32
-26
lines changed

contentctl/actions/new_content.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,21 @@ def buildDetection(self)->dict[str,Any]:
1919
answers = questionary.prompt(questions)
2020
answers.update(answers)
2121
answers['name'] = answers['detection_name']
22+
del answers['detection_name']
2223
answers['id'] = str(uuid.uuid4())
2324
answers['version'] = 1
2425
answers['date'] = datetime.today().strftime('%Y-%m-%d')
2526
answers['author'] = answers['detection_author']
27+
del answers['detection_author']
2628
answers['data_source'] = answers['data_source']
2729
answers['type'] = answers['detection_type']
30+
del answers['detection_type']
2831
answers['status'] = "production" #start everything as production since that's what we INTEND the content to become
2932
answers['description'] = 'UPDATE_DESCRIPTION'
3033
file_name = answers['name'].replace(' ', '_').replace('-','_').replace('.','_').replace('/','_').lower()
34+
answers['kind'] = answers['detection_kind']
3135
answers['search'] = answers['detection_search'] + ' | `' + file_name + '_filter`'
36+
del answers['detection_search']
3237
answers['how_to_implement'] = 'UPDATE_HOW_TO_IMPLEMENT'
3338
answers['known_false_positives'] = 'UPDATE_KNOWN_FALSE_POSITIVES'
3439
answers['references'] = ['REFERENCE']
@@ -52,7 +57,7 @@ def buildDetection(self)->dict[str,Any]:
5257
'name': "True Positive Test",
5358
'attack_data': [
5459
{
55-
'data': "Enter URL for Dataset Here. This may also be a relative or absolute path on your local system for testing.",
60+
'data': "https://github.com/splunk/contentctl/wiki",
5661
"sourcetype": "UPDATE SOURCETYPE",
5762
"source": "UPDATE SOURCE"
5863
}
@@ -65,32 +70,35 @@ def buildStory(self)->dict[str,Any]:
6570
questions = NewContentQuestions.get_questions_story()
6671
answers = questionary.prompt(questions)
6772
answers['name'] = answers['story_name']
73+
del answers['story_name']
6874
answers['id'] = str(uuid.uuid4())
6975
answers['version'] = 1
7076
answers['date'] = datetime.today().strftime('%Y-%m-%d')
7177
answers['author'] = answers['story_author']
78+
del answers['story_author']
7279
answers['description'] = 'UPDATE_DESCRIPTION'
7380
answers['narrative'] = 'UPDATE_NARRATIVE'
7481
answers['references'] = []
7582
answers['tags'] = dict()
76-
answers['tags']['analytic_story'] = answers['name']
7783
answers['tags']['category'] = answers['category']
84+
del answers['category']
7885
answers['tags']['product'] = ['Splunk Enterprise','Splunk Enterprise Security','Splunk Cloud']
7986
answers['tags']['usecase'] = answers['usecase']
87+
del answers['usecase']
8088
answers['tags']['cve'] = ['UPDATE WITH CVE(S) IF APPLICABLE']
8189
return answers
8290

8391

8492
def execute(self, input_dto: new) -> None:
8593
if input_dto.type == NewContentType.detection:
8694
content_dict = self.buildDetection()
87-
subdirectory = pathlib.Path('detections') / content_dict.get('type')
95+
subdirectory = pathlib.Path('detections') / content_dict.pop('detection_kind')
8896
elif input_dto.type == NewContentType.story:
8997
content_dict = self.buildStory()
9098
subdirectory = pathlib.Path('stories')
9199
else:
92100
raise Exception(f"Unsupported new content type: [{input_dto.type}]")
93-
101+
94102
full_output_path = input_dto.path / subdirectory / SecurityContentObject_Abstract.contentNameToFileName(content_dict.get('name'))
95103
YmlWriter.writeYmlFile(str(full_output_path), content_dict)
96104

contentctl/input/new_content_questions.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ def get_questions_detection(self) -> list:
2727
'message': 'enter author name',
2828
'name': 'detection_author',
2929
},
30-
{
31-
"type": "text",
32-
"message": "enter author name",
33-
"name": "detection_author",
34-
},
3530
{
3631
"type": "select",
3732
"message": "select a detection type",

contentctl/objects/story_tags.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class StoryUseCase(str,Enum):
1414
APPLICATION_SECURITY = "Application Security"
1515
SECURITY_MONITORING = "Security Monitoring"
1616
ADVANCED_THREAD_DETECTION = "Advanced Threat Detection"
17+
INSIDER_THREAT = "Insider Threat"
18+
OTHER = "Other"
1719

1820
class StoryTags(BaseModel):
1921
model_config = ConfigDict(extra='forbid', use_enum_values=True)

contentctl/output/conf_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def escapeNewlines(obj:Any):
3434
# Failing to do so will result in an improperly formatted conf files that
3535
# cannot be parsed
3636
if isinstance(obj,str):
37-
return obj.replace(f"\n","\\\n")
37+
return obj.replace(f"\n"," \\\n")
3838
else:
3939
return obj
4040

contentctl/output/finding_report_writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def writeFindingReport(detection : SSADetection) -> None:
5959
detection.tags.risk_level = "Critical"
6060

6161
evidence_str = "{"
62-
for i in range(len(detection.tags.observable)):
63-
evidence_str = evidence_str + '"' + detection.tags.observable[i]["name"] + '": ' + detection.tags.observable[i]["name"].replace(".", "_")
64-
if not i == (len(detection.tags.observable) - 1):
62+
for i in range(len(detection.tags.required_fields)):
63+
evidence_str = evidence_str + '"' + detection.tags.required_fields[i] + '": ' + detection.tags.required_fields[i].replace(".", "_")
64+
if not i == (len(detection.tags.required_fields) - 1):
6565
evidence_str = evidence_str + ', '
6666

6767
evidence_str = evidence_str + ', "sourceType": metadata.source_type, "source": metadata.source}'

contentctl/output/templates/es_investigations_investigations.j2

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,32 @@ disabled = 0
77
tokens = {\
88
{% for token in response_task.inputs %}
99
{% if token == 'user' %}
10-
"user": {\
11-
"valuePrefix": "\"",\
12-
"valueSuffix": "\"",\
13-
"delimiter": " OR {{ token }}=",\
14-
"valueType": "primitive",\
15-
"value": "identity",\
16-
"default": "null"\
17-
}\{% elif token == 'dest'%}
10+
"user": {\
11+
"valuePrefix": "\"",\
12+
"valueSuffix": "\"",\
13+
"delimiter": " OR {{ token }}=",\
14+
"valueType": "primitive",\
15+
"value": "identity",\
16+
"default": "null"\
17+
}{% elif token == 'dest'%}
1818
"dest": {\
1919
"valuePrefix": "\"",\
2020
"valueSuffix": "\"",\
2121
"delimiter": " OR {{ token }}=",\
2222
"valueType": "primitive",\
2323
"value": "asset",\
2424
"default": "null"\
25-
}\{% else %}
25+
}{% else %}
2626
"{{ token }}": {\
2727
"valuePrefix": "\"",\
2828
"valueSuffix": "\"",\
2929
"delimiter": " OR {{ token }}=",\
3030
"valueType": "primitive",\
3131
"value": "file",\
3232
"default": "null"\
33-
}\{% endif %}{{ "," if not loop.last }}
33+
}{% endif %}{{ "," if not loop.last }}\
3434
{% endfor %}
35-
}\
35+
}\
3636

3737

3838
{% endfor %}

contentctl/templates/detections/application/.gitkeep

Whitespace-only changes.

contentctl/templates/detections/cloud/.gitkeep

Whitespace-only changes.
File renamed without changes.

contentctl/templates/detections/network/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)