From d8dd37510c6217bd6b7418efedf252303a612268 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 1 Oct 2016 21:02:40 +0200 Subject: [PATCH] Fixes #2202 --- lib/core/option.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 218e7e7b5..362fff934 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1571,7 +1571,7 @@ def _createTemporaryDirectory(): try: if not os.path.isdir(tempfile.gettempdir()): os.makedirs(tempfile.gettempdir()) - except (OSError, IOError), ex: + except (OSError, IOError, WindowsError), ex: warnMsg = "there has been a problem while accessing " warnMsg += "system's temporary directory location(s) ('%s'). Please " % getSafeExString(ex) warnMsg += "make sure that there is enough disk space left. If problem persists, " @@ -1582,13 +1582,18 @@ def _createTemporaryDirectory(): if "sqlmap" not in (tempfile.tempdir or "") or conf.tmpDir and tempfile.tempdir == conf.tmpDir: try: tempfile.tempdir = tempfile.mkdtemp(prefix="sqlmap", suffix=str(os.getpid())) - except (OSError, IOError), ex: + except (OSError, IOError, WindowsError): tempfile.tempdir = os.path.join(paths.SQLMAP_HOME_PATH, "tmp", "sqlmap%s%d" % (randomStr(6), os.getpid())) kb.tempDir = tempfile.tempdir if not os.path.isdir(tempfile.tempdir): - os.makedirs(tempfile.tempdir) + try: + os.makedirs(tempfile.tempdir) + except (OSError, IOError, WindowsError), ex: + errMsg = "there has been a problem while setting " + errMsg += "temporary directory location ('%s')" % getSafeExString(ex) + raise SqlmapSystemException, errMsg def _cleanupOptions(): """