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

Skip to content

Commit 613242e

Browse files
committed
bug fix (dynamic markings were not restored in program rerun which potentially led to no data retrieved)
1 parent 8f32c74 commit 613242e

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

lib/controller/checks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from lib.core.exception import sqlmapNoneDataException
4545
from lib.core.exception import sqlmapSiteTooDynamic
4646
from lib.core.exception import sqlmapUserQuitException
47+
from lib.core.session import setDynamicMarkings
4748
from lib.core.session import setString
4849
from lib.core.session import setRegexp
4950
from lib.core.settings import UPPER_RATIO_BOUND
@@ -531,6 +532,8 @@ def checkDynamicContent(firstPage, secondPage):
531532
secondPage, _ = Request.queryPage(content=True)
532533
findDynamicContent(firstPage, secondPage)
533534

535+
setDynamicMarkings(kb.dynamicMarkings)
536+
534537
def checkStability():
535538
"""
536539
This function checks if the URL content is stable requesting the

lib/core/session.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,22 @@ def setInjection(inj):
8282
if condition:
8383
dataToSessionFile("[%s][%s][%s][Injection data][%s]\n" % (conf.url, inj.place, safeFormatString(conf.parameters[inj.place]), base64pickle(inj)))
8484

85+
def setDynamicMarkings(markings):
86+
"""
87+
Save information retrieved about dynamic markings to the
88+
session file.
89+
"""
90+
91+
condition = (
92+
( not kb.resumedQueries
93+
or ( kb.resumedQueries.has_key(conf.url) and
94+
not kb.resumedQueries[conf.url].has_key("Dynamic markings")
95+
) )
96+
)
97+
98+
if condition:
99+
dataToSessionFile("[%s][%s][%s][Dynamic markings][%s]\n" % (conf.url, None, None, base64pickle(markings)))
100+
85101
def setDbms(dbms):
86102
"""
87103
@param dbms: database management system to be set into the knowledge
@@ -303,6 +319,11 @@ def resumeConfKb(expression, url, value):
303319
warnMsg += "but you did not provided it this time"
304320
logger.warn(warnMsg)
305321

322+
elif expression == "Dynamic markings" and url == conf.url:
323+
kb.dynamicMarkings = base64unpickle(value[:-1])
324+
logMsg = "resuming dynamic markings from session file"
325+
logger.info(logMsg)
326+
306327
elif expression == "DBMS" and url == conf.url:
307328
dbms = unSafeFormatString(value[:-1])
308329
dbms = dbms.lower()

0 commit comments

Comments
 (0)