mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-16 05:04:22 +02:00
+ cleanup
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::AppContext;
|
||||
use crate::utils::common;
|
||||
use crate::utils::aes::decrypt_aes_ecb_auto;
|
||||
use crate::formats;
|
||||
use log::info;
|
||||
|
||||
pub struct EpkContext {
|
||||
epk_version: u8,
|
||||
@@ -55,21 +56,21 @@ fn match_with_pattern(data: &[u8], pattern: &str) -> bool {
|
||||
|
||||
pub fn extract_epk(app_ctx: &AppContext, ctx: Box<dyn Any>) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut file = app_ctx.file().ok_or("Extractor expected file")?;
|
||||
let ctx = ctx.downcast::<EpkContext>().expect("Missing context");
|
||||
let ctx = ctx.downcast::<EpkContext>().map_err(|_| "Invalid context type")?;
|
||||
|
||||
let versions = common::read_file(&file, 1712, 36)?;
|
||||
|
||||
let platform_version = common::string_from_bytes(&versions[4..20]);
|
||||
let sdk_version = common::string_from_bytes(&versions[20..36]);
|
||||
println!("Platform version: {}\nSDK version: {}", platform_version, sdk_version);
|
||||
info!("Platform version: {}\nSDK version: {}", platform_version, sdk_version);
|
||||
|
||||
file.seek(std::io::SeekFrom::Start(0))?;
|
||||
|
||||
if ctx.epk_version == 2 {
|
||||
println!("EPK2 detected!\n");
|
||||
info!("EPK2 detected!\n");
|
||||
formats::epk2::extract_epk2(app_ctx, Box::new(()))?;
|
||||
} else if ctx.epk_version == 3 {
|
||||
println!("EPK3 detected!\n");
|
||||
info!("EPK3 detected!\n");
|
||||
formats::epk3::extract_epk3(app_ctx, Box::new(()))?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user