<commit_before>/*
 * Copyright (c) 2013 <NAME>peration., Ltd.
 */
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ngx_md5.h>
#include <ngx_string.h>

#define NGX_HTTP_RECAPTCHA_DEFAULT_MAX_VERIFY_TIMES 10

#include <ngx_times.h>

#if (NGX_HTTP_IP_BLACKLIST)
#include <ngx_http_ip_blacklist.h>
#endif

#if (NGX_HTTP_STATUS_PAGE)
#include <ngx_http_status_page.h>
#endif

#define NGX_HTTP_RM_DEFAULT_URI NGX_HTTP_STATUS_PAGE_PATH"/403.html"

#define NGX_HTTP_RM_GET_SWF_URI "NetEye-ADSG-AC-GET-"
#define NGX_HTTP_RM_POST_SWF_URI "NetEye-ADSG-AC-POST-"  

#define NGX_HTTP_RM_DEFAULT_COOKIE_LEN 40
#define NGX_HTTP_RM_DEFAULT_COOKIE_NAME_LEN 40

#define NGX_HTTP_RM_COOKIE_NAME "SENGINX-ROBOT-MITIGATION"
#define NGX_HTTP_RM_COOKIE_NAME_C "SENGINX-ROBOT-MITIGATION        "
#define NGX_HTTP_RM_MAX_COOKIE_NAME_LEN 32

#define NGX_HTTP_RM_RET_INVALID_COOKIE 1
#define NGX_HTTP_RM_RET_NO_COOKIE 2

#define NGX_HTTP_RM_MODE_JS 1
#define NGX_HTTP_RM_MODE_SWF 2

#define NGX_HTTP_RM_DEFAULT_TIMEOUT 600
#define NGX_HTTP_RM_DEFAULT_TIMEOUT_C "600 "
#define NGX_HTTP_RM_MAX_TIMEOUT 3600
#define NGX_HTTP_RM_MAX_TIMEOUT_STR_LEN 4

#define NGX_HTTP_RM_SWF_FILENAME_PREFIX "neteye-adsg-swf-"

#define NGX_HTTP_RM_SWF_PLACEHOLDER_COOKIE_NAME "Roboo_name_0"
#define NGX_HTTP_RM_SWF_PLACEHOLDER_COOKIE_VALUE "Roboo_value_0"
#define NGX_HTTP_RM_SWF_PLACEHOLDER_TIMEOUT "Roboo_validity_0"


#define NGX_HTTP_RM_POST_TYPE "application/x-www-form-urlencoded"
#define NGX_HTTP_RM_FORM_VARIABLES \
    "<input type=\"hidden\" name=\"%s\" value=\"%s\">\n"

#define NGX_HTTP_RM_FORM_VARIABLES_1 "<input type=\"hidden\" name=\""
#define NGX_HTTP_RM_FORM_VARIABLES_2 "\" value=\""
#define NGX_HTTP_RM_FORM_VARIABLES_3 "\">\n"

#define NGX_HTTP_RM_AJAX_KEY "X-Requested-With"
#define NGX_HTTP_RM_AJAX_KEY_LEN 16
#define NGX_HTTP_RM_AJAX_VALUE "XMLHttpRequest"
#define NGX_HTTP_RM_AJAX_VALUE_LEN 14

#define NGX_HTTP_RM_ADDR_LEN 64
#define NGX_HTTP_RM_ADDR_TIMEOUT (30*1000)  //30s

typedef struct {
    ngx_http_regex_t  *regex;<commit_msg>change: modify the timeout of dns cache in robot mitigation to 5s<commit_after>/*
 * Copyright (c) 2013 Neusoft Corperation., Ltd.
 */
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ngx_md5.h>
#include <ngx_string.h>

#define NGX_HTTP_RECAPTCHA_DEFAULT_MAX_VERIFY_TIMES 10

#include <ngx_times.h>

#if (NGX_HTTP_IP_BLACKLIST)
#include <ngx_http_ip_blacklist.h>
#endif

#if (NGX_HTTP_STATUS_PAGE)
#include <ngx_http_status_page.h>
#endif

#define NGX_HTTP_RM_DEFAULT_URI NGX_HTTP_STATUS_PAGE_PATH"/403.html"

#define NGX_HTTP_RM_GET_SWF_URI "NetEye-ADSG-AC-GET-"
#define NGX_HTTP_RM_POST_SWF_URI "NetEye-ADSG-AC-POST-"  

#define NGX_HTTP_RM_DEFAULT_COOKIE_LEN 40
#define NGX_HTTP_RM_DEFAULT_COOKIE_NAME_LEN 40

#define NGX_HTTP_RM_COOKIE_NAME "SENGINX-ROBOT-MITIGATION"
#define NGX_HTTP_RM_COOKIE_NAME_C "SENGINX-ROBOT-MITIGATION        "
#define NGX_HTTP_RM_MAX_COOKIE_NAME_LEN 32

#define NGX_HTTP_RM_RET_INVALID_COOKIE 1
#define NGX_HTTP_RM_RET_NO_COOKIE 2

#define NGX_HTTP_RM_MODE_JS 1
#define NGX_HTTP_RM_MODE_SWF 2

#define NGX_HTTP_RM_DEFAULT_TIMEOUT 600
#define NGX_HTTP_RM_DEFAULT_TIMEOUT_C "600 "
#define NGX_HTTP_RM_MAX_TIMEOUT 3600
#define NGX_HTTP_RM_MAX_TIMEOUT_STR_LEN 4

#define NGX_HTTP_RM_SWF_FILENAME_PREFIX "neteye-adsg-swf-"

#define NGX_HTTP_RM_SWF_PLACEHOLDER_COOKIE_NAME "Roboo_name_0"
#define NGX_HTTP_RM_SWF_PLACEHOLDER_COOKIE_VALUE "Roboo_value_0"
#define NGX_HTTP_RM_SWF_PLACEHOLDER_TIMEOUT "Roboo_validity_0"


#define NGX_HTTP_RM_POST_TYPE "application/x-www-form-urlencoded"
#define NGX_HTTP_RM_FORM_VARIABLES \
    "<input type=\"hidden\" name=\"%s\" value=\"%s\">\n"

#define NGX_HTTP_RM_FORM_VARIABLES_1 "<input type=\"hidden\" name=\""
#define NGX_HTTP_RM_FORM_VARIABLES_2 "\" value=\""
#define NGX_HTTP_RM_FORM_VARIABLES_3 "\">\n"

#define NGX_HTTP_RM_AJAX_KEY "X-Requested-With"
#define NGX_HTTP_RM_AJAX_KEY_LEN 16
#define NGX_HTTP_RM_AJAX_VALUE "XMLHttpRequest"
#define NGX_HTTP_RM_AJAX_VALUE_LEN 14

#define NGX_HTTP_RM_ADDR_LEN 64
#define NGX_HTTP_RM_ADDR_TIMEOUT (5*1000)  //5s

typedef struct {
    ngx_http_regex_t  *regex;
{'fraction_non_alphanumeric': 0.09509274477576896, 'fraction_numerical': 0.023714486968772014, 'mean_word_length': 7.606060606060606, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2495688', 'n_tokens_mistral': 2074, 'n_tokens_neox': 1910, 'n_words': 291}