forked from VirusTotal/yara
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collect some open PRs for inclusion for 4.3.0 (VirusTotal#1835)
* Fix `pe_rva_to_offset` * Fix: checking if RVA is inside section * Fix: real pointer to raw data is aligned down to sector size * Add pe.import_rva() functions. Add pe.import_rva("foo.dll", "func1") which returns the RVA of the imported function. Also add pe.import_rva("foo.dll", 1) which does the same but the import is done by ordinal. * Implement delayed import RVA and add docs. * Add math.length() Add a math.length() which will return the length of the sequence of bytes, including any NULL bytes. Fixes VirusTotal#1778. * Add string module. Move the math.to_int() functions and math.length() over to the new string module. I decided to move the to_int() because it seems logical to convert from a string to an integer using a string module rather than the math module. You still use math.to_string() to convert an integer to a string, and use string.to_int() to convert a string to an integer. Add tests and docs for string module. Move the appropriate tests from the math module over to the new string tests. While here, also add the console module to the bazel build as it was apparently missing (this is untested). * Remove unused include. * Add tests for VirusTotal#1561 * Fix copyright year in string module. Co-authored-by: Peter Babka <peter.babka@avast.com>
- Loading branch information
Showing
17 changed files
with
422 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
.. _string-module: | ||
|
||
########### | ||
String module | ||
########### | ||
|
||
.. versionadded:: 4.3.0 | ||
|
||
The String module provides functions for manipulating strings as returned by | ||
modules. The strings referenced here are not YARA strings as defined in the | ||
strings section of your rule. | ||
|
||
.. c:function:: to_int(string) | ||
.. versionadded:: 4.3.0 | ||
|
||
Convert the given string to a signed integer. If the string starts with "0x" | ||
it is treated as base 16. If the string starts with "0" it is treated base | ||
8. Leading '+' or '-' is also supported. | ||
|
||
*Example: string.to_int("1234") == 1234* | ||
*Example: string.to_int("-10") == -10* | ||
*Example: string.to_int("-010" == -8* | ||
|
||
.. c:function:: to_int(string, base) | ||
.. versionadded:: 4.3.0 | ||
|
||
Convert the given string, interpreted with the given base, to a signed | ||
integer. Base must be 0 or between 2 and 32 inclusive. If it is zero then | ||
the string will be intrepreted as base 16 if it starts with "0x" or as base | ||
8 if it starts with "0". Leading '+' or '-' is also supported. | ||
|
||
*Example: string.to_int("011", 8) == "9"* | ||
*Example: string.to_int("-011", 0) == "-9"* | ||
|
||
.. c:function:: length(string) | ||
.. versionadded:: 4.3.0 | ||
|
||
Return the length of the string, which can be any sequence of bytes. NULL | ||
bytes included. | ||
|
||
*Example: string.length("AXS\x00ERS") == 7* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.