Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca427af

Browse files
committed
Minor refactoring/improvement
1 parent 43ddf39 commit ca427af

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

lib/controller/checks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from lib.core.exception import sqlmapUserQuitException
5656
from lib.core.settings import CONSTANT_RATIO
5757
from lib.core.settings import FORMAT_EXCEPTION_STRINGS
58+
from lib.core.settings import HEURISTIC_CHECK_ALPHABET
5859
from lib.core.settings import SUHOSHIN_MAX_VALUE_LENGTH
5960
from lib.core.settings import UNKNOWN_DBMS_VERSION
6061
from lib.core.settings import LOWER_RATIO_BOUND
@@ -670,7 +671,11 @@ def heuristicCheckSqlInjection(place, parameter):
670671
if conf.suffix:
671672
suffix = conf.suffix
672673

673-
payload = "%s%s%s" % (prefix, randomStr(length=10, alphabet=['"', '\'', ')', '(']), suffix)
674+
randStr = ""
675+
while '\'' not in randStr:
676+
randStr = randomStr(length=10, alphabet=HEURISTIC_CHECK_ALPHABET)
677+
678+
payload = "%s%s%s" % (prefix, randStr, suffix)
674679
payload = agent.payload(place, parameter, newValue=payload)
675680
page, _ = Request.queryPage(payload, place, content=True, raise404=False)
676681

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@
435435
# Alphabet used for prefix and suffix strings of name resolution requests in DNS technique (excluding hexadecimal chars for not mixing with inner content)
436436
DNS_BOUNDARIES_ALPHABET = re.sub("[a-fA-F]", "", string.letters)
437437

438+
# Alphabet used for heuristic checks
439+
HEURISTIC_CHECK_ALPHABET = ('"', '\'', ')', '(', '[', ']', ',', '.')
440+
438441
# Connection chunk size (processing large responses in chunks to avoid MemoryError crashes - e.g. large table dump in full UNION injections)
439442
MAX_CONNECTION_CHUNK_SIZE = 10 * 1024 * 1024
440443

0 commit comments

Comments
 (0)