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

Skip to content

Commit 10f8c6a

Browse files
committed
Introducing --offline switch (to perform session only lookups)
1 parent 9bdbdc1 commit 10f8c6a

6 files changed

Lines changed: 17 additions & 6 deletions

File tree

lib/controller/checks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def genCmpPayload():
552552

553553
kb.previousMethod = method
554554

555-
if conf.dummy:
555+
if conf.dummy or conf.offline:
556556
injectable = False
557557

558558
# If the injection test was successful feed the injection
@@ -1142,7 +1142,7 @@ def checkWaf():
11421142
Reference: http://seclists.org/nmap-dev/2011/q2/att-1005/http-waf-detect.nse
11431143
"""
11441144

1145-
if any((conf.string, conf.notString, conf.regexp)):
1145+
if any((conf.string, conf.notString, conf.regexp, conf.dummy, conf.offline)):
11461146
return None
11471147

11481148
dbmMsg = "heuristically checking if the target is protected by "
@@ -1290,7 +1290,7 @@ def checkNullConnection():
12901290
return kb.nullConnection is not None
12911291

12921292
def checkConnection(suppressOutput=False):
1293-
if not any((conf.proxy, conf.tor, conf.dummy)):
1293+
if not any((conf.proxy, conf.tor, conf.dummy, conf.offline)):
12941294
try:
12951295
debugMsg = "resolving hostname '%s'" % conf.hostname
12961296
logger.debug(debugMsg)
@@ -1303,7 +1303,7 @@ def checkConnection(suppressOutput=False):
13031303
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getUnicode(ex))
13041304
raise SqlmapConnectionException(errMsg)
13051305

1306-
if not suppressOutput and not conf.dummy:
1306+
if not suppressOutput and not conf.dummy and not conf.offline:
13071307
infoMsg = "testing connection to the target URL"
13081308
logger.info(infoMsg)
13091309

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@
217217
"disableColoring": "boolean",
218218
"googlePage": "integer",
219219
"mobile": "boolean",
220+
"offline": "boolean",
220221
"pageRank": "boolean",
221222
"purgeOutput": "boolean",
222223
"smart": "boolean",

lib/parse/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,10 @@ def cmdLineParser():
715715
action="store_true",
716716
help="Imitate smartphone through HTTP User-Agent header")
717717

718+
miscellaneous.add_option("--offline", dest="offline",
719+
action="store_true",
720+
help="Work in offline mode (only use session data)")
721+
718722
miscellaneous.add_option("--page-rank", dest="pageRank",
719723
action="store_true",
720724
help="Display page rank (PR) for Google dork results")

lib/request/connect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ def getPage(**kwargs):
212212
elif conf.cpuThrottle:
213213
cpuThrottle(conf.cpuThrottle)
214214

215-
if conf.dummy:
215+
if conf.offline:
216+
return None, None, None
217+
elif conf.dummy:
216218
return getUnicode(randomStr(int(randomInt()), alphabet=[chr(_) for _ in xrange(256)]), {}, int(randomInt())), None, None
217219

218220
threadData = getCurrentThreadData()

lib/request/inject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
450450

451451
kb.safeCharEncode = False
452452

453-
if not kb.testMode and value is None and Backend.getDbms() and conf.dbmsHandler and not conf.noCast and not conf.hexConvert:
453+
if not any((kb.testMode, conf.dummy, conf.offline)) and value is None and Backend.getDbms() and conf.dbmsHandler and not conf.noCast and not conf.hexConvert:
454454
warnMsg = "in case of continuous data retrieval problems you are advised to try "
455455
warnMsg += "a switch '--no-cast' "
456456
warnMsg += "or switch '--hex'" if Backend.getIdentifiedDbms() not in (DBMS.ACCESS, DBMS.FIREBIRD) else ""

sqlmap.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,10 @@ identifyWaf = False
754754
# Valid: True or False
755755
mobile = False
756756

757+
# Work in offline mode (only use session data)
758+
# Valid: True or False
759+
offline = False
760+
757761
# Display page rank (PR) for Google dork results.
758762
# Valid: True or False
759763
pageRank = False

0 commit comments

Comments
 (0)