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

Skip to content

Commit 1dfe558

Browse files
committed
Fix for Issue #177
1 parent 323cf2b commit 1dfe558

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

lib/controller/controller.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
from lib.controller.checks import checkConnection
3232
from lib.core.common import paramToDict
3333
from lib.core.common import parseTargetUrl
34+
from lib.core.common import pop
35+
from lib.core.common import push
3436
from lib.core.common import readInput
3537
from lib.core.data import conf
3638
from lib.core.data import kb
@@ -103,6 +105,10 @@ def start():
103105
if kb.targetUrls and len(kb.targetUrls) > 1:
104106
infoMsg = "sqlmap got a total of %d targets" % len(kb.targetUrls)
105107
logger.info(infoMsg)
108+
109+
if conf.multipleTargets:
110+
push(conf.raise404)
111+
conf.raise404 = False
106112

107113
hostCount = 0
108114
cookieStr = ""
@@ -267,7 +273,12 @@ def start():
267273
logger.error(e)
268274
else:
269275
logger.error(e)
276+
if conf.multipleTargets:
277+
conf.raise404 = pop()
270278
return
271279

280+
if conf.multipleTargets:
281+
conf.raise404 = pop()
282+
272283
if conf.loggedToOut:
273284
logger.info("Fetched data logged to text files under '%s'" % conf.outputPath)

lib/core/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,3 +939,9 @@ def posixToNtSlashes(filepath):
939939

940940
def ntToPosixSlashes(filepath):
941941
return filepath.replace('\\', '/')
942+
943+
def push(value):
944+
conf.stack.append(value)
945+
946+
def pop():
947+
return conf.stack.pop()

lib/core/option.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,12 +957,14 @@ def __setConfAttributes():
957957
conf.path = None
958958
conf.port = None
959959
conf.progressWidth = 54
960+
conf.raise404 = True
960961
conf.retriesCount = 0
961962
conf.scheme = None
962963
#conf.seqMatcher = difflib.SequenceMatcher(lambda x: x in " \t")
963964
conf.seqMatcher = difflib.SequenceMatcher(None)
964965
conf.seqLock = None
965966
conf.sessionFP = None
967+
conf.stack = []
966968
conf.start = True
967969
conf.threadContinue = True
968970
conf.threadException = False

lib/request/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def getPage(**kwargs):
7070
direct = kwargs.get('direct', False)
7171
multipart = kwargs.get('multipart', False)
7272
silent = kwargs.get('silent', False)
73-
raise404 = kwargs.get('raise404', True)
73+
raise404 = kwargs.get('raise404', None)
7474

7575
page = ""
7676
cookieStr = ""
@@ -181,7 +181,7 @@ def getPage(**kwargs):
181181
errMsg = "not authorized, try to provide right HTTP "
182182
errMsg += "authentication type and valid credentials"
183183
raise sqlmapConnectionException, errMsg
184-
elif e.code == 404 and raise404:
184+
elif e.code == 404 and (raise404 or (raise404 is None and conf.raise404)):
185185
errMsg = "page not found"
186186
raise sqlmapConnectionException, errMsg
187187
else:

0 commit comments

Comments
 (0)