()
Create the output directory.
Create the output directory.
Create the output directory .
def _createTargetDirs():
    """
    Create the output directory.
    """

    if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
        try:
            if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
                os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755)
            warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH
            logger.warn(warnMsg)
        except (OSError, IOError), ex:
            try:
                tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
            except Exception, _:
                errMsg = "unable to write to the temporary directory ('%s'). " % _
                errMsg += "Please make sure that your disk is not full and "
                errMsg += "that you have sufficient write permissions to "
                errMsg += "create temporary files and/or directories"
                raise SqlmapSystemException(errMsg)

            warnMsg = "unable to create regular output directory "
            warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, getUnicode(ex))
            warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)
            logger.warn(warnMsg)

            paths.SQLMAP_OUTPUT_PATH = tempDir

    conf.outputPath = os.path.join(getUnicode(paths.SQLMAP_OUTPUT_PATH), normalizeUnicode(getUnicode(conf.hostname)))

    if not os.path.isdir(conf.outputPath):
        try:
            os.makedirs(conf.outputPath, 0755)
        except (OSError, IOError), ex:
            try:
                tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
            except Exception, _:
                errMsg = "unable to write to the temporary directory ('%s'). " % _
                errMsg += "Please make sure that your disk is not full and "
                errMsg += "that you have sufficient write permissions to "
                errMsg += "create temporary files and/or directories"
                raise SqlmapSystemException(errMsg)

            warnMsg = "unable to create output directory "
            warnMsg += "'%s' (%s). " % (conf.outputPath, getUnicode(ex))
            warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)
            logger.warn(warnMsg)

            conf.outputPath = tempDir

    try:
        with codecs.open(os.path.join(conf.outputPath, "target.txt"), "w+", UNICODE_ENCODING) as f:
            f.write(kb.originalUrls.get(conf.url) or conf.url or conf.hostname)
            f.write(" (%s)" % (HTTPMETHOD.POST if conf.data else HTTPMETHOD.GET))
            if conf.data:
                f.write("\n\n%s" % getUnicode(conf.data))
    except IOError, ex:
        if "denied" in getUnicode(ex):
            errMsg = "you don't have enough permissions "
        else:
            errMsg = "something went wrong while trying "
        errMsg += "to write to the output directory '%s' (%s)" % (paths.SQLMAP_OUTPUT_PATH, ex)

        raise SqlmapMissingPrivileges(errMsg)

    _createDumpDir()
    _createFilesDir()
    _configureDumper()
def _createTargetDirs ( ) : if not os . path . isdir ( paths . SQLMAP_OUTPUT_PATH ) : try : if not os . path . isdir ( paths . SQLMAP_OUTPUT_PATH ) : os . makedirs ( paths . SQLMAP_OUTPUT_PATH , 0755 ) warnMsg = "using '%s' as the output directory" % paths . SQLMAP_OUTPUT_PATH logger . warn ( warnMsg ) except ( OSError , IOError ) , ex : try : tempDir = tempfile . mkdtemp ( prefix = "sqlmapoutput" ) except Exception , _ : errMsg = "unable to write to the temporary directory ('%s'). " % _ errMsg += "Please make sure that your disk is not full and " errMsg += "that you have sufficient write permissions to " errMsg += "create temporary files and/or directories" raise SqlmapSystemException ( errMsg ) warnMsg = "unable to create regular output directory " warnMsg += "'%s' (%s). " % ( paths . SQLMAP_OUTPUT_PATH , getUnicode ( ex ) ) warnMsg += "Using temporary directory '%s' instead" % getUnicode ( tempDir ) logger . warn ( warnMsg ) paths . SQLMAP_OUTPUT_PATH = tempDir conf . outputPath = os . path . join ( getUnicode ( paths . SQLMAP_OUTPUT_PATH ) , normalizeUnicode ( getUnicode ( conf . hostname ) ) ) if not os . path . isdir ( conf . outputPath ) : try : os . makedirs ( conf . outputPath , 0755 ) except ( OSError , IOError ) , ex : try : tempDir = tempfile . mkdtemp ( prefix = "sqlmapoutput" ) except Exception , _ : errMsg = "unable to write to the temporary directory ('%s'). " % _ errMsg += "Please make sure that your disk is not full and " errMsg += "that you have sufficient write permissions to " errMsg += "create temporary files and/or directories" raise SqlmapSystemException ( errMsg ) warnMsg = "unable to create output directory " warnMsg += "'%s' (%s). " % ( conf . outputPath , getUnicode ( ex ) ) warnMsg += "Using temporary directory '%s' instead" % getUnicode ( tempDir ) logger . warn ( warnMsg ) conf . outputPath = tempDir try : with codecs . open ( os . path . join ( conf . outputPath , "target.txt" ) , "w+" , UNICODE_ENCODING ) as f : f . write ( kb . originalUrls . get ( conf . url ) or conf . url or conf . hostname ) f . write ( " (%s)" % ( HTTPMETHOD . POST if conf . data else HTTPMETHOD . GET ) ) if conf . data : f . write ( "\n\n%s" % getUnicode ( conf . data ) ) except IOError , ex : if "denied" in getUnicode ( ex ) : errMsg = "you don't have enough permissions " else : errMsg = "something went wrong while trying " errMsg += "to write to the output directory '%s' (%s)" % ( paths . SQLMAP_OUTPUT_PATH , ex ) raise SqlmapMissingPrivileges ( errMsg ) _createDumpDir ( ) _createFilesDir ( ) _configureDumper ( )