Skip to content

Commit

Permalink
Start work on the generation of the offline site
Browse files Browse the repository at this point in the history
  • Loading branch information
righettod committed Feb 2, 2019
1 parent 858f4a3 commit 303972e
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# Audit result files
*.out
*.out
# Website generation stuff
node_modules/
_site/
SUMMARY.md
15 changes: 15 additions & 0 deletions Preface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
![LogoOffical](https://github.com/OWASP/owasp-swag/raw/master/projects/cheat-sheet-series/owasp-1.png)

The **OWASP Cheat Sheet Series** was created to provide a concise collection of high value information on specific application security topics. These cheat sheets were created by various application security professionals who have expertise in specific topics.

We hope that this project provides you with excellent security guidance in an easy to read format.

Project leaders:
- [Jim Manico](https://www.owasp.org/index.php/User:Jmanico).
- [Dominique Righetto](https://www.owasp.org/index.php/User:Dominique_RIGHETTO).

Project links:
- [Homepage](https://www.owasp.org/index.php/OWASP_Cheat_Sheet_Series).
- [GitHub repository](https://github.com/OWASP/CheatSheetSeries).
- [How to contribute?](https://github.com/OWASP/CheatSheetSeries#how-to-contribute)
- [Logo](https://github.com/OWASP/owasp-swag/tree/master/projects/cheat-sheet-series).
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ This [Index](Index.md) reference all migrated and released cheat sheets.
**.github**:
* Contains materials used to configure different behaviors of GitHub.

# Offline website

Unfortunately, a PDF file generation is not possible because the content is cut in some cheat sheet like for example the abuse case one.

However, to propose the possibility the consult, in a full offline mode, the collection of all cheat sheets, a script to generate a offline site *is under creation* using [GitBook](https://toolchain.gitbook.com/).

* **book.json**: Gitbook configuration file.
* **Preface.md**: Project preface description applied on the generated site.

# Conversion rules

* Use the markdown syntax described in this [guide](https://guides.github.com/features/mastering-markdown/).
Expand Down
12 changes: 12 additions & 0 deletions book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": "./cheatsheets",
"plugins": [
"anchors"
],
"structure": {
"readme": "Preface.md"
},
"title": "OWASP Cheat Sheet Series",
"language": "en",
"description": "Website with the collection of all the cheat sheets of the project."
}
28 changes: 28 additions & 0 deletions scripts/Generate_CheatSheets_Summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python3 script to generate the summary markdown page that is used
by GitBook to generate the offline website.
The summary markdown page is located in the "cheatsheets" folder
and is named "SUMMARY.md".
"""
import os

# Define templates
cs_md_link_template = "* [%s](%s)"

# Scan all CS files
cheatsheets = [f.name for f in os.scandir("../cheatsheets") if f.is_file()]
cheatsheets.sort()

# Generate the summary file
with open("../cheatsheets/SUMMARY.md", "w") as index_file:
index_file.write("# Summary\n\n")
index_file.write("### Cheatsheets\n\n")
for cheatsheet in cheatsheets:
if cheatsheet != "SUMMARY.md":
cs_name = cheatsheet.replace("_"," ").replace(".md", "")
index_file.write(cs_md_link_template % (cs_name, cheatsheet))
index_file.write("\n")
print("Summary markdown page generated.")
21 changes: 21 additions & 0 deletions scripts/Generate_Site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Dependencies:
# sudo apt install -y nodejs
# sudo npm install gitbook-cli -g
# Note:
# PDF generation is not possible because the content is cutted in
# some CS like for example the abuse case one
WORK=_site
echo "Generate a offline portable website with all the cheat sheets..."
echo "Step 1/2: Generate the summary markdown page."
python Generate_CheatSheets_Summary.py
echo "Step 2/2: Generate the site."
cd ..
rm -rf $WORK 1>/dev/null 2>&1
cp Preface.md cheatsheets/.
gitbook install
gitbook build . $WORK --log=info
rm cheatsheets/Preface.md
rm cheatsheets/SUMMARY.md
rm -rf node_modules
echo "Generation finished to the folder: $WORK"
2 changes: 1 addition & 1 deletion scripts/Update_CheatSheets_Index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Python3 script to generate the index markdown page that
reference all cheat sheets grouped by the first letter.
The index markdown page is loacted on the root folder
The index markdown page is located on the root folder
and is named "Index.md".
"""
import os
Expand Down

0 comments on commit 303972e

Please sign in to comment.