File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from lib .controller .checks import checkConnection
3232from lib .core .common import paramToDict
3333from lib .core .common import parseTargetUrl
34+ from lib .core .common import pop
35+ from lib .core .common import push
3436from lib .core .common import readInput
3537from lib .core .data import conf
3638from 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 )
Original file line number Diff line number Diff line change @@ -939,3 +939,9 @@ def posixToNtSlashes(filepath):
939939
940940def 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 ()
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments