python file decompile encrypted file - python

I try to decode pyc python file using python-decompile3.
The file is encrypted by python libs cryptography and bcrypt
This is my command
decompyle3 names.pyc
but i have this error, how to fix it
C:\Users\virtualWin\Desktop\>decompyle3 names.pyc
# decompyle3 version 3.7.6
# Python bytecode 3.9 (3425)
# Decompiled from: Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: dist\obf\names.py
Traceback (most recent call last):
File "C:\Users\virtualWin\AppData\Local\Programs\Python\Python37\Scripts\decompyle3-script.py", line 11, in <module>
load_entry_point('decompyle3', 'console_scripts', 'decompyle3')()
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\bin\decompile.py", line 190, in main_bin
src_base, out_base, pyc_paths, source_paths, outfile, **options
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\main.py", line 304, in main
do_fragments,
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\main.py", line 222, in decompile_file
compile_mode="exec",
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\main.py", line 140, in decompile
compile_mode=compile_mode,
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\semantics\pysource.py", line 2172, in code_deparse
scanner = get_scanner(version, is_pypy=is_pypy)
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\scanner.py", line 535, in get_scanner
"scan.Scanner%s(show_asm=show_asm)" % v_str, locals(), globals()
File "<string>", line 1, in <module>
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\scanners\scanner39.py", line 36, in __init__
Scanner37Base.__init__(self, 3.9, show_asm)
File "c:\users\virtualwin\desktop\python-decompile3-master (2)\python-decompile3-master\decompyle3\scanners\scanner37base.py", line 101, in __init__
self.opc.END_FINALLY,
AttributeError: module 'xdis.opcodes.opcode_39' has no attribute 'END_FINALLY'

decompyle3 is not support Python 3.9 now.
Please see https://github.com/rocky/python-decompile3/issues/45 and https://github.com/rocky/python-uncompyle6/issues/353

Related

PyLint AttributeError

Receving this error while running pylint on my py file
AttributeError: 'Import' object has no attribute 'infer_name_module'
Full trace:
$ pylint some_file.py
Traceback (most recent call last):
File "\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "\Scripts\pylint.exe\__main__.py", line 7, in <module>
File "\lib\site-packages\pylint\__init__.py", line 19, in run_pylint
Run(sys.argv[1:])
File "\lib\site-packages\pylint\lint.py", line 1394, in __init__
linter.check(args)
File "\lib\site-packages\pylint\lint.py", line 801, in check
self._do_check(files_or_modules)
File "\lib\site-packages\pylint\lint.py", line 938, in _do_check
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
File "\lib\site-packages\pylint\lint.py", line 1018, in check_astroid_module
walker.walk(ast_node)
File "\lib\site-packages\pylint\utils.py", line 1159, in walk
self.walk(child)
File "\lib\site-packages\pylint\utils.py", line 1156, in walk
cb(astroid)
File "\lib\site-packages\pylint\checkers\variables.py", line 1331, in visit_import
module = next(node.infer_name_module(parts[0]))
AttributeError: 'Import' object has no attribute 'infer_name_module'
Not sure for root cause.
pylint version 2.12.2
I'm a pylint maintainer. It's a bug in pylint, could you open an issue, please ? We'd need the code that create the crash if possible.
Edit : it was a bug in an old version of pylint 2.0.2, not 2.12.2

Hydrogen not running python 3.8

For several months I ran anaconda, my default python interpreter, and hence Hydrogen on Python 3.7.6 via Atom. Recently I updated my anaconda to 3.8.2, and immediately, my Hydrogen began showing this error.
Python 3
Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\ProgramData\Anaconda3\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel__init__.py", line 2, in from .connect import File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 18, in import jupyter_client File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client__init__.py", line 4, in from .connect import File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 24, in import zmq File "C:\ProgramData\Anaconda3\lib\site-packages\zmq__init__.py", line 47, in from zmq import backend File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend__init__.py", line 40, in reraise(*exc_info) File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise raise value File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend__init__.py", line 27, in _ns = select_backend(first) File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend mod = import(name, fromlist=public_api) File "C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend\cython__init__.py", line 6, in from . import (constants, error, message, context, ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\ProgramData\Anaconda3\lib\site-packages\zmq\backend\cython__init__.py)
When I run python 3.8 code without Hydrogen, it still works, proving the error is Hydrogens
import sys
print(sys.version)
outputs: 3.8.2 (default, Mar 25 2020, 08:56:29) [MSC v.1916 64 bit (AMD64)]

PyInstaller error with python script that uses OpenCV and VPython (DOS Header magic not found)

