fix decode's optional

This commit is contained in:
kazuminn
2020-10-31 22:36:52 +09:00
parent 52a165ea19
commit 1fcf025a06

View File

@@ -61,22 +61,20 @@ pub fn check_command(
.unwrap() .unwrap()
.is_match(commandline) .is_match(commandline)
{ {
/* if let Ok(decoded) = base64::decode(&base64) {
if let decoded = base64::decode(&base64) { let mut d = GzDecoder::new(decoded.as_slice());
let mut d = GzDecoder::new(decoded.as_slice()); let mut uncompressed = String::new();
let mut uncompressed = String::new(); d.read_to_string(&mut uncompressed).unwrap();
d.read_to_string(&mut uncompressed).unwrap(); println!("Decoded : {}", uncompressed);
println!("Decoded : {}", uncompressed); text.push_str("Base64-encoded and compressed function\n");
text.push_str("Base64-encoded and compressed function\n");
} }
*/
} else { } else {
let decoded = base64::decode(base64).unwrap(); if let Ok(decoded) = base64::decode(&base64) {
println!("Decoded : {}", str::from_utf8(decoded.as_slice()).unwrap()); println!("Decoded : {}", str::from_utf8(decoded.as_slice()).unwrap());
text.push_str("Base64-encoded function\n"); text.push_str("Base64-encoded function\n");
text.push_str(&check_obfu(str::from_utf8(decoded.as_slice()).unwrap())); text.push_str(&check_obfu(str::from_utf8(decoded.as_slice()).unwrap()));
text.push_str(&check_regex(str::from_utf8(decoded.as_slice()).unwrap(), 0)); text.push_str(&check_regex(str::from_utf8(decoded.as_slice()).unwrap(), 0));
}
} }
} }
if !text.is_empty() { if !text.is_empty() {