From 8d15119f34ab1742437251c9683d18291ab26d5b Mon Sep 17 00:00:00 2001 From: thezero Date: Fri, 24 Apr 2020 12:54:38 +0200 Subject: [PATCH] add parse version in html regexes, fix RDoc detection --- webtech/__version__.py | 2 +- webtech/target.py | 13 ++++++++++++- webtech/webtech.json | 10 ++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/webtech/__version__.py b/webtech/__version__.py index 5214924..72dad44 100644 --- a/webtech/__version__.py +++ b/webtech/__version__.py @@ -1,2 +1,2 @@ # DON'T EDIT THIS FILE -__version__ = "1.2.7" +__version__ = "1.2.8" diff --git a/webtech/target.py b/webtech/target.py index ac9a46a..53b2ede 100644 --- a/webtech/target.py +++ b/webtech/target.py @@ -3,6 +3,7 @@ import sys import json import re +import sre_constants from io import open from .__burp__ import BURP @@ -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 diff --git a/webtech/webtech.json b/webtech/webtech.json index 0c624f9..32d09d8 100644 --- a/webtech/webtech.json +++ b/webtech/webtech.json @@ -31,6 +31,16 @@ ".*/([\\d.]+)/scripts/microsoft.owa\\S*.js\\;version:\\1", ".*/([\\d.]+)/scripts/owa.mail.js\\;version:\\1" ] + }, + "RDoc": { + "html": [ + "]+href=\"[^\"]*rdoc-style\\.css", + "Generated by ]+href=\"(?:[^>])+>RDoc<\\/a> ([\\d.]*\\d)\\;version:\\1", + ").){1,500}

\\s*Generated by RDoc<\\/a> ([\\d.]*\\d)\\;version:\\1" + ], + "js": { + "rdoc_rel_prefix": "" + } } } } \ No newline at end of file