Commit Graph
1902 Commits
Author SHA1 Message Date
wesinator 3dae9fe4b8 Highlight example yara code (#852) 2018-05-13 18:44:30 +02:00
Brian Carrier e4991b9016 Added Cyber Triage to list of tools. (#843) 2018-05-13 18:40:51 +02:00
laudarch fcf06fb8a1 Update .gitignore (#869)
Ignore two extra files that are generated and cause pull issues.
2018-05-13 18:39:11 +02:00
Victor M. Alvarez bbd8713d6d Add LimaCharlie to "who's using YARA". 2018-05-12 18:53:51 +02:00
Victor M. Alvarez b3f658f99a Add size of Aho-Corasick transition and match tables to rules stats. 2018-05-09 22:56:23 +02:00
Victor M. Alvarez 08b497fe1b Improve rules statistics and implement command-line for printing them. 2018-05-09 08:55:24 +02:00
Victor M. Alvarez 20a03fc540 Implement API for getting stats about compiled rules. 2018-05-07 21:13:32 +02:00
Victor M. Alvarez 0681581e84 Add size of Aho-Corasick transition table and match table to the header of compiled rules.
Having this size in the header facilitates iterating over the tables for computing statistics about the Aho-Corasick automaton.
2018-05-07 16:09:26 +02:00
Victor M. Alvarez 5637d2ae81 Fix memory leaks in fuzzers. 2018-04-19 09:08:59 +02:00
Victor M. Alvarez a687b2d6b2 Fuzzers should return 0 in all cases. 2018-04-18 08:58:20 +02:00
Victor M. Alvarez 713b619014 Limit the total number of functions YARA can import, from 268M maximum down to 16K. 2018-04-04 09:22:49 +02:00
Victor M. Alvarez 420088213e Try fixing issue with Travis-CI by removing postgresql-9.3 package. 2018-03-20 00:48:05 +01:00
Daniel Roethlisberger 00d3c04b29 Add mach_absolute_time()-based stopwatch for macOS (#842)
* Add mach_absolute_time()-based stopwatch for macOS

Unbreak on macOS releases before 10.12 Sierra, lacking clock_gettime(),
by adding an mach_absolute_time()-based implementation of stopwatch.
Prefer the mach_absolute_time()-based implementation to clock_gettime()
for now.  Only check for clock_gettime() in ./configure on non-Mach
platforms.

* Fix Mach stopwatch to yield micros not picos
2018-03-20 00:37:24 +01:00
Patrick Copeland f17c65f720 Set AC_CONFIG_AUX_DIR in configure.ac (#838)
First execution of ./bootstrap.sh fails on CentOS 7 because of libtool (v2.4.2, most recent version available in package repo) when AC_CONFIG_AUX_DIR is not set.
2018-03-06 19:03:11 +01:00
Victor M. Alvarez 949c9324af Upgrade gcc in Travis for fixing issue with unmet dependencies while installing gcc-multilib. 2018-02-22 16:39:03 +01:00
Victor M. Alvarez 100fddb100 Disable Coverity in Travis-CI. 2018-02-22 16:19:49 +01:00
Victor M. Alvarez b9870f1507 Fix spacing. 2018-02-22 16:13:11 +01:00
Victor M. Alvarez c1566b7e61 Remove change that slipped out in previous commit. 2018-02-22 15:13:57 +01:00
Victor M. Alvarez e8ef8c0ded Reorganize type definitions. 2018-02-22 14:56:08 +01:00
Victor M. Alvarez 53c9f72a9d Closes issue #834. 2018-02-21 22:02:31 +01:00
Victor M. Alvarez 7509a7b0f5 Fix undefined shift operation (#833)
* Do not allow negative right operand in shift operation.

* Add test case for negative shift operands.
2018-02-21 10:47:00 +01:00
Victor M. Alvarez 17e0fc4590 Don't return ERROR_WRONG_ARGUMENTS in "hash" module's functions.
Some functions in "hash" module (like sha256, sha1, md5) were returning ERROR_WRONG_ARGUMENTS upon receiving negative offsets or lengths. In those cases a more appropriate behaviour is returning an UNDEFINED value, as ERROR_WRONG_ARGUMENTS makes YARA abort the scanning.
2018-02-20 23:45:59 +01:00
Wesley Shields 69492df2ad Document the xor modifier. (#832)
* Document the xor modifier.

* Update docs to clarify xor and wide interaction.
2018-02-20 08:49:55 +01:00
Victor M. Alvarez 023794bc48 Re-generate lexer.c with flex 2.6.4 2018-02-18 19:49:34 +01:00
Wesley Shields 2e664c566f Implement xor modifier. (#830) 2018-02-18 19:46:08 +01:00
Victor M. Alvarez 16c5bad214 Add test case for bug fixed in 2840fa7fbb 2018-02-16 19:55:19 +01:00
Victor M. Alvarez 34c0a2c458 Add RedSocks Security to "who's using YARA". 2018-02-16 19:52:56 +01:00
Victor M. Alvarez 346621a8c3 Fix wrong error code returned by yr_re_fast_exec. 2018-02-16 17:16:56 +01:00
Wesley Shields 2840fa7fbb Compare the 'wide' bytes to null. (#831) 2018-02-16 17:12:08 +01:00
Victor M. Alvarez 6c3900670a Improve rules profiling (#829)
* Improve rules profiling. The most relevant changes are:

* Stop using time() and difftime() for measuring time. Use yr_stopwatch_elapsed_ns instead.

* clock_ticks field in YR_RULE and YR_STRING structures has been renamed to time_cost.

*  When the time_cost for some YR_STRING structure is incremented, it's incremented for its associated YR_RULE structure too. Iterating over the YR_STRING structures is not necessary for computing the total cost for some YR_STRING.

* A time_cost field was added to the YR_RULES structure. The ratio between YR_RULES structure's time_cost and YR_RULE structure's time_cost offers a better measure of how costly a rule is.
2018-02-16 16:59:53 +01:00
Victor M. Alvarez 20c36350c4 Improve error reporting in yara command-line tool. 2018-02-13 18:42:27 +01:00
Victor M. Alvarez 638123fe09 Increase ARENA_FILE_VERSION.
Commit f35c29dc8c changed the layout of structures that make old files incompatible.
2018-02-13 17:41:22 +01:00
Victor M. Alvarez f35c29dc8c Implement yr_scanner_last_error_string and yr_scanner_last_error_rule functions for getting information about the rule and string that caused a scanning error.
For implementing this feature it was necessary to add a new field to YR_STRING pointing to the YR_RULE that owns the string.
2018-02-13 17:36:12 +01:00
Victor M. Alvarez a1f724a450 Add configure options --with-tcmalloc and --with-cpu-profiler. Rename --enable-jemalloc to --with-jemalloc. 2018-02-13 12:01:13 +01:00
Victor M. Alvarez 205552ba64 Some style fixes in dex module. 2018-02-13 11:59:07 +01:00
Anthony Desnos 105054bc1b Add debug flag for dex module + add some checks (#828) 2018-02-13 11:38:41 +01:00
Victor M. Alvarez 9a9c40efd5 Allow configuring the maximum number of bytes stored for each match via yr_set_configuration. 2018-02-12 12:14:59 +01:00
Victor M. Alvarez de9567c190 Print malloc stats when finalizing YARA and using jemalloc. 2018-02-09 19:15:37 +01:00
Victor M. Alvarez 23fa049779 Remove call to yr_mem_stats. 2018-02-09 17:38:01 +01:00
Victor M. Alvarez bc4dde0b2b Optimize memory usage (#826)
This commit reduces YARA's memory footprint by:

* Stripping relocation information from those arena don't need to be relocated. This apply particularly to arenas created by yr_arena_load_stream, which implies that those arenas can't be saved back with yr_arena_save_stream.

* Reduce the default amount of matching data hold in YR_MATCH structures.
2018-02-09 14:20:36 +01:00
Victor M. Alvarez df1d1fa7f5 Fix dex test case. 2018-02-07 12:03:42 +01:00
Victor M. Alvarez 4dbfee1aea Fix wrong placeholder while calling set_integer in dex module. 2018-02-07 12:03:27 +01:00
Victor M. Alvarez 358c3deab9 Add dex module to Visual Studio project. 2018-02-07 11:11:23 +01:00
Victor M. Alvarez 868902cd0c Some re-styling in dex module. Add adesnos to CONTRIBUTORS. 2018-02-07 11:08:55 +01:00
Anthony Desnos e6e436008b Add DEX module (#822)
* 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
2018-02-07 10:16:26 +01:00
Victor M. Alvarez a7e4a57290 Fix issue when compiling YARA with MAX_ATOM_SIZE larger than 4.
The size of the buffer used by _yr_atoms_case_insensitive was correct for MAX_ATOM_SIZE == 4 but the formula for calculating it was incorrect. That caused a buffer-overflow when increasing MAX_ATOM_SIZE. This  fixes the formula for calculating the buffer size and reduces memory consumption by using uint8_t instead of int for the atom lengths stored in the buffer.
2018-02-06 20:02:32 +01:00
Victor M. Alvarez 6d5c1e682b Do not use thread local storage for storing fiber pools in regexp eng… (#823)
* Do not use thread local storage for storing fiber pools in regexp engine.

The regexp engine maintains a fiber pool for each thread that executes the yr_re_exec function. The fiber pool was stored using thread local storage (TLS), but this design as proven to be a bad decision, as each thread was responsible for freeing its own fiber pool and this was problematic in languages like Go, where the runtime can create multiple threads but the programmer don't have full control of such threads. Now the fiber pool is stored in the YR_SCAN_CONTEXT structure.

* Remove re_match macro and make calls to yr_re_match explicit in modules.
2018-02-05 16:39:20 +01:00
Victor M. Alvarez 6a84a77d89 Dump jemalloc profile in yr_finalize if built with --enable-jemalloc. 2018-02-03 23:01:25 +01:00
Victor M. Alvarez 22ca671eb4 Allow building with jemalloc library. 2018-02-03 20:20:56 +01:00
Victor M. Alvarez b8e64814af Make yr_scanner_define_boolean_variable receive an int instead of an int64_t. This keep the coherency with yr_compiler_define_boolean_variable and yr_rules_define_boolean_variable. 2018-02-02 13:59:09 +01:00