On 1/9/2008 3:12 PM, Kevin Horn wrote:
> On Jan 9, 2008 5:13 AM, Giovanni Bajo <[EMAIL PROTECTED]> wrote:
> 
>> On 1/9/2008 7:03 AM, Kevin H wrote:
>>
>>> I have a very old python program (think Python 1.5) which was packages
>>> using the McMillan installer.  The original (unpackaged) source has
>>> been lost.  Is there a way to extract the original source from the
>>> packaged version?
>>>
>>> Can someone here recommend a strategy for approaching this?
>> Using the standalone program "ArchiveViewer.py" shipped with PyInstaller
>> (or the original Installer), you can extract all the .pyc or .pyo files
>> *and* the .py of the "startup" module (the first file that you run to
>> execute the whole application). For smallish application that are wholly
>> contained into a single .py file, this basically means that you can
>> recover the whole source code.
>> [[ NOTE: this is not true anymore with PyInstaller: now only .pyc are
>> embedded into the packaged executables ]]
>>
>> Once you get the .pyc/.pyo, there are commercial reverse-engineering
>> services that should give you the equivalent .py sources.
>>
>> Hope this helps!
>> --
>> Giovanni Bajo
>>
>>
> Thanks for the reply Giovanni!
> 
> I tried ArchiveViewer.py, but all it gave me was the following traceback:
> Traceback (most recent call last):
>   File "ArchiveViewer.py", line 154, in ?
>     main()
>   File "ArchiveViewer.py", line 34, in main
>     arch = getArchive(name)
>   File "ArchiveViewer.py", line 100, in getArchive
>     return carchive.CArchive(nm)
>   File "E:\data\code\BloodNDice\_recovery
> attempt\pyinstaller_1.3\pyinstaller-1.3\carchive.py", line 137, in __init__
>     archive.Archive.__init__(self, path, start)
>   File "E:\data\code\BloodNDice\_recovery
> attempt\pyinstaller_1.3\pyinstaller-1.3\archive.py", line 98, in __init__
>     self.checkmagic()
>   File "E:\data\code\BloodNDice\_recovery
> attempt\pyinstaller_1.3\pyinstaller-1.3\carchive.py", line 156, in
> checkmagic
>     raise RuntimeError, "%s is not a valid %s archive file" \
> RuntimeError: ..\..\..\bnd\bnd_0_9.exe is not a valid CArchive archive file

That's weird. Maybe the original packagers customized McMillan Installer 
a little (change of the magic signature)? I don't recall any reason why 
the current version of ArchiveViewer shouldn't work with old packaged files.

> The good news is, by opening the .exe file in a text editor (Scite) I was
> able to get the source of the top-level .py file.  There's another .pyc file
> in there somewhere, but I'm not able to pick it out using an editor.
> Fortunately, it looks like there's only one utility function in the .pyc
> file, so I can probably recreate that.

A quick try is to download a very old version of PyInstaller and try 
with ArchiveViewer in there, in case something changed meanwhile without 
me noticing it (or recalling it!). But even if you get the .pyc file, 
you would be able to either pay for reverse-engineer or recreate it 
(unless you want to use it unmodified).
-- 
Giovanni Bajo


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to