MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / getManualDirectories

Function getManualDirectories

lib/core/common.py:789–894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

787 return testableParameters
788
789def getManualDirectories():
790 directories = None
791 defaultDocRoot = DEFAULT_DOC_ROOTS.get(Backend.getOs(), DEFAULT_DOC_ROOTS[OS.LINUX])
792
793 if kb.absFilePaths:
794 for absFilePath in kb.absFilePaths:
795 if directories:
796 break
797
798 if directoryPath(absFilePath) == '/':
799 continue
800
801 absFilePath = normalizePath(absFilePath)
802 windowsDriveLetter = None
803
804 if isWindowsDriveLetterPath(absFilePath):
805 windowsDriveLetter, absFilePath = absFilePath[:2], absFilePath[2:]
806 absFilePath = ntToPosixSlashes(posixToNtSlashes(absFilePath))
807
808 for _ in list(GENERIC_DOC_ROOT_DIRECTORY_NAMES) + [conf.hostname]:
809 _ = "/%s/" % _
810
811 if _ in absFilePath:
812 directories = "%s%s" % (absFilePath.split(_)[0], _)
813 break
814
815 if not directories and conf.path.strip('/') and conf.path in absFilePath:
816 directories = absFilePath.split(conf.path)[0]
817
818 if directories and windowsDriveLetter:
819 directories = "%s/%s" % (windowsDriveLetter, ntToPosixSlashes(directories))
820
821 directories = normalizePath(directories)
822
823 if conf.webRoot:
824 directories = [conf.webRoot]
825 infoMsg = "using '%s' as web server document root" % conf.webRoot
826 logger.info(infoMsg)
827 elif directories:
828 infoMsg = "retrieved the web server document root: '%s'" % directories
829 logger.info(infoMsg)
830 else:
831 warnMsg = "unable to automatically retrieve the web server "
832 warnMsg += "document root"
833 logger.warning(warnMsg)
834
835 directories = []
836
837 message = "what do you want to use for writable directory?\n"
838 message += "[1] common location(s) ('%s') (default)\n" % ", ".join(root for root in defaultDocRoot)
839 message += "[2] custom location(s)\n"
840 message += "[3] custom directory list file\n"
841 message += "[4] brute force search"
842 choice = readInput(message, default='1')
843
844 if choice == '2':
845 message = "please provide a comma separate list of absolute directory paths: "
846 directories = readInput(message, default="").split(',')

Callers 1

webInitMethod · 0.90

Calls 15

directoryPathFunction · 0.85
normalizePathFunction · 0.85
isWindowsDriveLetterPathFunction · 0.85
ntToPosixSlashesFunction · 0.85
posixToNtSlashesFunction · 0.85
checkFileFunction · 0.85
getFileItemsFunction · 0.85
infoMethod · 0.80
extendMethod · 0.80
readInputFunction · 0.70
filterNoneFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…