I am trying to generate exe file from a script that uses openCV and Vpython however I am having problems with it. I tried using pyinstaller with a simple print script it worked fine. when I try it with openCV only script it did not work and the same with Vpython only script, and both. the error I am getting is this:
Traceback (most recent call last):
File "C:\Python27\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 46, in run_
build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
212, in __init__
self.__postinit__()
File "c:\python27\lib\site-packages\PyInstaller\building\datastruct.py", line
161, in __postinit__
self.assemble()
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py", line
535, in assemble
redirects=self.binding_redirects))
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 227
, in Dependencies
for lib, npth in selectImports(pth, xtrapath):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 510
, in selectImports
npth = getfullnameof(lib, xtrapath)
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 82,
in getfullnameof
if os.path.exists(npth) and matchDLLArch(npth):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line 194
, in matchDLLArch
pe = pefile.PE(filename, fast_load=True)
File "c:\python27\lib\site-packages\PyInstaller\lib\pefile.py", line 1720, in
__init__
self.__parse__(name, data, fast_load)
File "c:\python27\lib\site-packages\PyInstaller\lib\pefile.py", line 1799, in
__parse__
raise PEFormatError('DOS Header magic not found.')
PyInstaller.lib.pefile.PEFormatError: 'DOS Header magic not found.'
I have:
PyInstaller: 3.2.1
Python: 2.7.13 x64
Platform: Windows-8.1 x64
what to do?
A better place to pose VPython questions is in the VPython forum at
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
There you might find VPython users who have experience with PyInstaller (I don't).

Lost sqlite3 module from python after OSX Mavericks

After installing OS X Mavericks, I have been having issues running django's server:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/admin/forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/contrib/auth/models.py", line 48, in <module>
class Permission(models.Model):
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/models/options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 35, in <module>
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): dlopen(/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
Expected in: /usr/lib/libsqlite3.dylib
in /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
I think the issue is that the sqlite3 module has gone missing for some reason:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python
Python 2.7.5 (default, Dec 31 2013, 11:46:08)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
Expected in: /usr/lib/libsqlite3.dylib
in /Users/christopherspears/.virtualenvs/rango_tutorial/lib/python2.7/lib-dynload/_sqlite3.so
I'm not sure what is causing this. Isn't the sqlite3 module normally just part of Python?
Updating OS X is notorious for messing up all sorts of Developer Tools.
What is your output when you type which sqlite3? How about other developer tools like which gcc? If they are missing you may need to reinstall Xcode. I know many users had to reinstall XCode after updating to Mavericks.
Here's the link for more information: https://developer.apple.com/xcode/
Uninstalling and reinstalling python with brew seemed to help with the earlier problem. Of course now, python is broken in that virtual environment:
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python manage.py runserver
dyld: Library not loaded: #executable_path/../.Python
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/bin/python
Reason: image not found
Trace/BPT trap: 5
(rango_tutorial)christohersmbp2:tango_with_django_project christopherspears$ python
dyld: Library not loaded: #executable_path/../.Python
Referenced from: /Users/christopherspears/.virtualenvs/rango_tutorial/bin/python
Reason: image not found
Trace/BPT trap: 5

pyOpenGL exe made with PyInstaller gives attributeerror

I'm trying to make lesson18.py from the pyOpenGL examples into an exe but when compiled it gives this error:
Traceback (most recent call last):
File "<string>", line 46, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL", line 3, in <m
odule>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL.VERSION.GL_1_1"
, line 10, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 477, in importHook
mod = self.doimport(nm, ctx, ctx+'.'+nm)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays", line 22,
in <module>
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 28, in loadAll
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 35, in loadPlugin
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 14,
in load
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 28,
in importByName
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.vbo", line
430, in <module>
AttributeError: 'module' object has no attribute 'GL_READ_WRITE'
Press any key to continue . . .
This happens with all programs(including my own) that use pyOpenGL, the error is the same.
Are there any additional tricks(imports, etc.) to make a working executable with pyInstaller(I know there are with py2exe, but I prefer pyInstaller)?
My python version is 2.7
pyOpenGL ver.: 3.0.2a5
pyinstaller ver.: 1.5.1
I found out a solution to this particular issue!
It is about the PyOpenGL version. Pyinstaller works fine with PyOpenGL version 3.0.1b1
You can download it here:
http://sourceforge.net/projects/pyopengl/files/PyOpenGL/ and compile it yourself. Dont forget to remove your old PyOpenGL version from site-packages folder! You can check for active version of PyOpenGL on your system executing following:
>>>import pkg_resources
>>>pkg_resources.get_distribution("PyOpenGL").version
>>>'3.0.1b1'

Categories

Resources