mirror of https://github.com/MISP/misp-galaxy
new: [misp-galaxy.org] First version of misp-galaxy.org
parent
03db961dd8
commit
63bdedff47
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
python3 generator.py
|
||||
cd site
|
||||
mkdocs build
|
||||
rsync --include ".*" -v -rz --checksum site/ circl@cppz.circl.lu:/var/www/misp-galaxy.org
|
|
@ -3,6 +3,8 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
import validators
|
||||
|
||||
pathClusters = '../../clusters'
|
||||
pathSite = './site/docs'
|
||||
|
||||
|
@ -40,14 +42,63 @@ for f in galaxies_fnames:
|
|||
cluster = json.load(fr)
|
||||
cluster_filename = f.split('.')[0]
|
||||
index_output += f'- [{cluster["name"]}](./{cluster_filename}/index.md)\n'
|
||||
galaxy_output[cluster_filename] = ""
|
||||
galaxy_output[cluster_filename] = "---"
|
||||
galaxy_output[cluster_filename] += f'title: {cluster["name"]}\n'
|
||||
meta_description = cluster["description"].replace("\"", "-")
|
||||
galaxy_output[cluster_filename] += f'description: {meta_description}\n'
|
||||
galaxy_output[cluster_filename] += "---\n"
|
||||
galaxy_output[cluster_filename] += f'# {cluster["name"]}\n'
|
||||
galaxy_output[cluster_filename] += f'{cluster["description"]}\n'
|
||||
for value in cluster["values"]:
|
||||
galaxy_output[cluster_filename] += f'## {value["value"]}\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
if 'description' in value:
|
||||
galaxy_output[cluster_filename] += f'{value["description"]}\n'
|
||||
|
||||
if 'meta' in value:
|
||||
if 'synonyms' in value['meta']:
|
||||
if value['meta']['synonyms']: # some cluster have an empty list of synomyms
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f'??? info "Synonyms"\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f' "synonyms" in the meta part typically refer to alternate names or labels that are associated with a particular {cluster["name"]}.\n\n'
|
||||
galaxy_output[cluster_filename] += f' | Known Synonyms |\n'
|
||||
galaxy_output[cluster_filename] += f' |---------------------|\n'
|
||||
for synonym in sorted(value['meta']['synonyms']):
|
||||
galaxy_output[cluster_filename] += f' | `{synonym}` |\n'
|
||||
|
||||
if 'uuid' in value:
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f'??? tip "Internal MISP references"\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f' UUID `{value["uuid"]}` which can be used as unique global reference for `{value["value"]}` in MISP communities and other software using the MISP galaxy\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
|
||||
if 'meta' in value:
|
||||
if 'refs' in value['meta']:
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f'??? info "External references"\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
|
||||
for ref in value["meta"]["refs"]:
|
||||
if validators.url(ref): # some ref are not actual URL (TODO: check galaxy cluster sources)
|
||||
galaxy_output[cluster_filename] += f' - [{ref}]({ref}) - :material-archive: :material-arrow-right: [webarchive](https://web.archive.org/web/*/{ref})\n'
|
||||
else:
|
||||
galaxy_output[cluster_filename] += f' - {ref}\n'
|
||||
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
excluded_meta = ['synonyms', 'refs']
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f'??? info "Associated metadata"\n'
|
||||
galaxy_output[cluster_filename] += f'\n'
|
||||
galaxy_output[cluster_filename] += f' |Metadata key |Value|\n'
|
||||
galaxy_output[cluster_filename] += f' |---------------------|-----|\n'
|
||||
for meta in sorted(value['meta']):
|
||||
if meta in excluded_meta:
|
||||
continue
|
||||
galaxy_output[cluster_filename] += f' | `{meta}` |{value["meta"][meta]}|\n'
|
||||
|
||||
|
||||
with open(os.path.join(pathSite, 'index.md'), "w") as index:
|
||||
index.write(index_output)
|
||||
|
||||
|
|
|
@ -1,3 +1,65 @@
|
|||
site_name: MISP galaxy
|
||||
copyright: Copyright © 2015 - 2024 MISP Project - License for the <a href="https://github.com/MISP/misp-galaxy">MISP galaxy</a> is CC0 or 2-clause BSD.
|
||||
#repo_url: https://github.com/MISP/misp-galaxy - wtf is mkdocs searching for the master branch
|
||||
theme:
|
||||
name: material
|
||||
icon:
|
||||
admonition:
|
||||
note: octicons/tag-16
|
||||
abstract: octicons/checklist-16
|
||||
info: octicons/info-16
|
||||
tip: octicons/squirrel-16
|
||||
success: octicons/check-16
|
||||
question: octicons/question-16
|
||||
warning: octicons/alert-16
|
||||
failure: octicons/x-circle-16
|
||||
danger: octicons/zap-16
|
||||
bug: octicons/bug-16
|
||||
example: octicons/beaker-16
|
||||
quote: octicons/quote-16
|
||||
features:
|
||||
- navigation.footer
|
||||
- search.highlight
|
||||
- search.share
|
||||
palette:
|
||||
|
||||
# Palette toggle for automatic mode
|
||||
- media: "(prefers-color-scheme)"
|
||||
toggle:
|
||||
icon: material/brightness-auto
|
||||
name: Switch to light mode
|
||||
# Palette toggle for light mode
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
scheme: default
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
name: Switch to dark mode
|
||||
# Palette toggle for dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
scheme: slate
|
||||
toggle:
|
||||
icon: material/brightness-4
|
||||
name: Switch to system preference
|
||||
|
||||
markdown_extensions:
|
||||
- admonition
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- tables
|
||||
- attr_list
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
|
||||
extra:
|
||||
social:
|
||||
- icon: fontawesome/brands/mastodon
|
||||
link: https://misp-community.org/@misp
|
||||
- icon: fontawesome/brands/github
|
||||
link: https://github.com/misp
|
||||
generator: false
|
||||
|
||||
plugins:
|
||||
- search
|
||||
#- git-committers:
|
||||
# branch: main
|
||||
|
|
Loading…
Reference in New Issue