'Uses the batch injection technique to find memcache injections'

def batch_injection_test(self, freq, orig_response):

    send_clean = self._uri_opener.send_clean
    orig_body = orig_response.get_body()
    for mutant in create_mutants(freq, ['']):
        mutant.set_token_value(self.ERROR_1)
        (error_1_response, body_error_1_response) = send_clean(mutant)
        if fuzzy_equal(orig_body, body_error_1_response, self._eq_limit):
            continue
        mutant.set_token_value(self.OK)
        (ok_response, body_ok_response) = send_clean(mutant)
        if fuzzy_equal(body_error_1_response, body_ok_response, self._eq_limit):
            continue
        mutant.set_token_value(self.ERROR_2)
        (error_2_response, body_error_2_response) = send_clean(mutant)
        if fuzzy_equal(orig_body, body_error_2_response, self._eq_limit):
            continue
        if (not fuzzy_equal(body_error_1_response, body_error_2_response, self._eq_limit)):
            continue
        response_ids = [error_1_response.id, ok_response.id, error_2_response.id]
        desc = 'Memcache    injection    was    found    at:    "%s",    using    HTTP    method    %s.    The    injectable    parameter    is:    "%s"'
        desc %= (mutant.get_url(), mutant.get_method(), mutant.get_token_name())
        v = Vuln.from_mutant('Memcache    injection    vulnerability', desc, severity.HIGH, response_ids, 'memcachei', mutant)
        self.kb_append_uniq(self, 'memcachei', v)
