base on Unreal Engine .pak file library and CLI in rust # repak Library and CLI tool for working with Unreal Engine .pak files. - Supports reading and writing a wide range of versions - Easy to use API while providing low level control: - Only parses index initially and reads file data upon request - Can rewrite index in place to perform append or delete operations without rewriting entire pak `repak` CLI - Sane handling of mount points: defaults to `../../../` but can be configured via flag - 2x faster unpacking over `UnrealPak` - Unpacking is guarded against malicious pak that attempt to write to parent directories ## cli ```console $ repak --help Usage: repak [OPTIONS] <COMMAND> Commands: info Print .pak info list List .pak files hash-list List .pak files and the SHA256 of their contents. Useful for finding differences between paks unpack Unpack .pak file pack Pack directory into .pak file get Reads a single file to stdout help Print this message or the help of the given subcommand(s) Options: -a, --aes-key <AES_KEY> 256 bit AES encryption key as base64 or hex string if the pak is encrypted -h, --help Print help -V, --version Print version ``` ### packing ```console $ find mod mod mod/assets mod/assets/AssetA.uasset mod/assets/AssetA.uexp $ repak pack -v mod packing assets/AssetA.uasset packing assets/AssetA.uexp Packed 4 files to mod.pak $ repak list mod.pak assets/AssetA.uasset assets/AssetA.uexp ``` ### unpacking ```console $ repak --aes-key 0x12345678 unpack MyEncryptedGame.pak Unpacked 12345 files to MyEncryptedGame from MyEncryptedGame.pak ``` ## compatibility | UE Version | Version | Version Feature | Read | Write | |--------------|---------|-----------------------|--------------------|------------------------| | | 1 | Initial | :grey_question: | :grey_question: | | 4.0-4.2 | 2 | NoTimestamps | :heavy_check_mark: | :heavy_check_mark: | | 4.3-4.15 | 3 | CompressionEncryption | :heavy_check_mark: | :heavy_check_mark: | | 4.16-4.19 | 4 | IndexEncryption | :heavy_check_mark: | :heavy_check_mark: | | 4.20 | 5 | RelativeChunkOffsets | :heavy_check_mark: | :heavy_check_mark: | | | 6 | DeleteRecords | :grey_question: | :grey_question: | | 4.21 | 7 | EncryptionKeyGuid | :heavy_check_mark: | :heavy_check_mark: | | 4.22 | 8A | FNameBasedCompression | :heavy_check_mark: | :heavy_check_mark: | | 4.23-4.24 | 8B | FNameBasedCompression | :heavy_check_mark: | :heavy_check_mark: | | 4.25 | 9 | FrozenIndex | :heavy_check_mark: | :heavy_check_mark:[^1] | | | 10 | PathHashIndex | :grey_question: | :grey_question: | | 4.26-5.3[^2] | 11 | Fnv64BugFix | :heavy_check_mark: | :heavy_check_mark: | | Feature | Read | Write | |-----------------|--------------------|-----------------| | Compression | :heavy_check_mark: | :wavy_dash:[^3] | | Encrypted Index | :heavy_check_mark: | :x: | | Encrypted Data | :heavy_check_mark: | :x: | [^1]: Except for paks compressed using frozen index which has significant complexity and only existed for UE 4.25 anyway. [^2]: As of writing. Later versions are likely supported but untested. [^3]: Zlib, Gzip, and Zstd are supported. Not all compression algorithms are available in all games. Supports reading encrypted (both index and/or data) and compressed paks. Writing does not support compression or encryption yet. ## notes ### determinism As far as I can tell, the index is not necessarily written deterministically by `UnrealPak`. `repak` uses `BTreeMap` in place of `HashMap` to deterministically write the index and *happens* to rewrite the test paks in the same order, but this more likely than not stops happening on larger pak files. ### full directory index `UnrealPak` includes a directory entry in the full directory index for all parent directories back to the pak root for a given file path regardless of whether those directories contain any files or just other directories. `repak` only includes directories that contain files. So far no functional differences have been observed as a result. ## acknowledgements - [unpak](https://github.com/bananaturtlesandwich/unpak): original crate featuring read-only pak operations - [rust-u4pak](https://github.com/panzi/rust-u4pak)'s README detailing the pak file layout - [jieyouxu](https://github.com/jieyouxu) for serialization implementation of the significantly more complex V11 index ", Assign "at most 3 tags" to the expected json: {"id":"12297","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"