Seregon/ShadPKG

A tool for deriving PKG packet encryption keys for ps4 written in c++

C++/47.3 KB/No license
core/patcher/eboot_extractor.h
ShadPKG / core / patcher / eboot_extractor.h
1#pragma once
2 
3#include <cstdint>
4#include <string>
5#include <vector>
6#include <filesystem>
7 
8namespace ShadPKG::Patcher {
9 
10// Lightweight eboot.bin extractor from PS4 PKG
11// Extracts only the eboot.bin without processing the entire PKG
12class EbootExtractor {
13public:
14 EbootExtractor() = default;
15 ~EbootExtractor() = default;
16 
17 // Extract eboot.bin from PKG to output path
18 bool extractEboot(const std::filesystem::path& pkgPath,
19 const std::filesystem::path& outputPath);
20
21 // Get the raw eboot data after extraction
22 const std::vector<uint8_t>& getEbootData() const { return ebootData_; }
23
24 // Get game info from PKG
25 std::string getTitleId() const { return titleId_; }
26 std::string getContentId() const { return contentId_; }
27 
28private:
29 std::vector<uint8_t> ebootData_;
30 std::string titleId_;
31 std::string contentId_;
32
33 // PKG entry IDs
34 static constexpr uint32_t PKG_ENTRY_ID_EBOOT = 0x1001; // eboot.bin
35 static constexpr uint32_t PKG_ENTRY_ID_PFS = 0x1200; // PFS image
36};
37 
38} // namespace ShadPKG::Patcher
39