function is_token_changed(raw_tokens, userinput_idx, userinput_length, distance, is_sql)
{
    if (is_sql === undefined) {
        is_sql = false
    }
    // When the user input traverses multiple tokens, it can be judged as code injection, the default is 2
    var start = -1, end = raw_tokens.length, distance = distance || 2

    // Find the starting point of token, you can change to binary search
    for (var i = 0; i < raw_tokens.length; i++)
    {
        if (raw_tokens[i].stop > userinput_idx)
        {
            start = i
            break
        }
    }
    // Comments may end up preventing cross-bordering caused by removing comments
    if (start == -1) {
        return false
    }

    // Find the end point of the token
    // Need to return the real distance, delete at most distance token i <start + distance condition
    for (var i = start; i < raw_tokens.length; i++)
    {
        if (raw_tokens[i].stop >= userinput_idx + userinput_length)
        {
            end = i
            break
        }
    }

    var diff = end - start + 1
    if (diff >= distance) {
        if (is_sql && algorithmConfig.sql_userinput.anti_detect_enable && diff < 10) {
            var non_kw = 0
            for (var i = start; i <= end; i++) {
                sqliAntiDetect.test(raw_tokens[i].text) || non_kw ++
                if (non_kw >= 2) {
                    return true
                }
            }
            return false
        }
        return true
    }
    return false
}
// Check whether the logic is modified by user parameters
Check whether the logic is modified by user parameters
Check whether the logic is modified by user parameters
function is_token_changed(raw_tokens, userinput_idx, userinput_length, distance, is_sql)
{
    if (is_sql === undefined) {
        is_sql = false
    }
    var start = -1, end = raw_tokens.length, distance = distance || 2
    for (var i = 0; i < raw_tokens.length; i++)
    {
        if (raw_tokens[i].stop > userinput_idx)
        {
            start = i
            break
        }
    }
    if (start == -1) {
        return false
    }
    for (var i = start; i < raw_tokens.length; i++)
    {
        if (raw_tokens[i].stop >= userinput_idx + userinput_length)
        {
            end = i
            break
        }
    }
    var diff = end - start + 1
    if (diff >= distance) {
        if (is_sql && algorithmConfig.sql_userinput.anti_detect_enable && diff < 10) {
            var non_kw = 0
            for (var i = start; i <= end; i++) {
                sqliAntiDetect.test(raw_tokens[i].text) || non_kw ++
                if (non_kw >= 2) {
                    return true
                }
            }
            return false
        }
        return true
    }
    return false
}
function is_token_changed ( raw_tokens , userinput_idx , userinput_length , distance , is_sql ) { if ( is_sql === undefined ) { is_sql = false } var start = - 1 , end = raw_tokens . length , distance = distance || 2 for ( var i = 0 ; i < raw_tokens . length ; i ++ ) { if ( raw_tokens [ i ] . stop > userinput_idx ) { start = i break } } if ( start == - 1 ) { return false } for ( var i = start ; i < raw_tokens . length ; i ++ ) { if ( raw_tokens [ i ] . stop >= userinput_idx + userinput_length ) { end = i break } } var diff = end - start + 1 if ( diff >= distance ) { if ( is_sql && algorithmConfig . sql_userinput . anti_detect_enable && diff < 10 ) { var non_kw = 0 for ( var i = start ; i <= end ; i ++ ) { sqliAntiDetect . test ( raw_tokens [ i ] . text ) || non_kw ++ if ( non_kw >= 2 ) { return true } } return false } return true } return false }
Check whether the logic is modified by user parameters
Check whether the logic is modified by user parameters
// When the user input traverses multiple tokens, it can be judged as code injection, the default is 2 // Find the starting point of token, you can change to binary search // Comments may end up preventing cross-bordering caused by removing comments // Find the end point of the token // Need to return the real distance, delete at most distance token i <start + distance condition