Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add DEX module #822

Merged
merged 8 commits into from Feb 7, 2018
Merged

Add DEX module #822

merged 8 commits into from Feb 7, 2018

Conversation

ghost
Copy link

@ghost ghost commented Feb 1, 2018

Hi,

it is a first patch to add basic support for DEX file format.

This patch exported more things compare to the original format, mainly related to field/method information.

Copy link
Member

@plusvic plusvic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a fuzzer for this module. Take a look at https://github.com/VirusTotal/yara/tree/master/tests/oss-fuzz for some examples.

declare_integer("access_flags");
end_struct_array("field");

declare_integer("number_of_method");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user plural number_of_methods, for consistency with the naming used in other modules.

end_struct_array("map_item");
end_struct("map_list");

declare_integer("number_of_field");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user plural number_of_fields, for consistency with the naming used in other modules.


typedef struct
{
uint8_t magic[8];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2-space indentation across all this file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok it is done too

return dex_header;
}

void dex_parse_header(dex_header_t*dex_header, YR_OBJECT* module_object) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening curly braces in the next line, for style consistency within the codebase.

value,
dex->object, "string_ids[%i].value", i);

#ifdef DEBUG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think we should use another macro name for this, maybe DEX_MODULE_DEBUG

configure.ac Outdated
@@ -140,6 +140,13 @@ AC_ARG_WITH([crypto],
AS_HELP_STRING([--without-crypto],
[ignore presence of OpenSSL and disable it]))

AC_ARG_ENABLE([android],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--enable-dex instead of --enable-android.

Makefile.am Outdated
@@ -57,6 +57,12 @@ test_macho_SOURCES = tests/test-macho.c tests/util.c
test_macho_LDADD = libyara/.libs/libyara.a
endif

if ANDROID_MODULE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEX_MODULE instead of ANDROID_MODULE

@ghost ghost changed the title Add Android/DEX module Add DEX module Feb 1, 2018
@ghost
Copy link
Author

ghost commented Feb 2, 2018

Ok I remove finally the debug information, it is not super useful or I will add it more interesting later, and I added the necessary files for oss-fuzz

@plusvic plusvic merged commit e6e4360 into VirusTotal:master Feb 7, 2018
tarterp pushed a commit to mandiant/yara that referenced this pull request Mar 31, 2022
* Add DEX module

* Fix module name, indentation + minor things

* Add testing file for fuzzing + remove debug

* Add DEX module

* Fix module name, indentation + minor things

* Add testing file for fuzzing + remove debug
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants