From ec1b57093ede1f726ba34a10dfd8ce17ad4de864 Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:36:31 +0600 Subject: [PATCH 1/6] Update safeurl.py --- safeurl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/safeurl.py b/safeurl.py index a9be918..0fe866c 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() @@ -729,4 +729,4 @@ def execute(self, url): if not redirected: break - return response.getvalue() + return response.getvalue().decode('utf-8') From 9c8f963057803e694fe37ee45d317e50e24c759e Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:39:11 +0600 Subject: [PATCH 2/6] Update handler.py --- handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.py b/handler.py index dbc2d26..789c41c 100644 --- a/handler.py +++ b/handler.py @@ -8,7 +8,7 @@ from netaddr import * from collections import defaultdict from bs4 import BeautifulSoup -from cgi import escape +from html import escape #------------------------------------------------------------ # Base / Status Code Handlers From 42ed184df64f603a10e36465ec59cf3b2ea98f83 Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:40:39 +0600 Subject: [PATCH 3/6] Update handler.py --- handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.py b/handler.py index 789c41c..4b2ddc4 100644 --- a/handler.py +++ b/handler.py @@ -2,7 +2,7 @@ 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 b8989536b2cf4c76beb2260feaf1f9c8d15bbc1d Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:55:08 +0600 Subject: [PATCH 4/6] 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 5ca207421fc26ef1e5ececa65fffa32cc6a5c125 Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:55:35 +0600 Subject: [PATCH 5/6] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 337b4a6..da13f86 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ safeurl -tornado +tornado<=5.1 jsbeautifier netaddr pycurl -BeautifulSoup4 \ No newline at end of file +BeautifulSoup4 From f3461ec8ee52ce4700f88344327d48b27236b569 Mon Sep 17 00:00:00 2001 From: Aits <45327979+tamjid1971@users.noreply.github.com> Date: Thu, 11 Feb 2021 07:57:18 +0600 Subject: [PATCH 6/6] update python2.7 to python3+ --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c95f37b..eb899fa 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A python 2.7 script using Tornado and JSBeautifier to parse relative URLs from J # Installing ``` -$ python setup.py install +$ python3 setup.py install ``` # Running @@ -19,7 +19,7 @@ $ python setup.py install Run `handler.py` and then visit http://localhost:8008. ``` -$ python handler.py +$ python3 handler.py ``` # Authors @@ -38,4 +38,4 @@ $ python handler.py # Changelog -1.0 - Release \ No newline at end of file +1.0 - Release