nuclei-templates/.github/scripts/update-readme.py

24 lines
655 B
Python
Raw Permalink Normal View History

2020-11-17 18:18:20 +00:00
#!/usr/bin/env python3
import glob
2020-11-17 18:18:20 +00:00
import subprocess
def countTpl(path):
return len(glob.glob(path + "/*.*"))
2020-11-17 18:18:20 +00:00
def command(args, start=None, end=None):
return "\n".join(subprocess.run(args, text=True, capture_output=True).stdout.split("\n")[start:end])[:-1]
2021-07-20 07:50:15 +00:00
def get_top10():
2021-07-20 13:03:13 +00:00
HEADER = "## Nuclei Templates Top 10 statistics\n\n"
2021-07-20 07:50:15 +00:00
TOP10 = command(["cat", "TOP-10.md"])
2021-07-20 07:57:07 +00:00
return HEADER + TOP10 if len(TOP10) > 0 else ""
2021-07-20 07:50:15 +00:00
2020-11-17 18:18:20 +00:00
if __name__ == "__main__":
version = command(["git", "describe", "--tags", "--abbrev=0"])
2020-11-17 18:55:17 +00:00
template = eval(open(".github/scripts/README.tmpl", "r").read())
2020-11-17 18:18:20 +00:00
print(template)
f = open("README.md", "w")
2020-11-17 18:26:27 +00:00
f.write(template)
2020-11-17 18:55:17 +00:00
f.close()