1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

modifying a python executable file

Discussion in 'General Programming Chat' started by welly_59, Apr 11, 2012.

  1. welly_59

    welly_59 Power Member

    Joined:
    Aug 30, 2011
    Messages:
    698
    Likes Received:
    254
    i have an exe file which was created in python and bundled into an exe using py2exe. I wish to modify one of the modules within the exe. I have succesfully unzipped the .pyc file i want to modify and converted it back to .py and modified it successfully. Now i need to somehow get this modified .pyc file back into the exe. is there a way to do so?

    with py2exe you have two choices when bundling the exe - include all modules within the exe or to have the main script as the exe and the rest within a library.zip file. This program has all the .pyc files included within the exe. When i extract all i lost the main script of the exe, and 7-zip will let me view the includes without extracting but not to insert or delete any from there
     
  2. inthecloud

    inthecloud Newbie

    Joined:
    Apr 9, 2012
    Messages:
    16
    Likes Received:
    4
    Occupation:
    Network Engineer / Marketing
    Location:
    Tampa, FL
    Have you tried running a cracking tool on it and just decompiling it? Haven't messed with Python much myself lately, but I recall using a program to do just this a while ago. I'll try to find the name of the decompiler and update here if I can. Good luck!
     
  3. welly_59

    welly_59 Power Member

    Joined:
    Aug 30, 2011
    Messages:
    698
    Likes Received:
    254
    cheers mate! the problem is losing the .pyc file which is the main script of the exe. i have managed to get the rest of the included files but not the main one.
     
  4. weedsmoker

    weedsmoker Junior Member

    Joined:
    May 2, 2011
    Messages:
    190
    Likes Received:
    79
  5. welly_59

    welly_59 Power Member

    Joined:
    Aug 30, 2011
    Messages:
    698
    Likes Received:
    254
    Have you still got the exe2py script? The link is not working on my end.
     
  6. weedsmoker

    weedsmoker Junior Member

    Joined:
    May 2, 2011
    Messages:
    190
    Likes Received:
    79
    Here you go:
    Code:
    http://pastebin.com/4meXNirY