mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-31 16:07:55 +03:00 
			
		
		
		
	Couple of updates regarding readline capabilities
This commit is contained in:
		
							parent
							
								
									f9ee0f4c0a
								
							
						
					
					
						commit
						4b00924826
					
				|  | @ -1268,14 +1268,22 @@ def setPaths(rootPath): | |||
|     paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner") | ||||
|     paths.SQLMAP_XML_PAYLOADS_PATH = os.path.join(paths.SQLMAP_XML_PATH, "payloads") | ||||
| 
 | ||||
|     _ = os.path.join(os.path.expandvars(os.path.expanduser("~")), ".sqlmap") | ||||
|     paths.SQLMAP_HOME_PATH = _ | ||||
|     paths.SQLMAP_OUTPUT_PATH = getUnicode(paths.get("SQLMAP_OUTPUT_PATH", os.path.join(_, "output")), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) | ||||
|     if IS_WIN: | ||||
|         if os.getenv("LOCALAPPDATA"): | ||||
|             paths.SQLMAP_HOME_PATH = os.path.expandvars("%LOCALAPPDATA%\\sqlmap") | ||||
|         elif os.getenv("USERPROFILE"): | ||||
|             paths.SQLMAP_HOME_PATH = os.path.expandvars("%USERPROFILE%\\Local Settings\\sqlmap") | ||||
|         else: | ||||
|             paths.SQLMAP_HOME_PATH = os.path.join(os.path.expandvars(os.path.expanduser("~")), "sqlmap") | ||||
|     else: | ||||
|         paths.SQLMAP_HOME_PATH = os.path.join(os.path.expandvars(os.path.expanduser("~")), ".sqlmap") | ||||
| 
 | ||||
|     paths.SQLMAP_OUTPUT_PATH = getUnicode(paths.get("SQLMAP_OUTPUT_PATH", os.path.join(paths.SQLMAP_HOME_PATH, "output")), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) | ||||
|     paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") | ||||
|     paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") | ||||
| 
 | ||||
|     # history files | ||||
|     paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(_, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) | ||||
|     paths.SQLMAP_HISTORY_PATH = getUnicode(os.path.join(paths.SQLMAP_HOME_PATH, "history"), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) | ||||
|     paths.API_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "api.hst") | ||||
|     paths.OS_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "os.hst") | ||||
|     paths.SQL_SHELL_HISTORY = os.path.join(paths.SQLMAP_HISTORY_PATH, "sql.hst") | ||||
|  |  | |||
|  | @ -1413,6 +1413,41 @@ def _checkDependencies(): | |||
|     if conf.dependencies: | ||||
|         checkDependencies() | ||||
| 
 | ||||
| def _createHomeDirectories(): | ||||
|     """ | ||||
|     Creates directories inside sqlmap's home directory | ||||
|     """ | ||||
| 
 | ||||
|     for context in "output", "history": | ||||
|         directory = paths["SQLMAP_%s_PATH" % context.upper()] | ||||
|         try: | ||||
|             if not os.path.isdir(directory): | ||||
|                 os.makedirs(directory) | ||||
| 
 | ||||
|             _ = os.path.join(directory, randomStr()) | ||||
|             open(_, "w+b").close() | ||||
|             os.remove(_) | ||||
| 
 | ||||
|             if conf.outputDir and context == "output": | ||||
|                 warnMsg = "using '%s' as the %s directory" % (directory, context) | ||||
|                 logger.warn(warnMsg) | ||||
|         except (OSError, IOError) as ex: | ||||
|             try: | ||||
|                 tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context) | ||||
|             except Exception as _: | ||||
|                 errMsg = "unable to write to the temporary directory ('%s'). " % _ | ||||
|                 errMsg += "Please make sure that your disk is not full and " | ||||
|                 errMsg += "that you have sufficient write permissions to " | ||||
|                 errMsg += "create temporary files and/or directories" | ||||
|                 raise SqlmapSystemException(errMsg) | ||||
| 
 | ||||
|             warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context) | ||||
|             warnMsg += "'%s' (%s). " % (directory, getUnicode(ex)) | ||||
|             warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir) | ||||
|             logger.warn(warnMsg) | ||||
| 
 | ||||
|             paths["SQLMAP_%s_PATH" % context.upper()] = tempDir | ||||
| 
 | ||||
| def _createTemporaryDirectory(): | ||||
|     """ | ||||
|     Creates temporary directory for this run. | ||||
|  | @ -2500,6 +2535,7 @@ def init(): | |||
|     _cleanupEnvironment() | ||||
|     _purge() | ||||
|     _checkDependencies() | ||||
|     _createHomeDirectories() | ||||
|     _createTemporaryDirectory() | ||||
|     _basicOptionValidation() | ||||
|     _setProxyList() | ||||
|  |  | |||
|  | @ -56,9 +56,7 @@ if PLATFORM == 'mac' and _readline: | |||
| # http://mail.python.org/pipermail/python-dev/2003-August/037845.html | ||||
| # has the original discussion. | ||||
| if _readline: | ||||
|     try: | ||||
|         _readline.clear_history() | ||||
|     except AttributeError: | ||||
|     if not hasattr(_readline, "clear_history"): | ||||
|         def clear_history(): | ||||
|             pass | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME | |||
| from lib.core.enums import OS | ||||
| 
 | ||||
| # sqlmap version (<major>.<minor>.<month>.<monthly commit>) | ||||
| VERSION = "1.3.2.4" | ||||
| VERSION = "1.3.2.5" | ||||
| TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" | ||||
| TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} | ||||
| VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) | ||||
|  |  | |||
|  | @ -630,36 +630,6 @@ def _createTargetDirs(): | |||
|     Create the output directory. | ||||
|     """ | ||||
| 
 | ||||
