diff --git a/requirements.txt b/requirements.txt index 81354d0..f1de7fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ email-validator py3dns passlib argon2-cffi -mysql-connector-python \ No newline at end of file +mysql-connector-python +beautifulsoup4 \ No newline at end of file diff --git a/sites/website.py b/sites/website.py index c9c9f25..0e98794 100644 --- a/sites/website.py +++ b/sites/website.py @@ -1,8 +1,17 @@ from flask import Flask, make_response, redirect, render_template_string, request, jsonify, render_template, send_from_directory - +from bs4 import BeautifulSoup def render(data): if data == "": return "No data found for this domain" - return render_template_string(data) \ No newline at end of file + try: + soup = BeautifulSoup(data, 'html.parser') + for script in soup.find_all('script'): + script.extract() + modified_data = str(soup) + return render_template_string(modified_data) + + + except Exception as e: + return "

Invalid HTML


" + str(e) \ No newline at end of file