From 53c688fae5e2cc39a8f441b287044a6a99122d68 Mon Sep 17 00:00:00 2001 From: akun <6awkun@gmail.com> Date: Thu, 1 Feb 2018 22:30:04 +0800 Subject: [PATCH] Refactoring for compatible with Python 3 * transformation: numliterals --- lib/core/dump.py | 6 +++--- lib/core/target.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/core/dump.py b/lib/core/dump.py index 7a7928dbe..f70f2676b 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -414,7 +414,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 @@ -423,7 +423,7 @@ class Dump(object): if not os.path.isdir(dumpDbPath): try: - os.makedirs(dumpDbPath, 0755) + os.makedirs(dumpDbPath, 0o755) except Exception, ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapdb") @@ -611,7 +611,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]", "_", 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 146f3de47..21034f9db 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, 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, 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), ex: try: tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")