First commit for Issue #83

This commit is contained in:
Miroslav Stampar 2012-07-13 10:35:22 +02:00
parent d834e8debf
commit 48f68bd076
2 changed files with 8 additions and 15 deletions

View File

@ -677,7 +677,7 @@ def getDirs():
if inputDir: if inputDir:
directories.add(inputDir) directories.add(inputDir)
return directories return list(directories)
def filePathToString(filePath): def filePathToString(filePath):
strRepl = filePath.replace("/", "_").replace("\\", "_") strRepl = filePath.replace("/", "_").replace("\\", "_")

View File

@ -25,6 +25,7 @@ from lib.core.common import posixToNtSlashes
from lib.core.common import randomInt from lib.core.common import randomInt
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.common import readInput from lib.core.common import readInput
from lib.core.common import singleTimeWarnMessage
from lib.core.convert import hexencode from lib.core.convert import hexencode
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
@ -176,9 +177,7 @@ class Web:
break break
kb.docRoot = getDocRoot() kb.docRoot = getDocRoot()
directories = getDirs() directories = getDirs().sort()
directories = list(directories)
directories.sort()
backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webApi) backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webApi)
backdoorStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoor.%s_" % self.webApi), backdoorName) backdoorStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoor.%s_" % self.webApi), backdoorName)
@ -187,16 +186,13 @@ class Web:
stagerName = "tmpu%s.%s" % (randomStr(lowercase=True), self.webApi) stagerName = "tmpu%s.%s" % (randomStr(lowercase=True), self.webApi)
stagerContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stager.%s_" % self.webApi)) stagerContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stager.%s_" % self.webApi))
warned = set()
success = False success = False
for i in xrange(len(kb.docRoot)): for docRoot in kb.docRoot:
if success: if success:
break break
for j in xrange(len(directories)): for directory in directories:
docRoot = kb.docRoot[i]
directory = directories[j]
uriPath = "" uriPath = ""
if not all(isinstance(item, basestring) for item in (docRoot, directory)): if not all(isinstance(item, basestring) for item in (docRoot, directory)):
@ -244,12 +240,9 @@ class Web:
uplPage = uplPage or "" uplPage = uplPage or ""
if "sqlmap file uploader" not in uplPage: if "sqlmap file uploader" not in uplPage:
if localPath not in warned: warnMsg = "unable to upload the file stager "
warnMsg = "unable to upload the file stager " warnMsg += "on '%s'" % localPath
warnMsg += "on '%s'" % localPath singleTimeWarnMessage(warnMsg)
logger.warn(warnMsg)
warned.add(localPath)
continue continue
elif "<%" in uplPage or "<?" in uplPage: elif "<%" in uplPage or "<?" in uplPage: