From dd890a73518273c7611176c60a67d184d0b7e3d2 Mon Sep 17 00:00:00 2001 From: SMHTahsin33 <60981314+SMHTahsin33@users.noreply.github.com> Date: Tue, 12 May 2020 23:40:15 +0600 Subject: [PATCH 1/4] Update safeurl.py --- safeurl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/safeurl.py b/safeurl.py index a9be918..8585364 100644 --- a/safeurl.py +++ b/safeurl.py @@ -15,7 +15,7 @@ import re import netaddr import pycurl -import StringIO +import io # Python 2.7/3 urlparse try: @@ -707,7 +707,7 @@ def execute(self, url): self._handle.setopt(pycurl.URL, url["cleanUrl"]) # Execute the cURL request - response = StringIO.StringIO() + response = io.BytesIO() self._handle.setopt(pycurl.WRITEFUNCTION, response.write) self._handle.perform() From 4ef07a95e69d5ca1eefd8a7b65db1c157f02662e Mon Sep 17 00:00:00 2001 From: SMHTahsin33 <60981314+SMHTahsin33@users.noreply.github.com> Date: Tue, 12 May 2020 23:40:49 +0600 Subject: [PATCH 2/4] Update safeurl.py --- safeurl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/safeurl.py b/safeurl.py index 8585364..4c5ebf8 100644 --- a/safeurl.py +++ b/safeurl.py @@ -729,4 +729,5 @@ def execute(self, url): if not redirected: break - return response.getvalue() + return response.getvalue().decode('utf-8') + From 6eb060b3721d6827ab1b831f817ece36b513a6f4 Mon Sep 17 00:00:00 2001 From: SMHTahsin33 <60981314+SMHTahsin33@users.noreply.github.com> Date: Tue, 12 May 2020 23:41:20 +0600 Subject: [PATCH 3/4] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 87c8cbc..fd53ebd 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,6 @@ long_description=open('README.md').read(), author='Ben Sadeghipour', url='https://github.com/nahamsec/JSParser', - install_requires=['safeurl', 'tornado', 'jsbeautifier', + install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier', 'netaddr', 'pycurl', 'BeautifulSoup4'], ) From 311652d3dbc22d0d950b7dd49486934f7a8a79cc Mon Sep 17 00:00:00 2001 From: SMHTahsin33 <60981314+SMHTahsin33@users.noreply.github.com> Date: Tue, 12 May 2020 23:41:58 +0600 Subject: [PATCH 4/4] Update handler.py --- handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handler.py b/handler.py index dbc2d26..4b2ddc4 100644 --- a/handler.py +++ b/handler.py @@ -2,13 +2,13 @@ import tornado.ioloop, tornado.web, tornado.autoreload from tornado.escape import json_encode, json_decode -import safeurl, types, sys, re, mimetypes, glob, jsbeautifier, urlparse, pycurl +import safeurl, types, sys, re, mimetypes, glob, jsbeautifier, urllib.parse, pycurl import calendar, time, datetime from netaddr import * from collections import defaultdict from bs4 import BeautifulSoup -from cgi import escape +from html import escape #------------------------------------------------------------ # Base / Status Code Handlers