diff --git a/lib/core/enums.py b/lib/core/enums.py index 86c6aa31c..91290b19f 100644 --- a/lib/core/enums.py +++ b/lib/core/enums.py @@ -139,6 +139,7 @@ class HASHDB_KEYS: KB_CHARS = "KB_CHARS" KB_BRUTE_TABLES = "KB_BRUTE_TABLES" KB_BRUTE_COLUMNS = "KB_BRUTE_COLUMNS" + CONF_TMP_PATH = "CONF_TMP_PATH" class REDIRECTION: FOLLOW = "1" diff --git a/lib/core/session.py b/lib/core/session.py index 08fa79742..da4bbf323 100644 --- a/lib/core/session.py +++ b/lib/core/session.py @@ -150,15 +150,6 @@ def setOs(): if condition: dataToSessionFile("[%s][%s][%s][OS][%s]\n" % (conf.url, kb.injection.place, safeFormatString(conf.parameters[kb.injection.place]), Backend.getOs())) -def setRemoteTempPath(): - condition = ( - not kb.resumedQueries or ( kb.resumedQueries.has_key(conf.url) and - not kb.resumedQueries[conf.url].has_key("Remote temp path") ) - ) - - if condition: - dataToSessionFile("[%s][%s][%s][Remote temp path][%s]\n" % (conf.url, kb.injection.place, safeFormatString(conf.parameters[kb.injection.place]), safeFormatString(conf.tmpPath))) - def setXpCmdshellAvailability(available): condition = ( not kb.resumedQueries or ( kb.resumedQueries.has_key(conf.url) and diff --git a/lib/core/target.py b/lib/core/target.py index 63bad5a3a..bdc9ea28b 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -14,6 +14,7 @@ import tempfile import time from lib.core.common import dataToSessionFile +from lib.core.common import hashDBRetrieve from lib.core.common import intersect from lib.core.common import paramToDict from lib.core.common import readInput @@ -208,10 +209,12 @@ def __resumeHashDBValues(): Resume stored data values from HashDB """ - kb.absFilePaths = conf.hashDB.retrieve(HASHDB_KEYS.KB_ABS_FILE_PATHS, True) or kb.absFilePaths - kb.chars = conf.hashDB.retrieve(HASHDB_KEYS.KB_CHARS, True) or kb.chars - kb.brute.tables = conf.hashDB.retrieve(HASHDB_KEYS.KB_BRUTE_TABLES, True) or kb.brute.tables - kb.brute.columns = conf.hashDB.retrieve(HASHDB_KEYS.KB_BRUTE_COLUMNS, True) or kb.brute.columns + kb.absFilePaths = hashDBRetrieve(HASHDB_KEYS.KB_ABS_FILE_PATHS, True) or kb.absFilePaths + kb.chars = hashDBRetrieve(HASHDB_KEYS.KB_CHARS, True) or kb.chars + kb.brute.tables = hashDBRetrieve(HASHDB_KEYS.KB_BRUTE_TABLES, True) or kb.brute.tables + kb.brute.columns = hashDBRetrieve(HASHDB_KEYS.KB_BRUTE_COLUMNS, True) or kb.brute.columns + + conf.tmpPath = conf.tmpPath or hashDBRetrieve(HASHDB_KEYS.CONF_TMP_PATH) def __setOutputResume(): """ diff --git a/plugins/generic/misc.py b/plugins/generic/misc.py index ff7388ee7..0b766b507 100644 --- a/plugins/generic/misc.py +++ b/plugins/generic/misc.py @@ -9,6 +9,7 @@ See the file 'doc/COPYING' for copying permission from lib.core.common import getCompiledRegex from lib.core.common import Backend +from lib.core.common import hashDBWrite from lib.core.common import isTechniqueAvailable from lib.core.common import normalizePath from lib.core.common import ntToPosixSlashes @@ -19,11 +20,11 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.data import queries from lib.core.enums import DBMS +from lib.core.enums import HASHDB_KEYS from lib.core.enums import OS from lib.core.enums import PAYLOAD from lib.core.exception import sqlmapNoneDataException from lib.core.exception import sqlmapUnsupportedFeatureException -from lib.core.session import setRemoteTempPath from lib.request import inject class Miscellaneous: @@ -57,7 +58,7 @@ class Miscellaneous: conf.tmpPath = normalizePath(conf.tmpPath) conf.tmpPath = ntToPosixSlashes(conf.tmpPath) - setRemoteTempPath() + hashDBWrite(HASHDB_KEYS.CONF_TMP_PATH, conf.tmpPath) def getVersionFromBanner(self): if "dbmsVersion" in kb.bannerFp: