1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-12-16 07:33:20 +00:00

Add optional OSB alternative password parameter

This commit is contained in:
2023-11-01 13:29:30 +01:00
parent 7ef1638b58
commit f851e9c424
3 changed files with 21 additions and 7 deletions

View File

@@ -48,11 +48,9 @@ macro_rules! error {
};
}
pub fn unzip_osb(path: &str) {
pub fn unzip_osb_using_password(path: &str, password: &str) {
println!("Entpacke OSB-Datei {}\n", style(path).yellow());
let pw = deobfuscate(env!("OSB_KEY").trim());
let file = match fs::File::open(path) {
Ok(file) => file,
Err(err) => {
@@ -78,7 +76,7 @@ pub fn unzip_osb(path: &str) {
};
for i in 0..archive.len() {
let mut file = if let Ok(Ok(file)) = archive.by_index_decrypt(i, pw.as_bytes()) {
let mut file = if let Ok(Ok(file)) = archive.by_index_decrypt(i, password.as_bytes()) {
file
} else {
println!(
@@ -130,3 +128,7 @@ pub fn unzip_osb(path: &str) {
}
}
}
pub fn unzip_osb(path: &str) {
unzip_osb_using_password(path, deobfuscate(env!("OSB_KEY").trim()).as_str());
}