From 2a3259b3387a9fec81a16adfe02602fc90b9c2c7 Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Wed, 18 Nov 2020 01:18:20 +0700 Subject: [PATCH] :hammer: Auto update readme improves --- .github/scripts/README.tmpl | 50 ++++++++++++++++++++++++++++++++ .github/scripts/update-readme.py | 19 ++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/scripts/README.tmpl create mode 100644 .github/scripts/update-readme.py diff --git a/.github/scripts/README.tmpl b/.github/scripts/README.tmpl new file mode 100644 index 0000000000..5897f992be --- /dev/null +++ b/.github/scripts/README.tmpl @@ -0,0 +1,50 @@ +f""" +# Nuclei Templates + +[![License](https://img.shields.io/badge/license-MIT-_red.svg)](https://opensource.org/licenses/MIT) +[![GitHub Release](https://img.shields.io/github/release/projectdiscovery/nuclei-templates)](https://github.com/projectdiscovery/nuclei-templates/releases) +[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/projectdiscovery/nuclei-templates/issues) +[![Follow on Twitter](https://img.shields.io/twitter/follow/pdnuclei.svg?logo=twitter)](https://twitter.com/pdnuclei) +[![Chat on Discord](https://img.shields.io/discord/695645237418131507.svg?logo=discord)](https://discord.gg/KECAGdH) + +Templates are the core of [nuclei scanner](https://github.com/projectdiscovery/nuclei) which power the actual scanning engine. This repository stores and houses various templates for the scanner provided by our team as well as contributed by the community. We hope that you also contribute by sending templates via **pull requests** or [Github issue](https://github.com/projectdiscovery/nuclei-templates/issues/new?assignees=&labels=&template=submit-template.md&title=%5Bnuclei-template%5D+) and grow the list. + +An overview of the nuclei template directory including number of templates and HTTP request associated with each directory. + +### Nuclei templates `{version}` + +| Template Directory | Number of Templates | +|----|----| +| cves | {countTpl("cves")} | +| default-credentials | {countTpl("default-credentials")} | +| dns | {countTpl("dns")} | +| files | {countTpl("files")} | +| generic-detections | {countTpl("generic-detections")} | +| panels | {countTpl("panels")} | +| security-misconfiguration | {countTpl("security-misconfiguration")} | +| subdomain-takeover | {countTpl("subdomain-takeover")} | +| technologies | {countTpl("technologies")} | +| tokens | {countTpl("tokens")} | +| vulnerabilities | {countTpl("vulnerabilities")} | +| workflows | {countTpl("workflows")} | + +### Nuclei templates `{version}` tree overview + +
+ Nuclei templates +``` +{command("tree", 1, -2)} +``` +
+ +**{command("tree", -2, None)}**. + +Please navigate to https://nuclei.projectdiscovery.io for detailed documentation to build new and your own custom templates and many example templates for easy understanding. + +------ +**Notes:** +1. Use YAMLlint (e.g. [yamllint](http://www.yamllint.com/)) to validate new templates when sending pull requests. +2. Use YAML Formatter (e.g. [jsonformatter](https://jsonformatter.org/yaml-formatter)) to format new templates when sending pull requests. + +Thanks again for your contribution and keeping the community vibrant. :heart: +""" \ No newline at end of file diff --git a/.github/scripts/update-readme.py b/.github/scripts/update-readme.py new file mode 100644 index 0000000000..c5a038b6c1 --- /dev/null +++ b/.github/scripts/update-readme.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +import argparse +import os +import subprocess + +def countTpl(path): + return len(os.listdir(path)) + +def command(args, start=None, end=None): + return "\n".join(subprocess.run(args, text=True, capture_output=True).stdout.split("\n")[start:end])[:-1] + +if __name__ == "__main__": + version = command(["git", "describe", "--tags", "--abbrev=0"]) + template = eval(open('.github/scripts/README.tmpl', 'r').read()) + + print(template) + f = open("README.md", "w") + f.write(readme) + f.close() \ No newline at end of file