|     for context in "output", "history": | ||||
|         directory = paths["SQLMAP_%s_PATH" % context.upper()] | ||||
|         try: | ||||
|             if not os.path.isdir(directory): | ||||
|                 os.makedirs(directory) | ||||
| 
 | ||||
|             _ = os.path.join(directory, randomStr()) | ||||
|             open(_, "w+b").close() | ||||
|             os.remove(_) | ||||
| 
 | ||||
|             if conf.outputDir and context == "output": | ||||
|                 warnMsg = "using '%s' as the %s directory" % (directory, context) | ||||
|                 logger.warn(warnMsg) | ||||
|         except (OSError, IOError) as ex: | ||||
|             try: | ||||
|                 tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context) | ||||
|             except Exception as _: | ||||
|                 errMsg = "unable to write to the temporary directory ('%s'). " % _ | ||||
|                 errMsg += "Please make sure that your disk is not full and " | ||||
|                 errMsg += "that you have sufficient write permissions to " | ||||
|                 errMsg += "create temporary files and/or directories" | ||||
|                 raise SqlmapSystemException(errMsg) | ||||
| 
 | ||||
|             warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context) | ||||
|             warnMsg += "'%s' (%s). " % (directory, getUnicode(ex)) | ||||
|             warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir) | ||||
|             logger.warn(warnMsg) | ||||
| 
 | ||||
|             paths["SQLMAP_%s_PATH" % context.upper()] = tempDir | ||||
| 
 | ||||
|     conf.outputPath = os.path.join(getUnicode(paths.SQLMAP_OUTPUT_PATH), normalizeUnicode(getUnicode(conf.hostname))) | ||||
| 
 | ||||
|     try: | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ c1da277517c7ec4c23e953a51b51e203  lib/controller/handler.py | |||
| fb6be55d21a70765e35549af2484f762  lib/controller/__init__.py | ||||
| ed7874be0d2d3802f3d20184f2b280d5  lib/core/agent.py | ||||
| a932126e7d80e545c5d44af178d0bc0c  lib/core/bigarray.py | ||||
| abbe98412255c4856ef30a15da8136a2  lib/core/common.py | ||||
| e253cc58cb0d2bc01a68cfbe58266435  lib/core/common.py | ||||
| de8d27ae6241163ff9e97aa9e7c51a18  lib/core/convert.py | ||||
| abcb1121eb56d3401839d14e8ed06b6e  lib/core/data.py | ||||
| e1f7758f433202c50426efde5eb96768  lib/core/datatype.py | ||||
|  | @ -43,17 +43,17 @@ e1f7758f433202c50426efde5eb96768  lib/core/datatype.py | |||
| fb6be55d21a70765e35549af2484f762  lib/core/__init__.py | ||||
| 18c896b157b03af716542e5fe9233ef9  lib/core/log.py | ||||
| fa9f24e88c81a6cef52da3dd5e637010  lib/core/optiondict.py | ||||
| 7099592edf923ff3b88ecc4a98b52762  lib/core/option.py | ||||
| f479c164e44c766316205aa16cf3947b  lib/core/option.py | ||||
| fe370021c6bc99daf44b2bfc0d1effb3  lib/core/patch.py | ||||
| 4b12aa67fbf6c973d12e54cf9cb54ea0  lib/core/profiling.py | ||||
| 5e2c16a8e2daee22dd545df13386e7a3  lib/core/readlineng.py | ||||
| d5ef43fe3cdd6c2602d7db45651f9ceb  lib/core/readlineng.py | ||||
| 7d8a22c582ad201f65b73225e4456170  lib/core/replication.py | ||||
| 3179d34f371e0295dd4604568fb30bcd  lib/core/revision.py | ||||
| d6269c55789f78cf707e09a0f5b45443  lib/core/session.py | ||||
| eb57ce3f759d37233aba581cc8c88751  lib/core/settings.py | ||||
| 91a39930f92053b07f6ba594b6691fb8  lib/core/settings.py | ||||
| 4483b4a5b601d8f1c4281071dff21ecc  lib/core/shell.py | ||||
| 10fd19b0716ed261e6d04f311f6f527c  lib/core/subprocessng.py | ||||
| 9c7b5c6397fb3da33e7a4d7876d159c6  lib/core/target.py | ||||
| 43772ea73e9e3d446f782af591cb4eda  lib/core/target.py | ||||
| 7857b24b7865ccb4a05283faa596974d  lib/core/testing.py | ||||
| e9788d2992f842cf91ab67389bf4372a  lib/core/threads.py | ||||
| 2c263c8610667fdc593c50a35ab20f57  lib/core/unescaper.py | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user