new: [doc] Added script to generate galaxy section from repo

pull/137/head
Steve Clement 2018-11-26 15:06:13 +09:00
parent 0ad440c58c
commit f554f50058
2 changed files with 37 additions and 0 deletions

View File

@ -68,6 +68,8 @@ Clicking on the addition symbol on the left of Beijing Group extends the module.
### Available Galaxies ### Available Galaxies
<!-- NB. This list is generated dynamically with gen-doc.sh included in this directory. -->
#### Clusters #### Clusters
[Android](https://github.com/MISP/misp-galaxy/blob/master/clusters/android.json) - Android malware galaxy based on multiple open sources. [Android](https://github.com/MISP/misp-galaxy/blob/master/clusters/android.json) - Android malware galaxy based on multiple open sources.

35
galaxy/gen-doc.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# This generates some of the sections of the Galaxy Documentation
# Dependencies: git, jq, bash
if [[ ! -d "misp-galaxy" ]]; then
git clone https://github.com/MISP/misp-galaxy.git
cd misp-galaxy
else
cd misp-galaxy
git pull
fi
FOLDERS='clusters vocabularies/common vocabularies/threat-actor'
for folder in ${FOLDERS}; do
cd $folder
for file in $(ls |grep -v README); do
Name=$(echo ${file} |cut -f 1 -d.| tr '-' ' '| tr '_' ' ')
Name=$(tr '[:lower:]' '[:upper:]' <<< ${Name:0:1})${Name:1}
Description=$(jq -r .description ${file})
echo "[${Name}](https://github.com/MISP/misp-galaxy/blob/master/${folder}/${file}) - ${Description}"
echo ""
done
echo "------------------------------------------------------------------------------------"
echo "$folder done"
echo "------------------------------------------------------------------------------------"
# This is ugly, but works... fix it if you do not like it.
if [[ $folder == *'/'* ]]; then
cd ../..
else
cd ..
fi
done