From 3f46fee699fa77945789f6cdbb56397c785a5e16 Mon Sep 17 00:00:00 2001 From: Peter Chubb Date: Sat, 15 Feb 2025 20:20:47 +1100 Subject: [PATCH] Fix syntax for Python 3.12 Backslash needs escaping now. Otherwise one sees: .../XSStrike/core/dom.py:27: SyntaxWarning: invalid escape sequence '\$' controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\$')) .../XSStrike/core/dom.py:36: SyntaxWarning: invalid escape sequence '\$' controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\$')) Signed-off-by: Peter Chubb --- core/dom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/dom.py b/core/dom.py index 405df78..ab628b0 100644 --- a/core/dom.py +++ b/core/dom.py @@ -24,7 +24,7 @@ def dom(response): for part in parts: for controlledVariable in allControlledVariables: if controlledVariable in part: - controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\$')) + controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\\$')) pattern = re.finditer(sources, newLine) for grp in pattern: if grp: @@ -33,7 +33,7 @@ def dom(response): if len(parts) > 1: for part in parts: if source in part: - controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\$')) + controlledVariables.add(re.search(r'[a-zA-Z$_][a-zA-Z0-9$_]+', part).group().replace('$', '\\$')) line = line.replace(source, yellow + source + end) for controlledVariable in controlledVariables: allControlledVariables.add(controlledVariable)