mirror of
https://github.com/extremecoders-re/pyinstxtractor.git
synced 2026-06-09 11:05:32 +00:00
feat: Ensure that pyc-files is extracted in the last batch
This commit is contained in:
parent
2e86c9cb00
commit
4a1e32b89a
1 changed files with 5 additions and 2 deletions
|
|
@ -279,6 +279,7 @@ class PyInstArchive:
|
|||
os.mkdir(extractionDir)
|
||||
|
||||
os.chdir(extractionDir)
|
||||
pyc_list = []
|
||||
|
||||
for entry in self.tocList:
|
||||
self.fPtr.seek(entry.position, os.SEEK_SET)
|
||||
|
|
@ -305,8 +306,7 @@ class PyInstArchive:
|
|||
if entry.typeCmprsData == b's':
|
||||
# s -> ARCHIVE_ITEM_PYSOURCE
|
||||
# Entry point are expected to be python scripts
|
||||
print('[+] Possible entry point: {0}.pyc'.format(entry.name))
|
||||
self._writePyc(entry.name + '.pyc', data)
|
||||
pyc_list.append(( entry.name+".pyc", data ))
|
||||
|
||||
elif entry.typeCmprsData == b'M' or entry.typeCmprsData == b'm':
|
||||
# M -> ARCHIVE_ITEM_PYPACKAGE
|
||||
|
|
@ -320,6 +320,9 @@ class PyInstArchive:
|
|||
if entry.typeCmprsData == b'z' or entry.typeCmprsData == b'Z':
|
||||
self._extractPyz(entry.name)
|
||||
|
||||
for pyc_filename, data in pyc_list:
|
||||
print('[+] Possible entry point: {0}'.format(pyc_filename))
|
||||
self._writePyc(pyc_filename, data)
|
||||
|
||||
def _writePyc(self, filename, data):
|
||||
with open(filename, 'wb') as pycFile:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue