Skip to content
Merged
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
2 changes: 1 addition & 1 deletion common/optparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const struct clam_option __clam_options[] = {
{NULL, "verbose", 'v', CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_CLAMONACC, "", ""},
{NULL, "dumpcerts", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "Dump authenticode certificate chain.", ""},
{NULL, "quiet", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_CLAMONACC, "", ""},
{NULL, "leave-temps", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", ""},
{NULL, "leave-temps", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN | OPT_SIGTOOL, "", ""},
{NULL, "no-warnings", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", ""},
{NULL, "show-progress", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", ""},
{NULL, "stdout", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_CLAMONACC, "", ""},
Expand Down
6 changes: 6 additions & 0 deletions docs/man/sigtool.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ Test all signatures from DATABASE against TARGET_FILE. This option will only giv
.TP
\fB\-\-print\-certs=FILE\fR
Print Authenticode details from a PE file.
.TP
\fB\-\-tempdir=DIRECTORY\fR
Create temporary files in DIRECTORY. Directory must be writable for the user running sigtool.
.TP
\fB\-\-leave\-temps\fR
Do not remove temporary files.

.SH "ENVIRONMENT VARIABLES"
.LP
Expand Down
21 changes: 21 additions & 0 deletions libclamav/clamav.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,27 @@ typedef int (*clcb_file_props)(const char *j_propstr, int rc, void *cbdata);
*/
extern void cl_engine_set_clcb_file_props(struct cl_engine *engine, clcb_file_props callback);

/**
* @brief generic data callback function.
*
* Callback handler prototype for callbacks passing back data and application context.
*
* @param data A pointer to some data. Should be treated as read-only and may be freed after callback.
* @param data_len The length of data.
* @param cbdata Opaque application provided data.
*/
typedef int (*clcb_generic_data)(const unsigned char *const data, const size_t data_len, void *cbdata);

/**
* @brief Set a custom VBA macro callback function.
*
* Caution: changing options for an engine that is in-use is not thread-safe!
*
* @param engine The initialized scanning engine.
* @param callback The callback function pointer.
*/
extern void cl_engine_set_clcb_vba(struct cl_engine *engine, clcb_generic_data callback);

/* ----------------------------------------------------------------------------
* Statistics/telemetry gathering callbacks.
*
Expand Down
1 change: 1 addition & 0 deletions libclamav/libclamav.map
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ CLAMAV_1.0.0 {
CLAMAV_1.1.0 {
global:
cl_cvdgetage;
cl_engine_set_clcb_vba;
} CLAMAV_1.0.0;
CLAMAV_PRIVATE {
global:
Expand Down
5 changes: 5 additions & 0 deletions libclamav/others.c
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,11 @@ void cl_engine_set_clcb_file_props(struct cl_engine *engine, clcb_file_props cal
engine->cb_file_props = callback;
}

void cl_engine_set_clcb_vba(struct cl_engine *engine, clcb_generic_data callback)
{
engine->cb_vba = callback;
}

uint8_t cli_get_debug_flag()
{
return cli_debug_flag;
Expand Down
1 change: 1 addition & 0 deletions libclamav/others.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ struct cl_engine {
void *cb_sigload_ctx;
clcb_hash cb_hash;
clcb_meta cb_meta;
clcb_generic_data cb_vba;
clcb_file_props cb_file_props;
clcb_progress cb_sigload_progress;
void *cb_sigload_progress_ctx;
Expand Down
10 changes: 10 additions & 0 deletions libclamav/vba_extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,10 +1259,20 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co
module_data_utf8_size = vba_normalize(module_data_utf8, module_data_utf8_size);

CLI_WRITEN(module_data_utf8, module_data_utf8_size);

if (NULL != ctx->engine->cb_vba) {
ctx->engine->cb_vba(module_data_utf8, module_data_utf8_size, ctx->cb_ctx);
}

module_stream_found = 1;
free(module_data_utf8);
module_data_utf8 = NULL;
} else {
/*If normalization didn't work, fall back to the pre-normalized data.*/
if (NULL != ctx->engine->cb_vba) {
ctx->engine->cb_vba(module_data, module_data_size, ctx->cb_ctx);
}

CLI_WRITEN("\n<Error decoding module data>\n", 30);
cli_dbgmsg("cli_vba_readdir_new: Failed to decode VBA module content from codepage %" PRIu16 " to UTF8\n", codepage);
}
Expand Down
Loading