Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pypi package to python 3 support #12

Open
Thoiz opened this issue Sep 24, 2018 · 6 comments
Open

Update pypi package to python 3 support #12

Thoiz opened this issue Sep 24, 2018 · 6 comments

Comments

@Thoiz
Copy link

Thoiz commented Sep 24, 2018

Hi, just encountered following problem installing PyJFuzz via pypi:

Collecting PyJFuzz
  Using cached https://files.pythonhosted.org/packages/14/19/214133aed1469969c0797bc74335350b061a2e55955e299bf7621aa21904/PyJFuzz-1.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/2l/j15h25hx1bn5k9jwms0_ml380000gn/T/pip-build-kltwdnv8/PyJFuzz/setup.py", line 25, in <module>
        import commands
    ModuleNotFoundError: No module named 'commands'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2l/j15h25hx1bn5k9jwms0_ml380000gn/T/pip-build-kltwdnv8/PyJFuzz/

I assume the package is not up to date with the latest version available on Github, because the manual installation via the repository works just fine with Python 3. The problem only occurs with Python 3.

@Akendo
Copy link

Akendo commented Apr 23, 2019

I've took the time to update the setup.py file from the installation path. There needs to be two lines change in the file. The command module is not supported in Python3. I've updated it to use subprocess instead. Attach you can see the fixed version.

