Skip to content

Commit

Permalink
Improve structuring scripts and flatten nav (#2803)
Browse files Browse the repository at this point in the history
* optimize structure scripts and flatten nav for MASTG

* Optimize structure scripts and flatten nav for MASVS

---------

Co-authored-by: Jeroen Beckers <info@dauntless.be>
  • Loading branch information
cpholguera and TheDauntless committed Jul 13, 2024
1 parent 2b46e51 commit eab8800
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ logs
*.docx
*.epub
docs/MASVS/**/
docs/MASVS/*-MASVS-*.md
docs/MASVS/*-*.md
docs/MASTG/**/
docs/MASTG/0x*.md
docs/assets/Images
docs/checklists/MASVS-*.md
docs/talks.md
Expand Down
19 changes: 9 additions & 10 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ nav:
- MASTG:
- MASTG/index.md
- Intro:
- ... | flat | MASTG/Intro/*.md
- ... | flat | MASTG/References/*.md
- Theory:
- General Concepts:
- ... | flat | MASTG/General/*.md
- Android Security Testing:
- ... | flat | MASTG/Android/*.md
- iOS Security Testing:
- ... | flat | MASTG/iOS/*.md
- ... | flat | MASTG/0x0[1-2]*.md # Overview of the project (0x03) is redundant in the web.
- ... | flat | MASTG/0x09*.md
- General Concepts:
- ... | flat | MASTG/0x04*.md
- Android Security Testing:
- ... | flat | MASTG/0x05*.md
- iOS Security Testing:
- ... | flat | MASTG/0x06*.md
- Tests:
- MASTG/tests/index.md
- Android:
Expand Down Expand Up @@ -173,7 +172,7 @@ nav:
- MASVS:
- MASVS/index.md
- Intro:
- ... | flat | MASVS/Intro/*
- ... | flat | MASVS/0[1-4]*.md
- MASVS-STORAGE: MASVS/05-MASVS-STORAGE.md
- ... | flat | MASVS/controls/MASVS-STORAGE*.md
- MASVS-CRYPTO: MASVS/06-MASVS-CRYPTO.md
Expand Down
34 changes: 10 additions & 24 deletions src/scripts/structure_mastg.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
#!/bin/bash

mkdir -p docs/MASTG/Intro
mkdir -p docs/MASTG/General
mkdir -p docs/MASTG/Android
mkdir -p docs/MASTG/iOS
mkdir -p docs/MASTG/References
mkdir -p docs/MASTG/rules
mkdir -p docs/MASWE

cp Document/0x0[1-6]*.md docs/MASTG
cp Document/0x09*.md docs/MASTG
cp -r tests docs/MASTG/
cp -r techniques docs/MASTG/
cp -r tools docs/MASTG/
cp -r apps docs/MASTG/
cp -r weaknesses/** docs/MASWE/
cp -r tests-beta docs/MASTG/
cp -r demos docs/MASTG/
cp -r rules docs/MASTG/
directories=("tests" "techniques" "tools" "apps" "tests-beta" "demos" "rules")

for dir in "${directories[@]}"; do
cp -r "$dir" docs/MASTG/ || { echo "Failed to copy $dir"; exit 1; }
done

cp -r weaknesses/** docs/MASWE/ || { echo "Failed to copy weaknesses"; exit 1; }

cp -r Document/0x0*.md docs/MASTG
cp docs/MASTG/0x08b-Reference-Apps.md docs/MASTG/apps/index.md
cp docs/MASTG/0x08a-Testing-Tools.md docs/MASTG/tools/index.md
cp Document/tests.md docs/MASTG/tests/index.md
cp Document/0x08b-Reference-Apps.md docs/MASTG/apps/index.md
cp Document/0x08a-Testing-Tools.md docs/MASTG/tools/index.md
cp Document/techniques.md docs/MASTG/techniques/index.md

mv docs/MASTG/0x0[1-3]*.md docs/MASTG/Intro
mv docs/MASTG/0x04*.md docs/MASTG/General
mv docs/MASTG/0x05*.md docs/MASTG/Android
mv docs/MASTG/0x06*.md docs/MASTG/iOS
mv docs/MASTG/0x09*.md docs/MASTG/Intro

if [[ "$(uname)" == "Darwin" ]]; then
SED="gsed"
else
Expand Down
14 changes: 5 additions & 9 deletions src/scripts/structure_masvs.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
if [ -d "../owasp-masvs/" ] ; then
MASVS_DIR=../owasp-masvs
elif [ ! -d "../owasp-masvs/" ] ; then
elif [ -d "./owasp-masvs/" ] ; then
MASVS_DIR=./owasp-masvs
else
echo "Error: Please clone owasp-masvs to same directory as owasp-mastg"
exit
echo "Error: Please clone owasp-masvs to same directory as owasp-mastg: cd .. && git clone https://github.com/OWASP/owasp-masvs.git"
exit 1
fi

mkdir -p docs/MASVS/Intro
mkdir -p docs/MASVS/controls
cp $MASVS_DIR/Document/*.md docs/MASVS
mv docs/MASVS/0[1-4]*.md docs/MASVS/Intro
cp $MASVS_DIR/controls/* docs/MASVS/controls
cp -r $MASVS_DIR/Document/*-*.md docs/MASVS/
cp -r $MASVS_DIR/controls/ docs/MASVS/controls/

if [[ "$(uname)" == "Darwin" ]]; then
SED="gsed"
else
SED="sed"
fi


mkdir -p docs/assets/Images/MASVS
cp $MASVS_DIR/Document/images/* docs/assets/Images/MASVS
$SED -i "s#images/#../../../assets/Images/MASVS/#g" docs/MASVS/**/*.md
Expand Down

0 comments on commit eab8800

Please sign in to comment.