Creates directories inside sqlmap's home directory
()
| 1579 | checkDependencies() |
| 1580 | |
| 1581 | def _createHomeDirectories(): |
| 1582 | """ |
| 1583 | Creates directories inside sqlmap's home directory |
| 1584 | """ |
| 1585 | |
| 1586 | if conf.get("purge"): |
| 1587 | return |
| 1588 | |
| 1589 | for context in ("output", "history"): |
| 1590 | directory = paths["SQLMAP_%s_PATH" % getUnicode(context).upper()] # NOTE: https://github.com/sqlmapproject/sqlmap/issues/4363 |
| 1591 | try: |
| 1592 | if not os.path.isdir(directory): |
| 1593 | os.makedirs(directory) |
| 1594 | |
| 1595 | _ = os.path.join(directory, randomStr()) |
| 1596 | open(_, "w+b").close() |
| 1597 | os.remove(_) |
| 1598 | |
| 1599 | if conf.get("outputDir") and context == "output": |
| 1600 | warnMsg = "using '%s' as the %s directory" % (directory, context) |
| 1601 | logger.warning(warnMsg) |
| 1602 | except (OSError, IOError) as ex: |
| 1603 | tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context) |
| 1604 | warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context) |
| 1605 | warnMsg += "'%s' (%s). " % (directory, getUnicode(ex)) |
| 1606 | warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir) |
| 1607 | logger.warning(warnMsg) |
| 1608 | |
| 1609 | paths["SQLMAP_%s_PATH" % context.upper()] = tempDir |
| 1610 | |
| 1611 | def _pympTempLeakPatch(tempDir): # Cross-referenced function |
| 1612 | raise NotImplementedError |
no test coverage detected
searching dependent graphs…