Skip to content

Commit

Permalink
add parse version in html regexes, fix RDoc detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZ3ro committed Apr 24, 2020
1 parent 4fbd694 commit 8d15119
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion webtech/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# DON'T EDIT THIS FILE
__version__ = "1.2.7"
__version__ = "1.2.8"
13 changes: 12 additions & 1 deletion webtech/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import json
import re
import sre_constants
from io import open
from .__burp__ import BURP

Expand Down Expand Up @@ -214,9 +215,19 @@ def check_html(self, tech, html):
html = [html]

for source in html:
matches = re.search(source, self.data['html'], re.IGNORECASE)
# Parse the matching regex
attr, extra = parse_regex_string(source)
matches = None
try:
matches = re.search(attr, self.data['html'], re.IGNORECASE)
except sre_constants.error:
pass
if matches is not None:
matched_tech = Tech(name=tech, version=None)
# The version extra data is present
if extra and 'version' in extra:
if matches.group(1):
matched_tech = matched_tech._replace(version=matches.group(1))
self.report['tech'].add(matched_tech)
# this tech is matched, GOTO next
return
Expand Down
10 changes: 10 additions & 0 deletions webtech/webtech.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
".*/([\\d.]+)/scripts/microsoft.owa\\S*.js\\;version:\\1",
".*/([\\d.]+)/scripts/owa.mail.js\\;version:\\1"
]
},
"RDoc": {
"html": [
"<link[^>]+href=\"[^\"]*rdoc-style\\.css",
"Generated by <a[^>]+href=\"(?:[^>])+>RDoc<\\/a> ([\\d.]*\\d)\\;version:\\1",
"<footer(?:(?!<\\/footer>).){1,500}<p>\\s*Generated by <a href=\"https:\\/\\/ruby\\.github\\.io\\/rdoc\\/\">RDoc<\\/a> ([\\d.]*\\d)\\;version:\\1"
],
"js": {
"rdoc_rel_prefix": ""
}
}
}
}

0 comments on commit 8d15119

Please sign in to comment.