Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Jan 1, 2021
1 parent 435a877 commit da16427
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/matchers/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,22 @@ pub fn is_mach(buf: &[u8]) -> bool {
}
}

/// Returns whether a buffer is a Dalvik Executable(DEX).
/// Returns whether a buffer is a Dalvik Executable (DEX).
pub fn is_dex(buf: &[u8]) -> bool {
// https://source.android.com/devices/tech/dalvik/dex-format#dex-file-magic

buf.len() > 36
// magic
&& buf[0] == 0x64 && buf[1] == 0x65 && buf[2] == 0x78 && buf[3] == 0x0A
// file sise
// file sise
&& buf[36] == 0x70
}


/// Returns whether a buffer is a Dey Optimized Dalvik Executable(ODEX)
/// Returns whether a buffer is a Dey Optimized Dalvik Executable (ODEX).
pub fn is_dey(buf: &[u8]) -> bool {
buf.len() > 100
// magic
&& buf[0] == 0x64 && buf[1] == 0x65 && buf[2] == 0x79 && buf[3] == 0x0A
// file sise
// file sise
&& is_dex(&buf[40..100])
}
}

0 comments on commit da16427

Please sign in to comment.