pyUE4Parse
pyUE4Parse copied to clipboard
Can't extract string literals from .uasset/.uexp files
I try to extract strings from an asset files but only some show in the resulting dumps while many of them don't. For example string with Key
419719443B6B978C3A4D6B35AC51928
in the attached dump is nowhere to be seen. Is it a parsing bug or am I doing it wrong?
Here's the code and the sample files I used:
from UE4Parse.Assets.PackageReader import LegacyPackageReader
from UE4Parse.Provider import DefaultFileProvider
from UE4Parse.Versions import EUEVersion, VersionContainer
from UE4Parse.BinaryReader import BinaryStream
import os, json
path0 = r"FilePath.uasset"
path1 = r"FilePath.uexp"
provider = DefaultFileProvider(os.path.dirname(path0), VersionContainer(EUEVersion.LATEST))
provider.initialize()
pack = LegacyPackageReader(BinaryStream(path0), BinaryStream(path1), provider=provider)
if pack is not None:
package_dict = pack.get_dict()
with open(path0 + ".txt", "w", encoding="utf-8") as f:
f.write(json.dumps(package_dict, ensure_ascii=False, indent=4))
how do you know that string is there in the asset?
@MinshuG: by using binary search of its UTF-16 bytes.
Both the Key
field and the corresponding text present in the .uexp file if you look at its binary dump in ASCII/UTF-16 mode.
offset?
0x4C1C in .uexp