diff --git a/lib/core/dump.py b/lib/core/dump.py index 803cbf1d2..cb78be558 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -415,7 +415,7 @@ class Dump(object): elif conf.dumpFormat in (DUMP_FORMAT.CSV, DUMP_FORMAT.HTML): if not os.path.isdir(dumpDbPath): try: - os.makedirs(dumpDbPath, 0755) + os.makedirs(dumpDbPath, 0o755) except: warnFile = True @@ -424,7 +424,7 @@ class Dump(object): if not os.path.isdir(dumpDbPath): try: - os.makedirs(dumpDbPath, 0755) + os.makedirs(dumpDbPath, 0o755) except Exception as ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapdb") @@ -612,7 +612,7 @@ class Dump(object): mimetype = magic.from_buffer(value, mime=True) if any(mimetype.startswith(_) for _ in ("application", "image")): if not os.path.isdir(dumpDbPath): - os.makedirs(dumpDbPath, 0755) + os.makedirs(dumpDbPath, 0o755) _ = re.sub(r"[^\w]", UNSAFE_DUMP_FILEPATH_REPLACEMENT, normalizeUnicode(unsafeSQLIdentificatorNaming(column))) filepath = os.path.join(dumpDbPath, "%s-%d.bin" % (_, randomInt(8))) diff --git a/lib/core/target.py b/lib/core/target.py index 370f1b19f..fc730222d 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -581,7 +581,7 @@ def _createFilesDir(): if not os.path.isdir(conf.filePath): try: - os.makedirs(conf.filePath, 0755) + os.makedirs(conf.filePath, 0o755) except OSError as ex: tempDir = tempfile.mkdtemp(prefix="sqlmapfiles") warnMsg = "unable to create files directory " @@ -603,7 +603,7 @@ def _createDumpDir(): if not os.path.isdir(conf.dumpPath): try: - os.makedirs(conf.dumpPath, 0755) + os.makedirs(conf.dumpPath, 0o755) except OSError as ex: tempDir = tempfile.mkdtemp(prefix="sqlmapdump") warnMsg = "unable to create dump directory " @@ -624,7 +624,7 @@ def _createTargetDirs(): try: if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH): - os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755) + os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0o755) _ = os.path.join(paths.SQLMAP_OUTPUT_PATH, randomStr()) open(_, "w+b").close() @@ -654,7 +654,7 @@ def _createTargetDirs(): try: if not os.path.isdir(conf.outputPath): - os.makedirs(conf.outputPath, 0755) + os.makedirs(conf.outputPath, 0o755) except (OSError, IOError, TypeError) as ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")