JSParser icon indicating copy to clipboard operation
JSParser copied to clipboard

Syntax Error Py2.7

Open Sicks3c opened this issue 6 years ago • 5 comments

Hello

I have an issue concerning JSParser 1 - I Cloned the repo 2 - python setup.py install 3 - pip install -r -requirements.txt 4 - python handler.py The error

Traceback (most recent call last):
  File "handler.py", line 2, in <module>
    import tornado.ioloop, tornado.web, tornado.autoreload
  File "/usr/lib/python2.7/dist-packages/tornado/ioloop.py", line 52, in <module>
    from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info, future_add_done_callback  # noqa: E501
  File "/usr/lib/python2.7/dist-packages/tornado/concurrent.py", line 48, in <module>
    import asyncio
  File "/usr/local/lib/python2.7/dist-packages/asyncio/__init__.py", line 9, in <module>
    from . import selectors
  File "/usr/local/lib/python2.7/dist-packages/asyncio/selectors.py", line 39
    "{!r}".format(fileobj)) from None
                               ^
SyntaxError: invalid syntax

What I Tried

sudo pip install --upgrade {packages} ...

Same issue

I'm using

Kali2-amd64 4.18.0 Python version 2.7.16

Sicks3c avatar Jul 29 '19 10:07 Sicks3c

I tried to switch to py3

and did these Tried py3 I changed urlparse to urllib.parse and also from StringIO import StringIO because of ImportError: No module named 'StringIO' Works like charm No syntax error but when I put js link via localhost and press JSParse I get this

HTTPServerRequest(protocol='http', host='localhost:8008', method='POST', uri='/parse/ajax', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "handler.py", line 198, in post
    data = self.parseLinks(url, headers)
  File "handler.py", line 184, in parseLinks
    file = self.fetchURL(url, headers)
  File "handler.py", line 179, in fetchURL
    res = sc.execute(url)
  File "/opt/JSParser/safeurl.py", line 714, in execute
    response = StringIO.StringIO()
AttributeError: type object '_io.StringIO' has no attribute 'StringIO'
ERROR:tornado.access:500 POST /parse/ajax (::1) 75.82ms

Any solution ?

Sicks3c avatar Jul 29 '19 11:07 Sicks3c

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

realsdx avatar Aug 18 '19 13:08 realsdx

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

I can confirm. It works with your solution.

NinjaMinjax avatar Sep 07 '19 00:09 NinjaMinjax

  2 from setuptools import setup, find_packages
  3 
  4 setup(
  5     name='JSParser',
  6     version='1.0',
  7     packages=find_packages(),
  8     description="",
  9     long_description=open('README.md').read(),
 10     author='Ben Sadeghipour',
 11     url='https://github.com/nahamsec/JSParser',
 12     install_requires=['safeurl', 'tornado<=5.1', 'jsbeautifier',
 13                       'netaddr', 'pycurl', 'BeautifulSoup4'],
 14 )

change the torando with tornado<=5.1 , it will fix the issue

stil lhave the problem.

D0N-B0T avatar Dec 06 '19 17:12 D0N-B0T

ERROR: Package 'tornado' requires a different Python 2.7.17 not in '>= 3.5' .

Problem solve: #pip install 'tornado<=5.1'

B1gD4ddy avatar Feb 25 '20 14:02 B1gD4ddy