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

Skip to content

Commit 6bbb813

Browse files
committed
update (smaller memory footprint in postprocessing phase because of safecharencode part)
1 parent 5770c08 commit 6bbb813

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
14421442
kb.reflectiveCounters = {REFLECTIVE_COUNTER.MISS:0, REFLECTIVE_COUNTER.HIT:0}
14431443
kb.responseTimes = []
14441444
kb.resumedQueries = {}
1445+
kb.safeCharEncode = False
14451446
kb.singleLogFlags = set()
14461447
kb.skipOthersDbms = None
14471448
kb.suppressSession = False

lib/request/inject.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from lib.core.common import readInput
2929
from lib.core.common import replaceNewlineTabs
3030
from lib.core.common import safeStringFormat
31-
from lib.core.convert import safecharencode
3231
from lib.core.data import conf
3332
from lib.core.data import kb
3433
from lib.core.data import logger
@@ -401,6 +400,8 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse
401400
(if selected).
402401
"""
403402

403+
kb.safeCharEncode = safeCharEncode
404+
404405
if suppressOutput is not None:
405406
pushValue(getCurrentThreadData().disableStdOut)
406407
getCurrentThreadData().disableStdOut = suppressOutput
@@ -499,8 +500,7 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse
499500
elif value == [None]:
500501
value = None
501502

502-
if safeCharEncode:
503-
value = safecharencode(value)
503+
kb.safeCharEncode = False
504504

505505
return value
506506

lib/techniques/blind/inference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from lib.core.common import safeStringFormat
2828
from lib.core.common import singleTimeWarnMessage
2929
from lib.core.common import unhandledExceptionMessage
30+
from lib.core.convert import safecharencode
3031
from lib.core.data import conf
3132
from lib.core.data import kb
3233
from lib.core.data import logger
@@ -521,4 +522,4 @@ def blindThread():
521522
if kb.threadException:
522523
raise sqlmapThreadException, "something unexpected happened inside the threads"
523524

524-
return queriesCount[0], finalValue
525+
return queriesCount[0], safecharencode(finalValue) if kb.safeCharEncode else finalValue

lib/techniques/error/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __oneShotErrorUse(expression, field):
131131

132132
dataToSessionFile("[%s][%s][%s][%s][%s]\n" % (conf.url, kb.injection.place, conf.parameters[kb.injection.place], expression, replaceNewlineTabs(retVal)))
133133

134-
return retVal
134+
return safecharencode(retVal) if kb.safeCharEncode else retVal
135135

136136
def __errorFields(expression, expressionFields, expressionFieldsList, expected=None, num=None, resumeValue=True):
137137
outputs = []

lib/techniques/union/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __oneShotUnionUse(expression, unpack=True):
9797
warnMsg += "issues)"
9898
singleTimeWarnMessage(warnMsg)
9999

100-
return output
100+
return safecharencode(output) if kb.safeCharEncode else output
101101

102102
def configUnion(char=None, columns=None):
103103
def __configUnionChar(char):

0 commit comments

Comments
 (0)