A tool for deriving PKG packet encryption keys for ps4 written in c++
| 1 | #pragma once |
| 2 | |
| 3 | #include <filesystem> |
| 4 | #include <string> |
| 5 | #include <vector> |
| 6 | #include <cstdint> |
| 7 | |
| 8 | namespace ShadPKG { |
| 9 | |
| 10 | // ╔═══════════════════════════════════════════════════════════════════════════╗ |
| 11 | // ║ ISO EXTRACTOR (PS2/PS3) ║ |
| 12 | // ║ ║ |
| 13 | // ║ Extracts executable and data files from PS2/PS3 ISO images. ║ |
| 14 | // ║ Supports both ISO 9660 and UDF filesystems. ║ |
| 15 | // ╚═══════════════════════════════════════════════════════════════════════════╝ |
| 16 | |
| 17 | class ISOExtractor { |
| 18 | public: |
| 19 | struct ExtractionResult { |
| 20 | bool success = false; |
| 21 | std::string errorMessage; |
| 22 | std::filesystem::path extractedExecutable; |
| 23 | std::vector<std::filesystem::path> extractedFiles; |
| 24 | std::string gameTitle; |
| 25 | std::string gameID; |
| 26 | }; |
| 27 | |
| 28 | ISOExtractor(); |
| 29 | ~ISOExtractor(); |
| 30 | |
| 31 | // Detect ISO type (PS2, PS3, etc.) |
| 32 | static bool isValidISO(const std::filesystem::path &isoPath); |
| 33 | static std::string detectISOType(const std::filesystem::path &isoPath); |
| 34 | |
| 35 | // Extract files from ISO |
| 36 | ExtractionResult extract(const std::filesystem::path &isoPath, |
| 37 | const std::filesystem::path &outputDir); |
| 38 | |
| 39 | // Extract specific file from ISO |
| 40 | bool extractFile(const std::filesystem::path &isoPath, |
| 41 | const std::string &internalPath, |
| 42 | const std::filesystem::path &outputPath); |
| 43 | |
| 44 | private: |
| 45 | // Helper functions for ISO parsing |
| 46 | bool mountISO(const std::filesystem::path &isoPath, |
| 47 | std::filesystem::path &mountPoint); |
| 48 | bool unmountISO(const std::filesystem::path &mountPoint); |
| 49 | |
| 50 | // Find main executable in ISO |
| 51 | std::filesystem::path findMainExecutable(const std::filesystem::path &mountPoint); |
| 52 | |
| 53 | // Extract game metadata |
| 54 | bool extractMetadata(const std::filesystem::path &mountPoint, |
| 55 | std::string &gameTitle, std::string &gameID); |
| 56 | }; |
| 57 | |
| 58 | } // namespace ShadPKG |
| 59 |