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

Skip to content

Commit 0a4f5d2

Browse files
committed
Merge branch 'master' of github.com:sqlmapproject/sqlmap
2 parents e9641e3 + f89b25f commit 0a4f5d2

3 files changed

Lines changed: 40 additions & 17 deletions

File tree

lib/core/common.py

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -622,17 +622,40 @@ def getDocRoot():
622622
warnMsg = "unable to retrieve the web server document root"
623623
logger.warn(warnMsg)
624624

625-
message = "please provide the web server document root "
626-
message += "[%s]: " % ",".join(root for root in defaultDocRoot)
627-
inputDocRoot = readInput(message, default=defaultDocRoot)
625+
docRoot = []
628626

629-
if inputDocRoot:
630-
if isinstance(inputDocRoot, basestring):
631-
docRoot = inputDocRoot.split(',')
627+
message = "do you want to provide a text file with a list of "
628+
message += "directories to try? [y/N] "
629+
answer = readInput(message, default="N")
630+
631+
if answer and answer.lower() == "y":
632+
message = "please provide the directories list file to try: "
633+
dirFilePath = readInput(message)
634+
635+
if dirFilePath:
636+
if os.path.isfile(dirFilePath):
637+
fd = codecs.open(dirFilePath, "rb", UNICODE_ENCODING)
638+
639+
for filepath in fd.readlines():
640+
docRoot.append(normalizePath(filepath))
641+
642+
else:
643+
errMsg = "provided directory list file %s " % dirFilePath
644+
errMsg += "is not a valid file"
645+
logger.error(errMsg)
646+
647+
if len(docRoot) == 0:
648+
message = "please provide the web server document root "
649+
message += "[%s]: " % ", ".join(root for root in defaultDocRoot)
650+
inputDocRoot = readInput(message, default=defaultDocRoot)
651+
652+
if inputDocRoot:
653+
if isinstance(inputDocRoot, basestring):
654+
docRoot = inputDocRoot.split(',')
655+
else:
656+
docRoot = inputDocRoot
632657
else:
633-
docRoot = inputDocRoot
634-
else:
635-
docRoot = defaultDocRoot
658+
docRoot = defaultDocRoot
636659

637660
return docRoot
638661

@@ -657,8 +680,9 @@ def getDirs():
657680
if webDir:
658681
directories.add(webDir)
659682

660-
message = "please provide any additional web server full path to try "
661-
message += "to upload the agent [Enter for None]: "
683+
message = "please provide additional comma separated file paths to "
684+
message += "try to upload the agent inside the possible document "
685+
message += "root%s [Enter for None]: " % "s" if len(kb.docRoot) > 1 else ""
662686
inputDirs = readInput(message)
663687

664688
if inputDirs:
@@ -1325,8 +1349,9 @@ def normalizePath(filepath):
13251349

13261350
retVal = filepath
13271351

1328-
if filepath:
1329-
retVal = ntpath.normpath(filepath) if isWindowsDriveLetterPath(filepath) else posixpath.normpath(filepath)
1352+
if retVal:
1353+
retVal = retVal.strip("\r").strip("\n")
1354+
retVal = ntpath.normpath(retVal) if isWindowsDriveLetterPath(retVal) else posixpath.normpath(retVal)
13301355

13311356
return retVal
13321357

lib/takeover/web.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def webInit(self):
191191
self.webApi = choices[int(choice) - 1]
192192
break
193193

194-
kb.docRoot = getDocRoot()
194+
kb.docRoot = arrayizeValue(getDocRoot())
195195
directories = sorted(getDirs())
196196

197197
backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webApi)
@@ -202,7 +202,7 @@ def webInit(self):
202202

203203
success = False
204204

205-
for docRoot in arrayizeValue(kb.docRoot):
205+
for docRoot in kb.docRoot:
206206
if success:
207207
break
208208

plugins/dbms/mysql/filesystem.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ def unionWriteFile(self, wFile, dFile, fileType):
100100
sqlQuery = "%s INTO DUMPFILE '%s'" % (fcEncodedStr, dFile)
101101
unionUse(sqlQuery, unpack=False)
102102

103-
self.askCheckWrittenFile(wFile, dFile)
104-
105103
warnMsg = "expect junk characters inside the "
106104
warnMsg += "file as a leftover from UNION query"
107105
singleTimeWarnMessage(warnMsg)

0 commit comments

Comments
 (0)