Skip to content

Commit

Permalink
Use UUID for invalid file names, fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
extremecoders-re authored Aug 20, 2023
1 parent 480823e commit 6d0268c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyinstxtractor-ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ def parseTOC(self):
"!IIIBc{0}s".format(entrySize - nameLen), self.fPtr.read(entrySize - 4)
)

name = name.decode("utf-8").rstrip("\0")
try:
name = name.decode("utf-8").rstrip("\0")
except UnicodeDecodeError:
newName = str(uniquename())
print('[!] Warning: File name {0} contains invalid bytes. Using random name {1}'.format(name, newName))
name = newName

# Prevent writing outside the extraction directory
if name.startswith("/"):
Expand Down

0 comments on commit 6d0268c

Please sign in to comment.