Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not sure what you were trying to match that wasn't working but here are a few suggestions for your queries.</p> <p>Your first expression,</p> <pre><code>string regexForTypicalInj = @"/\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix"; </code></pre> <p>seems to be intended to catch a single quote followed by "or". I would make sure to handle the case when there is space after the single quote and before the "or". Also, you shouldn't need to escape the % or ' characters. With those changes it becomes,</p> <pre><code>string regexForTypicalInj = @"/\w*((%27)|')\s*(o|(%6F)|(%4F))(r|(%72)|(%52))/ix"; </code></pre> <p>The rest of the expressions, I would add the space allowance and also include the url-encoded characters as well. Doing that they become,</p> <pre><code>string regexForUnion = @"/((%27)|')\s*(u|%75|%55)(n|%6E|%4E)(i|%69|%49)(o|%6F|%4F)(n|%6E|%4E)/ix"; string regexForSelect = @"/((%27)|')\s*(s|%73|%53)(e|%65|%45)(l|%6C|%4C)(e|%65|%45)(c|%63|%43)(t|%74|%54)/ix"; string regexForInsert = @"/((%27)|')\s*(i|%69|%49)(n|%6E|%4E)(s|%73|%53)(e|%65|%45)(r|%72|%52)(t|%74|%54)/ix"; string regexForUpdate = @"/((%27)|')\s*(u|%75|%55)(p|%70|%50)(d|%64|%44)(a|%61|%41)(t|%74|%54)(e|%65|%45)/ix"; string regexForDelete = @"/((%27)|')\s*(d|%64|%44)(e|%65|%45)(l|%6C|%4C)(e|%65|%45)(t|%74|%54)(e|%65|%45)/ix"; string regexForDrop = @"/((%27)|')\s*(d|%64|%44)(r|%72|%52)(o|%6F|%4F)(p|%70|%50)/ix"; string regexForAlter = @"/((%27)|')\s*(a|%61|%41)(l|%6C|%4C)(t|%74|%54)(e|%65|%45)(r|%72|%52)/ix"; string regexForCreate = @"/((%27)|')\s*(c|%63|%43)(r|%72|%52)(e|%65|%45)(a|%61|%41)(t|%74|%54)(e|%65|%45)/ix"; </code></pre> <p>One other suggestion for the code in general: For each <code>if</code> statement I would suggest replacing <code>isInj = true;</code> with <code>return true;</code> so that you don't waste time doing unnecessary comparisons. In reality it probably won't make any performance difference but it could if you were calling that function really often.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload