From 72d9b0f77016ff0058a2bda873c7bd71caa8649e Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 10 Mar 2026 18:41:22 -0700 Subject: add csp hash test --- tests/test-csp-hash.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/test-csp-hash.py (limited to 'tests/test-csp-hash.py') diff --git a/tests/test-csp-hash.py b/tests/test-csp-hash.py new file mode 100644 index 0000000..8401979 --- /dev/null +++ b/tests/test-csp-hash.py @@ -0,0 +1,10 @@ +import sys, re, hashlib, base64 +html = open(sys.argv[1]).read() +match = re.search(r']*>(.*?)', html, re.DOTALL | re.IGNORECASE) +if match: + content = match.group(1).encode('utf-8') + print(base64.b64encode(hashlib.sha256(content).digest()).decode()) + exit(0) +else: + print('Error: Still could not find a