From 8972b42c9ca176765f117b647bdb00f613e145a2 Mon Sep 17 00:00:00 2001 From: lapla-cogito Date: Tue, 8 Oct 2024 06:13:15 +0900 Subject: [PATCH] fix for stripped binary --- src/obfus.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/obfus.rs b/src/obfus.rs index 6de415c..d8dfa41 100644 --- a/src/obfus.rs +++ b/src/obfus.rs @@ -126,10 +126,13 @@ impl Obfuscator { String::from_utf8_lossy(&obfus.input[section_addr..section_addr + section_size]) .to_string(); - let (section_addr, section_size, _, _) = obfus.get_section(".strtab").unwrap(); - obfus.string_table = - String::from_utf8_lossy(&obfus.input[section_addr..section_addr + section_size]) - .to_string(); + let (section_addr, section_size, _, _) = + obfus.get_section(".strtab").unwrap_or((0, 0, 0, 0)); + if section_addr != 0 && section_size != 0 { + obfus.string_table = + String::from_utf8_lossy(&obfus.input[section_addr..section_addr + section_size]) + .to_string(); + } Ok(obfus) }