aboutsummaryrefslogtreecommitdiff
path: root/generate-html.sh
diff options
context:
space:
mode:
Diffstat (limited to 'generate-html.sh')
-rwxr-xr-xgenerate-html.sh64
1 files changed, 0 insertions, 64 deletions
diff --git a/generate-html.sh b/generate-html.sh
deleted file mode 100755
index 1faeaf4..0000000
--- a/generate-html.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-
-usage() {
- printf "%s\n" \
- "generate html page for available pocs" \
- "usage: $(basename ${0}) -o </path/to/output/dir> -p <path/to/pocs/dir>"
- exit 1
-}
-
-while getopts "o:p:h" opts; do
- case "${opts}" in
- o) output="${OPTARG}";;
- p) pocs="${OPTARG}";;
- h) usage;;
- *) usage;;
- esac
-done
-
-if test "${output}" && test "${pocs}"; then
- date=$(date -u "+%Y-%m-%d %H:%M:%S")
- mkdir -p "${output}" &>/dev/null
-
- if test -d pandoc/assets; then
- cp -r pandoc/assets "${output}"
- else
- printf "%s\n" "[err] pandoc/assets/ dir not found"
- exit 1
- fi
-
- if command -v pandoc &>/dev/null; then
- count=$(cat "${pocs}/README.md" | wc -l)
- size=$(du -sh "${pocs}" | awk '{print $1}')
- if (tac "${pocs}/README.md" | pandoc \
- -s \
- --toc \
- --metadata "title=cve proof of concepts" \
- --metadata "date=${date} utc" \
- --metadata "rss_url=https://cve.heqnx.com/feed.xml" \
- --metadata "count=${count}" \
- --metadata "size=${size}" \
- --template pandoc/template.html \
- --lua-filter=pandoc/add-target-blank.lua \
- -o "${output}/index.html"); then \
- printf "%s\n" "[inf] successfully generated html"
- else
- printf "%s\n" "[err] error generating html"
- fi
-
- if command -v tidy &>/dev/null; then
- if tidy --indent yes --wrap 0 -m --quiet yes --indent-spaces 2 --tidy-mark no "${output}/index.html"; then
- printf "%s\n" "[inf] prettified html"
- else
- printf "%s\n" "[err] failed to prettify html"
- fi
- else
- printf "%s\n" "[warn] tidy not found, skipping html prettify"
- fi
- else
- printf "%s\n" "[err] pandoc not found"
- exit 1
- fi
-else
- usage
-fi