@@ -398,36 +398,39 @@ def dbTableValues(self, tableValues):
398
398
self ._write (tableValues , content_type = CONTENT_TYPE .DUMP_TABLE )
399
399
return
400
400
401
- _ = re .sub (r"[^\w]" , "_" , normalizeUnicode (unsafeSQLIdentificatorNaming (db )))
402
- if len (_ ) < len (db ) or IS_WIN and db .upper () in WINDOWS_RESERVED_NAMES :
403
- _ = unicodeencode (re .sub (r"[^\w]" , "_" , unsafeSQLIdentificatorNaming (db )))
404
- dumpDbPath = os .path .join (conf .dumpPath , "%s-%s" % (_ , hashlib .md5 (unicodeencode (db )).hexdigest ()[:8 ]))
405
- warnFile = True
406
- else :
407
- dumpDbPath = os .path .join (conf .dumpPath , _ )
408
-
409
401
if conf .dumpFormat == DUMP_FORMAT .SQLITE :
410
402
replication = Replication (os .path .join (conf .dumpPath , "%s.sqlite3" % unsafeSQLIdentificatorNaming (db )))
411
403
elif conf .dumpFormat in (DUMP_FORMAT .CSV , DUMP_FORMAT .HTML ):
404
+ dumpDbPath = os .path .join (conf .dumpPath , unsafeSQLIdentificatorNaming (db ))
405
+
412
406
if not os .path .isdir (dumpDbPath ):
413
407
try :
414
408
os .makedirs (dumpDbPath , 0755 )
415
- except (OSError , IOError ), ex :
416
- try :
417
- tempDir = tempfile .mkdtemp (prefix = "sqlmapdb" )
418
- except IOError , _ :
419
- errMsg = "unable to write to the temporary directory ('%s'). " % _
420
- errMsg += "Please make sure that your disk is not full and "
421
- errMsg += "that you have sufficient write permissions to "
422
- errMsg += "create temporary files and/or directories"
423
- raise SqlmapSystemException (errMsg )
424
-
425
- warnMsg = "unable to create dump directory "
426
- warnMsg += "'%s' (%s). " % (dumpDbPath , ex )
427
- warnMsg += "Using temporary directory '%s' instead" % tempDir
428
- logger .warn (warnMsg )
429
-
430
- dumpDbPath = tempDir
409
+ except :
410
+ warnFile = True
411
+
412
+ _ = unicodeencode (re .sub (r"[^\w]" , "_" , unsafeSQLIdentificatorNaming (db )))
413
+ dumpDbPath = os .path .join (conf .dumpPath , "%s-%s" % (_ , hashlib .md5 (unicodeencode (db )).hexdigest ()[:8 ]))
414
+
415
+ if not os .path .isdir (dumpDbPath ):
416
+ try :
417
+ os .makedirs (dumpDbPath , 0755 )
418
+ except Exception , ex :
419
+ try :
420
+ tempDir = tempfile .mkdtemp (prefix = "sqlmapdb" )
421
+ except IOError , _ :
422
+ errMsg = "unable to write to the temporary directory ('%s'). " % _
423
+ errMsg += "Please make sure that your disk is not full and "
424
+ errMsg += "that you have sufficient write permissions to "
425
+ errMsg += "create temporary files and/or directories"
426
+ raise SqlmapSystemException (errMsg )
427
+
428
+ warnMsg = "unable to create dump directory "
429
+ warnMsg += "'%s' (%s). " % (dumpDbPath , getSafeExString (ex ))
430
+ warnMsg += "Using temporary directory '%s' instead" % tempDir
431
+ logger .warn (warnMsg )
432
+
433
+ dumpDbPath = tempDir
431
434
432
435
_ = re .sub (r"[^\w]" , "_" , normalizeUnicode (unsafeSQLIdentificatorNaming (table )))
433
436
if len (_ ) < len (table ) or IS_WIN and table .upper () in WINDOWS_RESERVED_NAMES :
0 commit comments