Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/modules/pe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,14 @@ Reference

*Example: pe.is_pe*

.. c:function:: is_exe()

.. versionadded:: 4.3.3

Function returning true if the PE is a EXE.

*Example: pe.is_exe()*

.. c:function:: is_dll()

.. versionadded:: 3.5.0
Expand Down
13 changes: 13 additions & 0 deletions libyara/modules/pe/pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -3299,6 +3299,18 @@ define_function(language)
return_integer(0);
}

define_function(is_exe)
{
int64_t characteristics;
YR_OBJECT* module = yr_module();

if (yr_is_undefined(module, "characteristics"))
return_integer(YR_UNDEFINED);

characteristics = yr_get_integer(module, "characteristics");
return_integer(characteristics & IMAGE_FILE_EXECUTABLE_IMAGE);
}

define_function(is_dll)
{
int64_t characteristics;
Expand Down Expand Up @@ -3791,6 +3803,7 @@ begin_declarations
declare_function("delayed_import_rva", "si", "i", delayed_import_rva_ordinal);
declare_function("locale", "i", "i", locale);
declare_function("language", "i", "i", language);
declare_function("is_exe", "", "i", is_exe);
declare_function("is_dll", "", "i", is_dll);
declare_function("is_32bit", "", "i", is_32bit);
declare_function("is_64bit", "", "i", is_64bit);
Expand Down
1 change: 1 addition & 0 deletions tests/oss-fuzz/rules_fuzzer.dict
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"pe.language"
"pe.imphash"
"pe.section_index"
"pe.is_exe()"
"pe.is_dll()"
"pe.is_32bit()"
"pe.is_64bit()"
Expand Down