Re: [PyInstaller] False trojan messages?

82 views
Skip to first unread message

Grant Paton-Simpson

unread,
Sep 10, 2012, 6:30:29 AM9/10/12
to pyins...@googlegroups.com
Hi,

The changes to hook-pywintypes.py since 1.6/2.0 seem relevant. Here is the code in the dev version (pyinstaller-pyinstaller-v2.0-137-gba163ef):

from PyInstaller.hooks.hookutils import get_module_file_attribute


datas = [(get_module_file_attribute('pywintypes'), '.')]

which calls:

def get_module_file_attribute(package):
    """
    Given a pacage name, return the value of __file__ attribute.

    In PyInstaller process we cannot import directly analyzed modules.
    """
    # Statement to return __file__ attribute of a package.
    __file__statement = """
# Fun Python behavior: __import__('mod.submod') returns mod,
# where as __import__('mod.submod', fromlist = [a non-empty list])
# returns mod.submod. See the docs on `__import__
# <http://docs.python.org/library/functions.html#__import__>`_.
# Keyworded arguments in __import__ function are available
# in Python 2.5+. Compatibility with Python 2.4 is preserved.
_fromlist = ['']
_globals = {}
_locals = {}
package = __import__('%s', _globals, _locals, _fromlist)
print package.__file__
"""
    return exec_statement(__file__statement % package)

and here is hooks-pywintypes.py in 1.6/2.0 stable:

import PyInstaller.depend.modules


def hook(mod):
    import sys
    newname = 'pywintypes%d%d' % sys.version_info[:2]
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
    return mod
So the original solution to the "WARNING: file already exists but should not: C:/DOCUMEN~1/GRANTP~1/LOCALS~1/Temp/_MEI1922\.\pywintypes27.dll" problem mentioned below won't work.

Any ideas about what might work? I need to use the dev version to avoid the false trojan message for my windows package.

All the best,
Grant


On 06/09/12 07:15, Grant Paton-Simpson wrote:
Hi,

I haven't rebuilt the spec yet but I noted that someone else had a virtually identical problem which they reported some details of in comment 4: http://groups.google.com/group/pyinstaller/tree/browse_frm/month/2012-03?hide_quotes=no

This was supposedly the solution (in my case the problem is pywintypes27.dll not pywintypes25.dll):

By the way, I think I've solved the mixed-case "PyWinTypes25.dll" issue:
in hook-pywintypes.py, I changed the format string on line 20 to all
lower case.  With that done, I no longer get the "exists, but shouldn't"
warning message.

Any thoughts? My plan is to make a new exe and test it to see if it avoids the false positive message from AVG.


All the best,
Grant


On 05/09/12 22:35, Grant Paton-Simpson wrote:
Hi Martin,

The dev version doesn't seem to trigger the same problem (from initial experimentation). The exe created by the new version of pyinstaller (but using the same spec file) gives an error message when run but otherwise succeeds. The message is: WARNING: file already exists but should not: C:/DOCUMEN~1/GRANTP~1/LOCALS~1/Temp/_MEI1922\.\pywintypes27.dll

I'll look at that tomorrow. Perhaps the issue will go away if I build a clean spec file

Here is the one I've been using:

# -*- mode: python -*-

a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'C:\\dev\\launch.py'],
pathex=['C:\\Python27\\pyinstaller-pyinstaller-ba163ef'])
pyz = PYZ(a.pure, level=9)
binary_includes = [('ssleay32.dll', 'C:\\Program Files\\wkhtmltopdf\\ssleay32.dll', 'BINARY'),
           ('libeay32.dll', 'C:\\Program Files\\wkhtmltopdf\\libeay32.dll', 'BINARY'),
                   ('libgcc_s_dw2-1.dll', 'C:\\Program Files\\wkhtmltopdf\\libgcc_s_dw2-1.dll', 'BINARY'),
                   ('wkhtmltopdf.exe', 'C:\\Program Files\\wkhtmltopdf\\wkhtmltopdf.exe', 'BINARY'),
                   ('convert.exe', 'C:\\Program Files\\ImageMagick-6.7.8-Q16\\convert.exe', 'BINARY'),
                   ('libiconv2.dll', 'C:\\Windows\\System32\\libiconv2.dll', 'BINARY'),
                   ('pdftk.exe', 'C:\\Windows\\System32\\pdftk.exe', 'BINARY'),
                   ('gswin32c.exe', 'C:\\Program Files\\gs\\gs9.06\\bin\\gswin32c.exe', 'BINARY'),
                   ('gsdll32.dll', 'C:\\Program Files\\gs\\gs9.06\\bin\\gsdll32.dll', 'BINARY'),
]

exe = EXE( pyz,
          a.scripts,
          a.binaries + binary_includes,
          a.zipfiles,
          a.datas,
          exclude_binaries=False,
          name='C:\\dev\\sofastats.exe',
          icon='C:\\dev\\images\\sofa_32x32.ico',
          strip=False,
          upx=False,
          debug=False,
          console=False)
Anyway, it looks like the trojan warning was probably spurious.


All the best,
Grant



On 05/09/12 19:38, Grant Paton-Simpson wrote:
Thanks Martin,

I'll do some experiments and report back.

All the best,
Grant


On 05/09/12 19:13, Martin Zibricky wrote:
Grant Paton-Simpson píše v St 05. 09. 2012 v 14:40 +1200:
Any thoughts? I suspect it might be a false positive but obviously I
need to be careful.
I think it's definitely a false positive. I don't know how to modify the
bootloader code to make AVG happy. Could you try avg with development
version?

I think this something for avg support. They experts could tell us more
since they have access to source code.






Grant Paton-Simpson

unread,
Sep 11, 2012, 11:51:28 PM9/11/12
to pyins...@googlegroups.com
Hi Martin,

I can see from https://github.com/pyinstaller/pyinstaller/commits/develop/PyInstaller/hooks/hook-pywintypes.py that you are the person who has been working on hook-pywintypes this year. Thanks for your work to improve pyinstaller.

What would you advise I do to prevent the following error: "WARNING: file already exists but should not: C:/DOCUMEN~1/GRANTP~1/LOCALS~1/Temp/_MEI1922\.\pywintypes27.dll" ? Should I revert to the version of hook-pywintypes.py in May 30th?

Or is there a better solution which you are planning to add to the hook?

Sorry for being so persistent - I need the dev version of pyinstaller to work so I can put out a release of my SOFA Statistics application. If you recall, it seems that version 2.0 has been triggering anti-trojan warnings on a couple of virus scanners. Thus my attempt to use the dev version.


All the best,
Grant
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.


Reply all
Reply to author
Forward
0 new messages