diff --git a/lib/src/modules/dex/parser.rs b/lib/src/modules/dex/parser.rs index 0b1f3b054..96bd55142 100644 --- a/lib/src/modules/dex/parser.rs +++ b/lib/src/modules/dex/parser.rs @@ -41,50 +41,45 @@ pub struct Dex { } impl Dex { - // the type of endianness used in the file const ENDIAN_CONSTANT: u32 = 0x12345678; const REVERSE_ENDIAN_CONSTANT: u32 = 0x78563412; - - // lack of information + const DEX_HEADER_SIZE: u32 = 0x70; const NO_INDEX: u32 = 0xffffffff; + const MAX_STRINGS: usize = 1_000_000; + const MAX_TYPES: usize = 1_000_000; + const MAX_PROTOS: usize = 1_000_000; + const MAX_CLASSES: usize = 1_000_000; + const MAX_METHODS: usize = 1_000_000; + const MAX_FIELDS: usize = 1_000_000; + pub fn parse<'a>(data: &'a [u8]) -> Result>> { // Extract dex header with information about data location - let (strings_offset, header) = Self::parse_dex_header(data)?; + let (_, header) = Self::parse_dex_header(data)?; // Extract defined strings - let (types_offset, strings) = - Self::parse_strings(strings_offset, data, &header)?; + let strings = Self::parse_strings(data, &header); // Extract defined types - let (proto_offset, types) = - Self::parse_types(types_offset, &header, &strings)?; + let types = Self::parse_types(data, &header, &strings); - // Exctract defined prototypes - let (field_offset, proto_ids) = Self::parse_proto_ids( - proto_offset, - data, - &header, - &strings, - &types, - )?; + // Extract defined prototypes + let protos = Self::parse_protos(data, &header, &strings, &types); // Extract defined fields - let (method_offset, fields) = - Self::parse_fields(field_offset, &header, &strings, &types)?; + let fields = Self::parse_fields(data, &header, &strings, &types); // Extract defined methods - let (class_offset, methods) = Self::parse_methods( - method_offset, + let methods = Self::parse_methods( + data, &header, &strings, &types, - &proto_ids, - )?; + &protos, + ); // Extract defined classes - let (_, class_defs) = - Self::parse_class_defs(class_offset, &header, &strings, &types)?; + let class_defs = Self::parse_class_defs(data, &header, &strings, &types); // Extract map information let map_list = Self::parse_map_items(data, &header); @@ -93,7 +88,7 @@ impl Dex { header, strings, types, - protos: proto_ids, + protos, fields, methods, class_defs, @@ -201,41 +196,58 @@ impl Dex { /// A HashMap is needed to quickly access an item by its index. /// /// See: https://source.android.com/docs/core/runtime/dex-format#string-item - fn parse_strings<'a>( - remainder: &'a [u8], - data: &'a [u8], + fn parse_strings( + data: &[u8], header: &DexHeader, - ) -> IResult<&'a [u8], Vec>> { + ) -> Vec> { // DEX file doesn't contain strings. // It's a strange case, but it needs to be checked. if header.string_ids_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - let mut it = iterator(remainder, le_u32); + let table_slice = match data.get(header.string_ids_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator(table_slice, le_u32::<&[u8], Error>); let string_offsets = it .by_ref() + .take(Self::MAX_STRINGS) .take(header.string_ids_size as usize) .filter_map(|offset| Self::parse_string_from_offset(data, offset)) .map(Rc::new) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, string_offsets)) + string_offsets } /// Parses string by index in the string_ids_off table /// /// idx - is an index in the string_ids_off table /// strings_ids_off[idx] -> string_data_item + /// + /// Strings larger than 64KB will be considered invalid and the result will + /// be None. fn parse_string_from_offset( data: &[u8], string_data_offset: u32, ) -> Option { + if string_data_offset < Self::DEX_HEADER_SIZE { + return None; + } + data.get(string_data_offset as usize..).and_then(|data| { let (data, utf16_size) = uleb128(data).ok()?; + + if utf16_size > 65536 || (utf16_size as usize) > data.len() { + return None; + } + let (_, bytes) = take::(utf16_size as usize)(data).ok()?; @@ -253,58 +265,70 @@ impl Dex { /// `type_item = string_item[type_ids_off[idx]]` /// /// See: https://source.android.com/docs/core/runtime/dex-format#type-id-item - fn parse_types<'a>( - remainder: &'a [u8], + fn parse_types( + data: &[u8], header: &DexHeader, string_items: &[Rc], - ) -> IResult<&'a [u8], Vec>> { + ) -> Vec> { // DEX file doesn't contain types. // It's a strange case, but it needs to be checked. if header.type_ids_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - let mut it = iterator(remainder, le_u32); + let table_slice = match data.get(header.type_ids_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator(table_slice, le_u32::<&[u8], Error>); let type_indexes = it .by_ref() + .take(Self::MAX_TYPES) .take(header.type_ids_size as usize) .filter_map(|idx| string_items.get(idx as usize).cloned()) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, type_indexes)) + type_indexes } /// Collects a list of prototypes in a hashmap from proto_ids_off list. /// /// See: https://source.android.com/docs/core/runtime/dex-format#proto-id-item /// See: https://source.android.com/docs/core/runtime/dex-format#type-list - fn parse_proto_ids<'a>( - remainder: &'a [u8], - data: &'a [u8], + fn parse_protos( + data: &[u8], header: &DexHeader, string_items: &[Rc], type_items: &[Rc], - ) -> IResult<&'a [u8], Vec>> { + ) -> Vec> { // DEX file doesn't contain prototypes. // It's a strange case, but it needs to be checked. if header.proto_ids_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - let mut it = iterator(remainder, (le_u32, le_u32, le_u32)); + let table_slice = match data.get(header.proto_ids_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator(table_slice, (le_u32::<&[u8], Error>, le_u32, le_u32)); let proto_entries = it .by_ref() + .take(Self::MAX_PROTOS) .take(header.proto_ids_size as usize) .filter_map(|(shorty_idx, return_type_idx, parameters_off)| { let shorty = string_items.get(shorty_idx as usize)?.clone(); let return_type = type_items.get(return_type_idx as usize)?.clone(); - // According to the documentation, if parameters_off is 0, then the type has 0 parameters. + // According to the documentation, if parameters_off is 0, then + // the type has 0 parameters. let parameters = if parameters_off == 0 { Vec::new() } else { @@ -321,9 +345,9 @@ impl Dex { }) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, proto_entries)) + proto_entries } /// Collects a type list to list of strings from given offset @@ -335,10 +359,15 @@ impl Dex { offset: u32, ) -> Option>> { let remainder = data.get(offset as usize..)?; + let (remainder, size) = le_u32::<&[u8], Error>(remainder).ok()?; - let (rem, size) = le_u32::<&[u8], Error>(remainder).ok()?; + // The number of arguments can't be higher than 255 due to constraints + // in the Dalvik bytecode instruction set itself. + if size > 255 { + return None; + } - let mut it = iterator(rem, le_u32::<&[u8], Error>); + let mut it = iterator(remainder, le_u16::<&[u8], Error>); let items = it .by_ref() .take(size as usize) @@ -353,22 +382,28 @@ impl Dex { /// Collects a list of fields in a hashmap from field_ids_off list. /// /// See: https://source.android.com/docs/core/runtime/dex-format#field-id-item - fn parse_fields<'a>( - remainder: &'a [u8], + fn parse_fields( + data: &[u8], header: &DexHeader, string_items: &[Rc], type_items: &[Rc], - ) -> IResult<&'a [u8], Vec> { + ) -> Vec { // DEX file doesn't contain fields. // It's a strange case, but it needs to be checked. if header.field_ids_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - let mut it = iterator(remainder, (le_u16, le_u16, le_u32)); + let table_slice = match data.get(header.field_ids_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator(table_slice, (le_u16::<&[u8], Error>, le_u16, le_u32)); let field_entries = it .by_ref() + .take(Self::MAX_FIELDS) .take(header.field_ids_size as usize) .filter_map(|(class_idx, type_idx, name_idx)| { let class = type_items.get(class_idx as usize)?.clone(); @@ -379,31 +414,37 @@ impl Dex { }) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, field_entries)) + field_entries } /// Collects a list of methods in a hashmap from method_ids_off list. /// /// See: https://source.android.com/docs/core/runtime/dex-format#method-id-item - fn parse_methods<'a>( - remainder: &'a [u8], + fn parse_methods( + data: &[u8], header: &DexHeader, string_items: &[Rc], type_items: &[Rc], proto_items: &[Rc], - ) -> IResult<&'a [u8], Vec> { + ) -> Vec { // DEX file doesn't contain methods // It's a strange case, but it needs to be checked. if header.method_ids_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - let mut it = iterator(remainder, (le_u16, le_u16, le_u32)); + let table_slice = match data.get(header.method_ids_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator(table_slice, (le_u16::<&[u8], Error>, le_u16, le_u32)); let method_entries = it .by_ref() + .take(Self::MAX_METHODS) .take(header.method_ids_size as usize) .filter_map(|(class_idx, proto_idx, name_idx)| { let class = type_items.get(class_idx as usize)?.clone(); @@ -414,9 +455,9 @@ impl Dex { }) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, method_entries)) + method_entries } /// Collects a list of classes from class_defs_off list. @@ -424,24 +465,40 @@ impl Dex { /// useful when writing YARA rules. /// /// See: https://source.android.com/docs/core/runtime/dex-format#class-def-item - fn parse_class_defs<'a>( - remainder: &'a [u8], + fn parse_class_defs( + data: &[u8], header: &DexHeader, string_items: &[Rc], type_items: &[Rc], - ) -> IResult<&'a [u8], Vec> { + ) -> Vec { // DEX file doesn't contain classess // It's a strange case, but it needs to be checked. if header.class_defs_off == 0 { - return Ok((remainder, Vec::new())); + return Vec::new(); } - // (class_idx, access_flags, superclass_idx, _, source_file_idx) - let mut it = - iterator(remainder, (le_u32, le_u32, le_u32, le_u32, le_u32)); + let table_slice = match data.get(header.class_defs_off as usize..) { + Some(slice) => slice, + None => return Vec::new(), + }; + + let mut it = iterator( + table_slice, + ( + le_u32::<&[u8], Error>, // class_idx + le_u32, // access_flags + le_u32, // superclass_idx + le_u32, // interfaces_off + le_u32, // source_file_idx + le_u32, // annotations_off + le_u32, // class_data_off + le_u32, // static_values_off + ), + ); let class_entries = it .by_ref() + .take(Self::MAX_CLASSES) .take(header.class_defs_size as usize) .filter_map( |( @@ -450,6 +507,9 @@ impl Dex { superclass_idx, _, source_file_idx, + _, + _, + _, )| { let class = type_items.get(class_idx as usize)?.clone(); let superclass = if superclass_idx != Self::NO_INDEX { @@ -473,9 +533,9 @@ impl Dex { ) .collect(); - let (rem, _) = it.finish()?; + let _ = it.finish(); - Ok((rem, class_entries)) + class_entries } /// Collects information about maps from the DEX file @@ -484,7 +544,6 @@ impl Dex { fn parse_map_items(data: &[u8], header: &DexHeader) -> Option { data.get(header.map_off as usize..).and_then(|offset| { let (items_offset, size) = le_u32::<&[u8], Error>(offset).ok()?; - let mut it = iterator(items_offset, Self::parse_map_item); let items = it.by_ref().take(size as usize).collect(); let _ = it.finish(); diff --git a/lib/src/modules/dex/tests/testdata/2c96859a5adbb5ab72ac279a57594b86cbcbbd277e9bafea672c51201737d6a3.out b/lib/src/modules/dex/tests/testdata/2c96859a5adbb5ab72ac279a57594b86cbcbbd277e9bafea672c51201737d6a3.out index eb3f65410..98f522b77 100644 --- a/lib/src/modules/dex/tests/testdata/2c96859a5adbb5ab72ac279a57594b86cbcbbd277e9bafea672c51201737d6a3.out +++ b/lib/src/modules/dex/tests/testdata/2c96859a5adbb5ab72ac279a57594b86cbcbbd277e9bafea672c51201737d6a3.out @@ -43,7 +43,7 @@ protos: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "Landroid/app/Application;" + - "I" - shorty: "L" return_type: "Ljava/lang/String;" parameters_count: 0 @@ -94,7 +94,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "Landroid/app/Application;" + - "I" name: "createPackageContext" - class: "Lezbkvojpi/keikfof;" proto: diff --git a/lib/src/modules/dex/tests/testdata/b22108c4e0283e073bddac530bc1286515e078441d92a41e826578e0163d6faf.out b/lib/src/modules/dex/tests/testdata/b22108c4e0283e073bddac530bc1286515e078441d92a41e826578e0163d6faf.out index 3670b2aa1..5084aecc3 100644 --- a/lib/src/modules/dex/tests/testdata/b22108c4e0283e073bddac530bc1286515e078441d92a41e826578e0163d6faf.out +++ b/lib/src/modules/dex/tests/testdata/b22108c4e0283e073bddac530bc1286515e078441d92a41e826578e0163d6faf.out @@ -257,13 +257,13 @@ protos: parameters: - "Landroid/content/Intent;" - "I" - - "J" + - "I" - shorty: "ILI" return_type: "I" parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" - shorty: "IL" return_type: "I" parameters_count: 1 @@ -282,11 +282,12 @@ protos: parameters_count: 0 - shorty: "LLILI" return_type: "Landroid/app/PendingIntent;" - parameters_count: 3 + parameters_count: 4 parameters: - "Landroid/content/Context;" + - "I" - "Landroid/content/Intent;" - - "Landroid/app/Activity;" + - "I" - shorty: "LL" return_type: "Landroid/content/ComponentName;" parameters_count: 1 @@ -299,9 +300,10 @@ protos: - "I" - shorty: "LLL" return_type: "Landroid/content/Intent;" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/BroadcastReceiver;" + - "Landroid/content/IntentFilter;" - shorty: "LL" return_type: "Landroid/content/SharedPreferences;" parameters_count: 1 @@ -312,7 +314,7 @@ protos: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" - shorty: "L" return_type: "Landroid/content/res/AssetManager;" parameters_count: 0 @@ -326,10 +328,11 @@ protos: parameters_count: 0 - shorty: "LLLL" return_type: "Ldalvik/system/DexClassLoader;" - parameters_count: 2 + parameters_count: 3 parameters: + - "Ljava/lang/String;" + - "Ljava/lang/String;" - "Ljava/lang/ClassLoader;" - - "J" - shorty: "L" return_type: "Ljava/io/File;" parameters_count: 0 @@ -356,9 +359,10 @@ protos: - "I" - shorty: "LLL" return_type: "Ljava/lang/Object;" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/AlarmManager;" + - "Ljava/lang/Object;" + - "[Ljava/lang/Object;" - shorty: "LL" return_type: "Ljava/lang/Object;" parameters_count: 1 @@ -384,12 +388,15 @@ protos: - "Ljava/lang/String;" - shorty: "LL" return_type: "Ljava/lang/reflect/Constructor;" - parameters_count: 0 + parameters_count: 1 + parameters: + - "[Ljava/lang/Class;" - shorty: "LLL" return_type: "Ljava/lang/reflect/Method;" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/AlarmManager;" + - "Ljava/lang/String;" + - "[Ljava/lang/Class;" - shorty: "V" return_type: "V" parameters_count: 0 @@ -403,13 +410,14 @@ protos: parameters_count: 2 parameters: - "I" - - "Landroid/app/AlarmManager;" + - "I" - shorty: "VIJL" return_type: "V" - parameters_count: 2 + parameters_count: 3 parameters: + - "I" + - "J" - "Landroid/app/PendingIntent;" - - "Landroid/app/Activity;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -417,14 +425,16 @@ protos: - "Landroid/content/BroadcastReceiver;" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/Context;" + - "Landroid/content/Intent;" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/Activity;" + - "Landroid/content/Context;" + - "Ljava/lang/Class;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -432,10 +442,11 @@ protos: - "Landroid/content/Intent;" - shorty: "VLLL" return_type: "V" - parameters_count: 2 + parameters_count: 3 parameters: + - "Landroid/content/Intent;" + - "Landroid/content/SharedPreferences;" - "Ljava/lang/Object;" - - "J" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -453,9 +464,10 @@ protos: - "Ljava/io/File;" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/io/File;" + - "Ljava/io/ByteArrayOutputStream;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -471,12 +483,13 @@ protos: parameters_count: 2 parameters: - "Ljava/lang/Object;" - - "J" + - "I" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/lang/Object;" + - "Landroid/content/Intent;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -484,14 +497,16 @@ protos: - "Ljava/lang/String;" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/lang/String;" + - "Ljava/lang/String;" - shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/Activity;" + - "Ljava/lang/reflect/Method;" + - "Ljava/lang/Object;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -499,10 +514,12 @@ protos: - "Lorg/BasicActivity;" - shorty: "VLLIL" return_type: "V" - parameters_count: 2 + parameters_count: 4 parameters: - - "J" - - "Landroid/os/Bundle;" + - "Lorg/CeonstReceiver;" + - "Landroid/content/Intent;" + - "I" + - "Ljava/lang/Object;" - shorty: "VL" return_type: "V" parameters_count: 1 @@ -519,7 +536,7 @@ protos: parameters: - "[B" - "I" - - "Landroid/app/Activity;" + - "I" - shorty: "Z" return_type: "Z" parameters_count: 0 @@ -536,13 +553,13 @@ protos: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" - shorty: "LLI" return_type: "[B" parameters_count: 2 parameters: - "[B" - - "Landroid/app/Activity;" + - "I" - shorty: "LL" return_type: "[Ljava/lang/String;" parameters_count: 1 @@ -634,10 +651,11 @@ methods: proto: shorty: "VIJL" return_type: "V" - parameters_count: 2 + parameters_count: 3 parameters: + - "I" + - "J" - "Landroid/app/PendingIntent;" - - "Landroid/app/Activity;" name: "set" - class: "Landroid/app/Application;" proto: @@ -661,11 +679,12 @@ methods: proto: shorty: "LLILI" return_type: "Landroid/app/PendingIntent;" - parameters_count: 3 + parameters_count: 4 parameters: - "Landroid/content/Context;" + - "I" - "Landroid/content/Intent;" - - "Landroid/app/Activity;" + - "I" name: "getBroadcast" - class: "Landroid/app/Service;" proto: @@ -695,9 +714,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/lang/String;" + - "Ljava/lang/String;" name: "" - class: "Landroid/content/Context;" proto: @@ -706,7 +726,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" name: "getSharedPreferences" - class: "Landroid/content/Context;" proto: @@ -720,9 +740,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/Activity;" + - "Landroid/content/Context;" + - "Ljava/lang/Class;" name: "" - class: "Landroid/content/Intent;" proto: @@ -761,7 +782,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" name: "getInt" - class: "Landroid/content/res/AssetManager;" proto: @@ -798,7 +819,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "J" + - "I" name: "decode" - class: "Landroid/util/Base64;" proto: @@ -807,7 +828,7 @@ methods: parameters_count: 2 parameters: - "[B" - - "Landroid/app/Activity;" + - "I" name: "decode" - class: "Landroid/view/Window;" proto: @@ -832,7 +853,7 @@ methods: parameters_count: 2 parameters: - "I" - - "Landroid/app/AlarmManager;" + - "I" name: "setFlags" - class: "Landroid/view/Window;" proto: @@ -862,7 +883,7 @@ methods: parameters: - "[B" - "I" - - "Landroid/app/Activity;" + - "I" name: "write" - class: "Ljava/io/File;" proto: @@ -944,15 +965,18 @@ methods: proto: shorty: "LL" return_type: "Ljava/lang/reflect/Constructor;" - parameters_count: 0 + parameters_count: 1 + parameters: + - "[Ljava/lang/Class;" name: "getConstructor" - class: "Ljava/lang/Class;" proto: shorty: "LLL" return_type: "Ljava/lang/reflect/Method;" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/AlarmManager;" + - "Ljava/lang/String;" + - "[Ljava/lang/Class;" name: "getMethod" - class: "Ljava/lang/Class;" proto: @@ -1068,9 +1092,10 @@ methods: proto: shorty: "LLL" return_type: "Ljava/lang/Object;" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/AlarmManager;" + - "Ljava/lang/Object;" + - "[Ljava/lang/Object;" name: "invoke" - class: "Ljava/util/zip/InflaterInputStream;" proto: @@ -1106,9 +1131,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/Context;" + - "Landroid/content/Intent;" name: "onReceive" - class: "Lorg/BasicActivity;" proto: @@ -1176,10 +1202,12 @@ methods: proto: shorty: "VLLIL" return_type: "V" - parameters_count: 2 + parameters_count: 4 parameters: - - "J" - - "Landroid/os/Bundle;" + - "Lorg/CeonstReceiver;" + - "Landroid/content/Intent;" + - "I" + - "Ljava/lang/Object;" name: "" - class: "Lorg/CeonstReceiver$1;" proto: @@ -1188,7 +1216,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/Object;" - - "J" + - "I" name: "a" - class: "Lorg/CeonstReceiver$1;" proto: @@ -1214,18 +1242,20 @@ methods: proto: shorty: "VLLL" return_type: "V" - parameters_count: 2 + parameters_count: 3 parameters: + - "Landroid/content/Intent;" + - "Landroid/content/SharedPreferences;" - "Ljava/lang/Object;" - - "J" name: "a" - class: "Lorg/CeonstReceiver;" proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/Context;" + - "Landroid/content/Intent;" name: "onReceive" - class: "Lorg/DevService$1;" proto: @@ -1239,9 +1269,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/Context;" + - "Landroid/content/Intent;" name: "onReceive" - class: "Lorg/DevService;" proto: @@ -1267,9 +1298,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/lang/Object;" + - "Landroid/content/Intent;" name: "a" - class: "Lorg/DevService;" proto: @@ -1327,15 +1359,16 @@ methods: parameters: - "Landroid/content/Intent;" - "I" - - "J" + - "I" name: "onStartCommand" - class: "Lorg/DevService;" proto: shorty: "LLL" return_type: "Landroid/content/Intent;" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Landroid/content/BroadcastReceiver;" + - "Landroid/content/IntentFilter;" name: "registerReceiver" - class: "Lorg/DevService;" proto: @@ -1381,9 +1414,10 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "Landroid/app/Activity;" + - "Ljava/lang/reflect/Method;" + - "Ljava/lang/Object;" name: "a" - class: "Lorg/KseActivity;" proto: @@ -1429,10 +1463,11 @@ methods: proto: shorty: "LLLL" return_type: "Ldalvik/system/DexClassLoader;" - parameters_count: 2 + parameters_count: 3 parameters: + - "Ljava/lang/String;" + - "Ljava/lang/String;" - "Ljava/lang/ClassLoader;" - - "J" name: "a" - class: "Lorg/hskdAppli;" proto: @@ -1452,17 +1487,19 @@ methods: proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/io/File;" + - "Ljava/io/ByteArrayOutputStream;" name: "a" - class: "Lorg/hskdAppli;" proto: shorty: "VLL" return_type: "V" - parameters_count: 1 + parameters_count: 2 parameters: - - "J" + - "Ljava/lang/String;" + - "Ljava/lang/String;" name: "a" - class: "Lorg/hskdAppli;" proto: @@ -1492,23 +1529,36 @@ class_defs: - class: "Lorg/BasicActivity$1;" access_flags: 0x10 # ACC_FINAL superclass: "Ljava/lang/Object;" - - class: "Landroid/content/BroadcastReceiver;" + - class: "Lorg/BasicActivity$2;" access_flags: 0x0 - - class: "I" - access_flags: 0x2f # ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_SYNCHRONIZED - superclass: "J" - source_file: ".Loader" - - class: "I" - access_flags: 0x24 # ACC_PROTECTED | ACC_SYNCHRONIZED - - class: "I" - access_flags: 0xffffffff # ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_FINAL | ACC_SYNCHRONIZED | ACC_BRIDGE | ACC_VARARGS | ACC_NATIVE | ACC_INTERFACE | ACC_ABSTRACT | ACC_STRICT | ACC_SYNTHETIC | ACC_ANNOTATION | ACC_ENUM | ACC_CONSTRUCTOR | ACC_DECLARED_SYNCHRONIZED - superclass: "I" - source_file: ".Loader" - - class: "Lorg/DevService$1;" + superclass: "Landroid/content/BroadcastReceiver;" + - class: "Lorg/BasicActivity;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Landroid/app/Activity;" + - class: "Lorg/CeonstReceiver$1;" access_flags: 0x0 + superclass: "Ljava/lang/Object;" + - class: "Lorg/CeonstReceiver;" + access_flags: 0x1 # ACC_PUBLIC superclass: "Landroid/content/BroadcastReceiver;" - - class: "Landroid/app/Service;" + - class: "Lorg/DevService$1;" access_flags: 0x0 + superclass: "Landroid/content/BroadcastReceiver;" + - class: "Lorg/DevService;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Landroid/app/Service;" + - class: "Lorg/KasReceiver;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Lorg/CeonstReceiver;" + - class: "Lorg/KseActivity;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Landroid/app/Activity;" + - class: "Lorg/MvReceiver;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Lorg/CeonstReceiver;" + - class: "Lorg/hskdAppli;" + access_flags: 0x1 # ACC_PUBLIC + superclass: "Landroid/app/Application;" map_list: size: 15 items: diff --git a/lib/src/modules/dex/tests/testdata/c14c75d58399825287e0ee0fcfede6ec06f93489fb52f70bca2736fae5fceab2.out b/lib/src/modules/dex/tests/testdata/c14c75d58399825287e0ee0fcfede6ec06f93489fb52f70bca2736fae5fceab2.out index 942d7a39f..e1db0372a 100644 --- a/lib/src/modules/dex/tests/testdata/c14c75d58399825287e0ee0fcfede6ec06f93489fb52f70bca2736fae5fceab2.out +++ b/lib/src/modules/dex/tests/testdata/c14c75d58399825287e0ee0fcfede6ec06f93489fb52f70bca2736fae5fceab2.out @@ -43,7 +43,7 @@ protos: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "Landroid/app/Application;" + - "I" - shorty: "L" return_type: "Ljava/lang/String;" parameters_count: 0 @@ -102,7 +102,7 @@ methods: parameters_count: 2 parameters: - "Ljava/lang/String;" - - "Landroid/app/Application;" + - "I" name: "createPackageContext" - class: "Lwmczycqxv/egztwrhea;" proto: