static void report(ReportMessageApi & report_message, bool is_pattern_kill, ConfigureRegexes conf_regex, const char * pattern, const char * data) { char message[4096]; snprintf(message, sizeof(message), "$%s:%s|%s", ((conf_regex == ConfigureRegexes::OCR) ? "ocr" : "kbd" ), pattern, data); auto pattern_detection_type = (is_pattern_kill ? "KILL_PATTERN_DETECTED" : "NOTIFY_PATTERN_DETECTED"); auto info = key_qvalue_pairs({ {"type", pattern_detection_type}, {"pattern", message}, }); report_message.log5(info); report_message.report( (is_pattern_kill ? "FINDPATTERN_KILL" : "FINDPATTERN_NOTIFY"), message); }
void set_server_redirection_target(Inifile& ini, ReportMessageApi& reporter) { // SET new target in ini RedirectionInfo const& redir_info = ini.get<cfg::mod_rdp::redir_info>(); const char * host = char_ptr_cast(redir_info.host); const char * password = char_ptr_cast(redir_info.password); const char * username = char_ptr_cast(redir_info.username); const char * change_user = ""; if (redir_info.dont_store_username && username[0] != 0) { LOG(LOG_INFO, "SrvRedir: Change target username to '%s'", username); ini.set_acl<cfg::globals::target_user>(username); change_user = username; } if (password[0] != 0) { LOG(LOG_INFO, "SrvRedir: Change target password"); ini.set_acl<cfg::context::target_password>(password); } LOG(LOG_INFO, "SrvRedir: Change target host to '%s'", host); ini.set_acl<cfg::context::target_host>(host); char message[770]; sprintf(message, "%s@%s", change_user, host); reporter.report("SERVER_REDIRECTION", message); }