def _createTargetDirs():
 try:
  if (not os.path.isdir(paths.SQLMAP_OUTPUT_PATH)):
   os.makedirs(paths.SQLMAP_OUTPUT_PATH, 493)
  _ = os.path.join(paths.SQLMAP_OUTPUT_PATH, randomStr())
  open(_, 'w+b').close()
  os.remove(_)
  if conf.outputDir:
   warnMsg = ("using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH)
   logger.warn(warnMsg)
 except (OSError, IOError) as ex:
  try:
   tempDir = tempfile.mkdtemp(prefix='sqlmapoutput')
  except Exception as _:
   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 %s output directory ' % ('create' if (not os.path.isdir(paths.SQLMAP_OUTPUT_PATH)) else 'write to the'))
  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, 493)
  except (OSError, IOError) as ex:
   try:
    tempDir = tempfile.mkdtemp(prefix='sqlmapoutput')
   except Exception as _:
    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 as 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, getSafeExString(ex)))
  raise SqlmapMissingPrivileges(errMsg)
 _createDumpDir()
 _createFilesDir()
 _configureDumper()

def _createTargetDirs ( ) : try : if ( not os . path . isdir ( paths . SQLMAP_OUTPUT_PATH ) ) : os . makedirs ( paths . SQLMAP_OUTPUT_PATH , 493 ) _ = os . path . join ( paths . SQLMAP_OUTPUT_PATH , randomStr ( ) ) open ( _ , 'w+b' ) . close ( ) os . remove ( _ ) if conf . outputDir : warnMsg = ( "using '%s' as the output directory" % paths . SQLMAP_OUTPUT_PATH ) logger . warn ( warnMsg ) except ( OSError , IOError ) as ex : try : tempDir = tempfile . mkdtemp ( prefix = 'sqlmapoutput' ) except Exception as _ : 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 %s output directory ' % ( 'create' if ( not os . path . isdir ( paths . SQLMAP_OUTPUT_PATH ) ) else 'write to the' ) ) 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 , 493 ) except ( OSError , IOError ) as ex : try : tempDir = tempfile . mkdtemp ( prefix = 'sqlmapoutput' ) except Exception as _ : 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 as 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 , getSafeExString ( ex ) ) ) raise SqlmapMissingPrivileges ( errMsg ) _createDumpDir ( ) _createFilesDir ( ) _configureDumper ( )
create the output directory .