"""
The MIT License (MIT)

Copyright (c) 2016 Daniele Linguaglossa <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from setuptools import setup
import subprocess
import os

def get_package_data():
    data = ['core/certs/server.pem', 'core/conf/config.json']
    cur_dir = os.getcwd()
    os.chdir("pyjfuzz")
    data.extend(subprocess.check_output(["find","core/tools", "-name","*.*"]).decode("utf-8").split('\n'))
    os.chdir(cur_dir)
    return data


setup(
    name="PyJFuzz",
    version="1.1.1",
    author="Daniele Lingualossa",
    author_email="[email protected]",
    description="Trivial JSON fuzzer written in python",
    license="MIT",
    keywords="",
    url="https://github.com/mseclab/PyJFuzz",
    packages=["pyjfuzz",
              "pyjfuzz.core",
              "pyjfuzz.core.errors",
              "pyjfuzz.core.certs",
              "pyjfuzz.core.conf",
              "pyjfuzz.core.tools",
              "pyjfuzz.core.patch"],
    package_data={'pyjfuzz': get_package_data()
                  },
    entry_points={
            'console_scripts': [
                'pjf=pyjfuzz.pyjfuzz:main',
            ],
    },
    install_requires=[
        'bottle',
        'netifaces',
        'GitPython',
        'gramfuzz'
    ],
)

I wasn't able to update it on the pip side. However, I've pumped the version to 1.1.1 and create a dist file on my own. It's hosted on my blog. You can install it via pip with:

pip install https://blog.akendo.eu/downloads/PyJFuzz-1.1.1.tar.gz
pip install https://blog.akendo.eu/downloads/PyJFuzz-1.1.1.tar.gz
Collecting https://blog.akendo.eu/downloads/PyJFuzz-1.1.1.tar.gz
  Downloading https://blog.akendo.eu/downloads/PyJFuzz-1.1.1.tar.gz (877kB)
    100% |████████████████████████████████| 880kB 9.3MB/s
Collecting bottle (from PyJFuzz==1.1.1)
  Using cached https://files.pythonhosted.org/packages/47/f1/666d2522c8eda26488315d7ee8882d848710b23d408ed4ced35d750d6e20/bottle-0.12.16-py3-none-any.whl                                     
Collecting netifaces (from PyJFuzz==1.1.1)
  Downloading https://files.pythonhosted.org/packages/0d/18/fd6e9c71a35b67a73160ec80a49da63d1eed2d2055054cc2995714949132/netifaces-0.10.9.tar.gz                                              
Collecting GitPython (from PyJFuzz==1.1.1)
  Using cached https://files.pythonhosted.org/packages/fe/e5/fafe827507644c32d6dc553a1c435cdf882e0c28918a5bab29f7fbebfb70/GitPython-2.1.11-py2.py3-none-any.whl                               
Collecting gramfuzz (from PyJFuzz==1.1.1)
  Downloading https://files.pythonhosted.org/packages/2f/43/8ffb9b4c73739df9b3f7920e85de55ec8fca3012caa2cfcbc72ffdec78e3/gramfuzz-1.2.1.tar.gz                                                
Collecting gitdb2>=2.0.0 (from GitPython->PyJFuzz==1.1.1)
  Using cached https://files.pythonhosted.org/packages/da/30/a407568aa8d8f25db817cf50121a958722f3fc5f87e3a6fba1f40c0633e3/gitdb2-2.0.5-py2.py3-none-any.whl                                   
Collecting smmap2>=2.0.0 (from gitdb2>=2.0.0->GitPython->PyJFuzz==1.1.1)
  Using cached https://files.pythonhosted.org/packages/55/d2/866d45e3a121ee15a1dc013824d58072fd5c7799c9c34d01378eb262ca8f/smmap2-2.0.5-py2.py3-none-any.whl                                   
Building wheels for collected packages: PyJFuzz, netifaces, gramfuzz
  Building wheel for PyJFuzz (setup.py) ... done
  Stored in directory: /home/akendo/.cache/pip/wheels/c1/51/59/628993b30da3b5815c1bc13d2bdff35a1f4ae28d7fc462289f                                                                             
  Building wheel for netifaces (setup.py) ... done
  Stored in directory: /home/akendo/.cache/pip/wheels/23/8f/f3/7054578f04c904f70757c5c85a6e2823baa69d42365526e93d                                                                             
  Building wheel for gramfuzz (setup.py) ... done
  Stored in directory: /home/akendo/.cache/pip/wheels/42/e5/03/edd9c71b139600d16a68be332af8e4b5c71397760e441d81ff                                                                             
Successfully built PyJFuzz netifaces gramfuzz
Installing collected packages: bottle, netifaces, smmap2, gitdb2, GitPython, gramfuzz, PyJFuzz
Successfully installed GitPython-2.1.11 PyJFuzz-1.1.1 bottle-0.12.16 gitdb2-2.0.5 gramfuzz-1.2.1 netifaces-0.10.9 smmap2-2.0.5

The folder with the upper setup.py files seems not be in this repository. I wasn't able to find it, otherwise I would have created a PR. So dropping it in here, seems the most sense-full thing.

@Akendo
Copy link

Akendo commented Apr 23, 2019

I was to quick with my happiness. Seems like that the crafted file does not work when imported. Might have made a mistake ;/

@Akendo
Copy link

Akendo commented Apr 23, 2019

Another way is to use the repository as zip file:

pip install https://github.com/mseclab/PyJFuzz/archive/master.zip

@shishangx
Copy link

something wrong with me.
from pyjfuzz.lib import * File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyjfuzz/lib.py", line 24, in <module> from pyjfuzz.core.pjf_configuration import PJFConfiguration File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyjfuzz/core/pjf_configuration.py", line 165 print "[\033[92mINFO\033[0m] Port %s is already in use switching to different port" % \ ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("[\033[92mINFO\033[0m] Port %s is already in use switching to different port" % \)?

@shishangx
Copy link

something wrong with me.
from pyjfuzz.lib import * File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyjfuzz/lib.py", line 24, in <module> from pyjfuzz.core.pjf_configuration import PJFConfiguration File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyjfuzz/core/pjf_configuration.py", line 165 print "[\033[92mINFO\033[0m] Port %s is already in use switching to different port" % \ ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("[\033[92mINFO\033[0m] Port %s is already in use switching to different port" % \)?

when i change 'print' stytle from python2 to python3, then the next error:
from pyjfuzz.core.pjf_configuration import PJFConfiguration File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyjfuzz/core/pjf_configuration.py", line 29, in <module> from conf import CONF_PATH ModuleNotFoundError: No module named 'conf'

@dzonerzy
Copy link
Collaborator

dzonerzy commented Dec 13, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants