Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pyinstxtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,15 @@
import marshal
import zlib
import sys
import imp
import types
from uuid import uuid4 as uniquename

try:
import importlib.util
PYC_MAGIC=importlib.util.MAGIC_NUMBER
except ImportError:
import imp
PYC_MAGIC=imp.get_magic()

class CTOCEntry:
def __init__(self, position, cmprsdDataSize, uncmprsdDataSize, cmprsFlag, typeCmprsData, name):
Expand Down Expand Up @@ -274,7 +279,7 @@ def _extractPyz(self, name):

pycHeader = f.read(4) # Python magic value

if imp.get_magic() != pycHeader:
if PYC_MAGIC != pycHeader:
print('[!] Warning: The script is running in a different python version than the one used to build the executable')
print(' Run this script in Python{0} to prevent extraction errors(if any) during unmarshalling'.format(self.pyver))

Expand Down