53 int main(
int argc,
char **argv)
56 struct doca_log_backend *sdk_log;
59 struct doca_apsh_process **processes;
60 struct doca_apsh_yara **yara_matches;
62 int num_processes, i, yara_matches_size;
64 uint32_t yara_rules_arr_size = 2;
65 struct doca_telemetry_exporter_schema *telemetry_schema;
66 struct doca_telemetry_exporter_source *telemetry_source;
69 bool telemetry_enabled;
120 for (i = 0; i < num_processes; i++) {
128 if (yara_matches_size != 0) {
129 for (i = 0; i < yara_matches_size; i++) {
134 if (!telemetry_enabled)
141 yara_match_event.
pid =
143 yara_match_event.
vad =
174 if (telemetry_enabled)
doca_error_t telemetry_start(struct doca_telemetry_exporter_schema **telemetry_schema, struct doca_telemetry_exporter_source **telemetry_source, struct event_indexes *indexes)
void telemetry_destroy(struct doca_telemetry_exporter_schema *telemetry_schema, struct doca_telemetry_exporter_source *telemetry_source)
doca_telemetry_exporter_timestamp_t timestamp
struct rdma_resources resources
doca_apsh_yara_rule
available doca app shield yara rules
@ DOCA_APSH_YARA_RULE_MIMIKATZ
@ DOCA_APSH_YARA_RULE_HELLO_WORLD
@ DOCA_APSH_YARA_SCAN_HEAP
@ DOCA_APSH_YARA_MATCH_WINDOW_ADDR
#define doca_apsh_yara_info_get(yara, attr)
Get attribute value for a yara.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_processes_get(struct doca_apsh_system *system, struct doca_apsh_process ***processes, int *processes_size)
Get array of current processes running on the system.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_yara_get(struct doca_apsh_process *process, enum doca_apsh_yara_rule *yara_rules_arr, uint32_t yara_rules_arr_size, uint64_t scan_type, struct doca_apsh_yara ***yara_matches, int *yara_matches_size)
Scan current process with yara rules. The scanning is done with a window size and step that are set b...
DOCA_EXPERIMENTAL void doca_apsh_yara_free(struct doca_apsh_yara **yara_matches)
Destroys a yara context.
DOCA_EXPERIMENTAL void doca_apsh_processes_free(struct doca_apsh_process **processes)
Destroys a process context.
DOCA_EXPERIMENTAL doca_error_t doca_argp_start(int argc, char **argv)
Parse incoming arguments (cmd line/json).
DOCA_EXPERIMENTAL doca_error_t doca_argp_init(const char *program_name, void *program_config)
Initialize the parser interface.
DOCA_EXPERIMENTAL doca_error_t doca_argp_destroy(void)
ARG Parser destroy.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_standard(void)
Create default, non configurable backend for application messages.
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_with_file_sdk(FILE *fptr, struct doca_log_backend **backend)
Create a logging backend with a FILE* stream for SDK messages.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_set_sdk_level(struct doca_log_backend *backend, uint32_t level)
Set the log level limit for SDK logging backends.
uint8_t doca_telemetry_exporter_type_index_t
DOCA schema field type index.
uint64_t doca_telemetry_exporter_timestamp_t
DOCA schema type index type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_get_timestamp(doca_telemetry_exporter_timestamp_t *timestamp)
Get timestamp in the proper format.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_source_report(struct doca_telemetry_exporter_source *doca_source, doca_telemetry_exporter_type_index_t index, void *data, int count)
Report events data of the same type via DOCA source.
char yara_rule_name[MAX_PATH_LEN+1]
doca_telemetry_exporter_timestamp_t timestamp
char process_name[MAX_PROCESS_NAME_LEN+1]
size_t strlcpy(char *dst, const char *src, size_t size)
int main(int argc, char **argv)
DOCA_LOG_REGISTER(YARA_APP)
doca_error_t register_yara_params(void)
void yara_inspection_cleanup(struct yara_resources *resources)
doca_error_t yara_inspection_init(struct yara_config *conf, struct yara_resources *resources)
#define MAX_PROCESS_NAME_LEN