Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JSParser

A python 2.7 script using Tornado and JSBeautifier to parse relative URLs from JavaScript files. Useful for easily discovering AJAX requests when performing security research or bug bounty hunting.
A python 3 script using Tornado and JSBeautifier to parse relative URLs from JavaScript files. Useful for easily discovering AJAX requests when performing security research or bug bounty hunting.

# Dependencies

Expand Down Expand Up @@ -38,4 +38,4 @@ $ python handler.py

# Changelog

1.0 - Release
1.0 - Release
4 changes: 2 additions & 2 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions safeurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re
import netaddr
import pycurl
import StringIO
import io

# Python 2.7/3 urlparse
try:
Expand Down Expand Up @@ -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()

Expand All @@ -729,4 +729,4 @@ def execute(self, url):
if not redirected:
break

return response.getvalue()
return response.getvalue().decode('utf-8')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
)