diff --git a/requirements.txt b/requirements.txt index bcff7ca..e5cfa8b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ passlib argon2-cffi mysql-connector-python beautifulsoup4 -lxml \ No newline at end of file +bleach \ No newline at end of file diff --git a/sites/website.py b/sites/website.py index ed3efc0..fda0f38 100644 --- a/sites/website.py +++ b/sites/website.py @@ -1,6 +1,6 @@ from flask import Flask, make_response, redirect, render_template_string, request, jsonify, render_template, send_from_directory from bs4 import BeautifulSoup -from lxml.html.clean import clean_html +import bleach def render(data): if data == "": @@ -10,9 +10,9 @@ def render(data): soup = BeautifulSoup(data, 'html.parser') for script in soup.find_all('script'): script.extract() - modified_data = str(soup) - - return render_template_string(clean_html(modified_data)) + + modified = str(soup) + return render_template_string(bleach.clean(modified)) except Exception as e: