new tidy_docs checks

This commit is contained in:
h00die
2020-04-02 19:10:39 -04:00
parent 87245b9f7a
commit f9ecbc2179
+18
View File
@@ -210,6 +210,7 @@ class MsftidyDoc
def line_checks
idx = 0
in_codeblock = false
in_options = false
@lines.each do |ln|
idx += 1
@@ -218,6 +219,23 @@ class MsftidyDoc
in_codeblock = !in_codeblock
end
if ln =~ /## Options/
in_options = true
end
if ln =~ /## Scenarios/ || (in_options && ln =~ /$\s*## /) # we're not in options anymore
# we set a hard false here because there isn't a guarantee options exists
in_options = false
end
if in_options && ln =~ /^\s*\*\*[a-z]+\*\*$/i # catch options in old format like **command** instead of ### comand
warn("Options should use ### instead of bolds (**)", idx)
end
# this will catch either bold or h2/3 universal options. Defaults aren't needed since they're not unique to this exploit
if in_options && ln =~ /^\s*[\*#]{2,3}\s*(rhost|rport|lport|lhost|srvhost|srvport|ssl|uripath|session|proxies|payload)\*{0,2}$/i
warn('Universal options such as rhost(s), rport, lport, lhost, srvhost, srvport, ssl, uripath, session, proxies, payload can be removed.', idx)
end
# find spaces at EOL not in a code block which is ``` or starts with four spaces
if !in_codeblock && ln =~ /[ \t]$/ && !(ln =~ /^ /)
warn("Spaces at EOL", idx)