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IHGFED)|(IHGFEDC)|(IHGFEDCB)|(IHGFEDCBA))?((H)|(HG)|(HGF)|(HGFE)|(HGFED)|(HGFEDC)|(HGFEDCB)|(HGFEDCBA))?((G)|(GF)|(GFE)|(GFED)|(GFEDC)|(GFEDCB)|(GFEDCBA))?((F)|(FE)|(FED)|(FEDC)|(FEDCB)|(FEDCBA))?((E)|(ED)|(EDC)|(EDCB)|(EDCBA))?((D)|(DC)|(DCB)|(DCBA))?((C)|(CB)|(CBA))?((B)|(BA))?((A))?)+$"; set "a" "ABCDEFGHIJKLMNOPQR"; set "b" "RQPONMLKJIHGFEDCBA"; set "c" "${a}${b}${a}${b}${a}${b}${a}${b}"; set "e" "${c}${c}${c}${c}${c}${c}${c}${c}"; set "f" "${e}${e}${e}${e}${e}${e}${e}${e}"; # We create a string on which this regex will spend enough time (around 200 ms) set "final" "${f}${f}${f}${f}${f}${f}${f}${f}${f}${f}${f}${f}${f}${f}@"; # We repeat the throttling process for every mime part foreverypart { # We use several if statements to multiply the cpu time consumed by one match if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } if string :regex "${final}" "${my_exp}" { discard; } if string :regex "${final}" "${my_exp}" { keep; } }