Refactoring for Python 3 numliterals

* 2to3 `ls | grep -v thirdparty` -f numliterals
This commit is contained in:
akun 2018-02-01 22:30:04 +08:00
parent c0f5bf53ec
commit 158b529930
2 changed files with 7 additions and 7 deletions

View File

@ -415,7 +415,7 @@ class Dump(object):
elif conf.dumpFormat in (DUMP_FORMAT.CSV, DUMP_FORMAT.HTML): elif conf.dumpFormat in (DUMP_FORMAT.CSV, DUMP_FORMAT.HTML):
if not os.path.isdir(dumpDbPath): if not os.path.isdir(dumpDbPath):
try: try:
os.makedirs(dumpDbPath, 0755) os.makedirs(dumpDbPath, 0o755)
except: except:
warnFile = True warnFile = True
@ -424,7 +424,7 @@ class Dump(object):
if not os.path.isdir(dumpDbPath): if not os.path.isdir(dumpDbPath):
try: try:
os.makedirs(dumpDbPath, 0755) os.makedirs(dumpDbPath, 0o755)
except Exception as ex: except Exception as ex:
try: try:
tempDir = tempfile.mkdtemp(prefix="sqlmapdb") tempDir = tempfile.mkdtemp(prefix="sqlmapdb")
@ -612,7 +612,7 @@ class Dump(object):
mimetype = magic.from_buffer(value, mime=True) mimetype = magic.from_buffer(value, mime=True)
if any(mimetype.startswith(_) for _ in ("application", "image")): if any(mimetype.startswith(_) for _ in ("application", "image")):
if not os.path.isdir(dumpDbPath): 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))) _ = re.sub(r"[^\w]", UNSAFE_DUMP_FILEPATH_REPLACEMENT, normalizeUnicode(unsafeSQLIdentificatorNaming(column)))
filepath = os.path.join(dumpDbPath, "%s-%d.bin" % (_, randomInt(8))) filepath = os.path.join(dumpDbPath, "%s-%d.bin" % (_, randomInt(8)))

View File

@ -581,7 +581,7 @@ def _createFilesDir():
if not os.path.isdir(conf.filePath): if not os.path.isdir(conf.filePath):
try: try:
os.makedirs(conf.filePath, 0755) os.makedirs(conf.filePath, 0o755)
except OSError as ex: except OSError as ex:
tempDir = tempfile.mkdtemp(prefix="sqlmapfiles") tempDir = tempfile.mkdtemp(prefix="sqlmapfiles")
warnMsg = "unable to create files directory " warnMsg = "unable to create files directory "
@ -603,7 +603,7 @@ def _createDumpDir():
if not os.path.isdir(conf.dumpPath): if not os.path.isdir(conf.dumpPath):
try: try:
os.makedirs(conf.dumpPath, 0755) os.makedirs(conf.dumpPath, 0o755)
except OSError as ex: except OSError as ex:
tempDir = tempfile.mkdtemp(prefix="sqlmapdump") tempDir = tempfile.mkdtemp(prefix="sqlmapdump")
warnMsg = "unable to create dump directory " warnMsg = "unable to create dump directory "
@ -624,7 +624,7 @@ def _createTargetDirs():
try: try:
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH): 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()) _ = os.path.join(paths.SQLMAP_OUTPUT_PATH, randomStr())
open(_, "w+b").close() open(_, "w+b").close()
@ -654,7 +654,7 @@ def _createTargetDirs():
try: try:
if not os.path.isdir(conf.outputPath): if not os.path.isdir(conf.outputPath):
os.makedirs(conf.outputPath, 0755) os.makedirs(conf.outputPath, 0o755)
except (OSError, IOError, TypeError) as ex: except (OSError, IOError, TypeError) as ex:
try: try:
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")