Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
lapla-cogito committed Aug 22, 2024
1 parent 9faf86a commit e3ecf09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $ cattleya -i input -e
start obfuscating input...
obfuscation done!
$ readeld -h input
$ readelf -h input
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Expand Down Expand Up @@ -151,7 +151,7 @@ Hex dump of section '.comment':
Encrypts the name of a specific function with AES 256bit using the given key:

```
$ cargo run -- -i bin/test_64bit --encrypt --encrypt-f fac --encrypt-key foo -o bin/res_enc
$ cattleya -i bin/test_64bit --encrypt --encrypt-f fac --encrypt-key foo -o bin/res_enc
start obfuscating bin/test_64bit...
obfuscation done!
$ ./bin/res_enc
Expand Down
9 changes: 4 additions & 5 deletions src/obfus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,14 @@ impl Obfuscator {
.truncate(true)
.open("/tmp/cattleya_encrypted_function_name")
.map_err(crate::error::Error::CreateFile)?;
let mut writer = aesstream::AesWriter::new(tmp_file, encryptor).unwrap();
writer
aesstream::AesWriter::new(tmp_file, encryptor)
.map_err(crate::error::Error::OpenFile)?
.write_all(function.as_bytes())
.map_err(crate::error::Error::Io)?;

let mut encrypted_function_name = Vec::new();
let mut tmp_file = std::fs::File::open("/tmp/cattleya_encrypted_function_name")
.map_err(crate::error::Error::OpenFile)?;
tmp_file
std::fs::File::open("/tmp/cattleya_encrypted_function_name")
.map_err(crate::error::Error::OpenFile)?
.read_to_end(&mut encrypted_function_name)
.map_err(crate::error::Error::Io)?;

Expand Down

0 comments on commit e3ecf09

Please sign in to comment.