Skip to content

Commit

Permalink
Merge pull request #991 from Johann-PLW/main
Browse files Browse the repository at this point in the history
Remove 'version' and add 'last_update_date' in artifact_v2
  • Loading branch information
Johann-PLW authored Dec 17, 2024
2 parents 432d64f + 5d28ffe commit 57ce3a6
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 17 deletions.
12 changes: 6 additions & 6 deletions admin/docs/artifact_info_block.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ __artifacts_v2__ = {
"name": "Human-readable name of the artifact",
"description": "Brief description of what the artifact does",
"author": "@AuthorUsername",
"version": "X.Y",
"date": "YYYY-MM-DD",
"creation_date": "YYYY-MM-DD",
"last_update_date": "YYYY-MM-DD",
"requirements": "Any specific requirements, or 'none'",
"category": "Category of the artifact",
"notes": "Additional notes, if any",
Expand All @@ -26,8 +26,8 @@ __artifacts_v2__ = {
- `name`: A human-readable name for the artifact as it will be displayed in the output files
- `description`: A brief explanation of what the artifact extracts or analyzes
- `author`: The name and/or username of the module's author
- `version`: The current version of the module script
- `date`: The creation date of the module in YYYY-MM-DD format
- `creation_date`: The creation date of the module in YYYY-MM-DD format
- `last_update_date`: The last update of the module in YYYY-MM-DD format
- `requirements`: Any specific requirements for the artifact, or "none" if there are no special requirements
- `category`: The category the artifact belongs to
- `notes`: Any additional information about the artifact (can be an empty string)
Expand Down Expand Up @@ -58,8 +58,8 @@ __artifacts_v3__ = {
"name": "Human-readable name of the module",
"description": "Brief description of what the module does",
"author": "@AuthorUsername",
"version": "X.Y",
"date": "YYYY-MM-DD",
"creation_date": "YYYY-MM-DD",
"last_update_date": "YYYY-MM-DD",
"requirements": "Any specific requirements, or 'none'",
"app_name": "Name of the app this module parses data from",
"category": "Category of the artifact",
Expand Down
4 changes: 2 additions & 2 deletions admin/docs/features/file_search_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ The current file search architecture in iLEAPP is structured as follows:
"name": "Artifact Display Name",
"description": "Artifact description",
"author": "@AuthorUsername",
"version": "1.0",
"date": "2023-05-24",
"creation_date": "2023-05-24",
"last_update_date": "2024-12-17",
"requirements": "none",
"category": "Category",
"notes": "",
Expand Down
4 changes: 2 additions & 2 deletions admin/docs/module_updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ __artifacts_v2__ = {
"name": "Human-readable Artifact Name",
"description": "Brief description of what the artifact does",
"author": "@AuthorUsername",
"version": "1.0",
"date": "2023-05-24",
"creation_date": "2023-05-24",
"last_update_date": "2024-12-17",
"requirements": "none",
"category": "Artifact Category",
"notes": "",
Expand Down
30 changes: 27 additions & 3 deletions admin/scripts/module_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def extract_v2_info(module_content):
"description": clean_string(str(e)),
"paths": "",
"output_types": "",
"version": "",
"last_update_date": "",
"artifact_icon": ""
}]

Expand All @@ -56,13 +58,17 @@ def extract_v2_info(module_content):
else:
output_types = ""

version = details.get("version", "")
last_update_date = details.get("last_update_date", "")
artifact_icon = details.get("artifact_icon", "")
results.append({
"artifact": artifact_name,
"name": clean_string(details.get("name", "")),
"description": clean_string(details.get("description", "")),
"paths": paths,
"output_types": output_types,
"version": version,
"last_update_date": last_update_date,
"artifact_icon": artifact_icon
})
return results
Expand Down Expand Up @@ -95,8 +101,8 @@ def parse_module_file(module_path):

def generate_v2_markdown_table(artifact_data):
"""Generate a markdown table for v2 artifacts."""
table = "| Module | Artifact | Name | Output Types | Icon | Description | Paths |\n"
table += "|--------|----------|------|--------------|------|-------------|-------|\n"
table = "| Module | Artifact | Name | Output Types | Icon | Version | Last Update Date | Description | Paths |\n"
table += "|--------|----------|------|--------------|------|---------|------------------|-------------|-------|\n"
for module, artifacts in artifact_data.items():
module_link = f"[{module}](https://github.com/abrignoni/iLEAPP/blob/main/scripts/artifacts/{module})"
for artifact in artifacts:
Expand All @@ -109,7 +115,9 @@ def generate_v2_markdown_table(artifact_data):
paths = f'`{paths}`'
output_types = artifact.get('output_types', '-')
artifact_icon = artifact.get('artifact_icon', '')
table += f"| {module_link} | {artifact['artifact']} | {name} | {output_types} | {artifact_icon} | {description} | {paths} |\n"
version = artifact.get('version', '')
last_update_date = artifact.get('last_update_date', '')
table += f"| {module_link} | {artifact['artifact']} | {name} | {output_types} | {artifact_icon} | {version} | {last_update_date} | {description} | {paths} |\n"

return table

Expand Down Expand Up @@ -153,6 +161,20 @@ def update_markdown_file(v1_data, v2_data, error_data):
if artifact.get('artifact_icon')
)

# Count modules using 'version'
version_count = sum(
1 for artifacts in v2_data.values()
for artifact in artifacts
if artifact.get('version')
)

# Count modules using 'artifact_icon'
last_update_date_count = sum(
1 for artifacts in v2_data.values()
for artifact in artifacts
if artifact.get('last_update_date')
)

with open(MD_FILE_PATH, 'r') as md_file:
content = md_file.read()

Expand All @@ -167,6 +189,8 @@ def update_markdown_file(v1_data, v2_data, error_data):
new_module_info += f"Number of v2 artifacts: {v2_count} \n"
new_module_info += f"Number of modules with 'lava output': {lava_output_count} \n"
new_module_info += f"Number of modules using 'artifact_icon': {artifact_icon_count} \n"
new_module_info += f"Number of modules using 'version': {version_count} \n"
new_module_info += f"Number of modules using 'last_update_date': {last_update_date_count} \n"
new_module_info += f"Number of modules with errors or no recognized artifacts: {error_count} \n\n"

if v2_data:
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/accountConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"name": "Account Configuration",
"description": "Extracts account configuration information",
"author": "@AlexisBrignoni",
"version": "0.2.3",
"date": "2020-04-30",
"creation_date": "2020-04-30",
"last_update_date": "2024-12-17",
"requirements": "none",
"category": "Accounts",
"notes": "",
Expand Down
4 changes: 2 additions & 2 deletions scripts/artifacts/accountData.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"name": "Account Data",
"description": "Configured user accounts",
"author": "@AlexisBrignoni",
"version": "0.4.3",
"date": "2020-04-30",
"creation_date": "2020-04-30",
"last_update_date": "2024-12-17",
"requirements": "none",
"category": "Accounts",
"notes": "",
Expand Down

0 comments on commit 57ce3a6

Please sign in to comment.